Hi all,
I also set the AUDIO_BIAS to << 19 and combined with a << 12 in updateAudio() I get a nice 2V amplitude.
The stray DC line at 0V is still in the signal, and the sine is choppy. See attachment. I'm sure this can be resolved with a correct combination of timing and/or buffer parameters, but I haven't been able to crack it. Any ideas?
Other oddity: signal outputs on both pin 26 and 27.
Code snippets from MozziGuts.cpp:
[...]
// ESP32
#if IS_ESP32()
#include <driver/i2s.h>
#include "freertos/queue.h"
hw_timer_t * timer = NULL;
int i2s_num = 0;
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN),
.sample_rate = 44100,
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
.channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT,
.communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S_MSB),
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 8,
.dma_buf_len = 8,
.use_apll = 0
};
#endif
[...]
#if !IS_AVR()
static void startAudioStandard() {
[...]
#elif IS_ESP32()
#ifdef DO_NOT_INIT_ESP32_I2S
#else
i2s_driver_install((i2s_port_t)i2s_num, &i2s_config, 0, NULL);
i2s_set_pin((i2s_port_t)i2s_num, NULL);
i2s_set_sample_rates((i2s_port_t)i2s_num, 44100);
// i2s_set_clk((i2s_port_t)i2s_num, 44100, I2S_BITS_PER_SAMPLE_16BIT, I2S_CHANNEL_MONO); // this line seems useless
i2s_zero_dma_buffer((i2s_port_t)i2s_num);
i2s_set_dac_mode(I2S_DAC_CHANNEL_RIGHT_EN);
timer = timerBegin(0, 80, true);
timerAttachInterrupt(timer, &esp32AudioOutput, true);
// zc - 30 microseconds is ok for now
timerAlarmWrite(timer, 30, true);
timerAlarmEnable(timer);
#endif
Best, Dieter