Skip to content

Commit e7711ab

Browse files
authored
Switch PDM TX to the DAC mode. (#2134)
### What changed Replaced: * `I2S_PDM_TX_CLK_DEFAULT_CONFIG` → `I2S_PDM_TX_CLK_DAC_DEFAULT_CONFIG` * `I2S_PDM_TX_SLOT_DEFAULT_CONFIG` → `I2S_PDM_TX_SLOT_DAC_DEFAULT_CONFIG` These macros switch `line_mode` to `I2S_PDM_TX_ONE_LINE_DAC` and adjust other related fields. ### Why PDM output sounded too high-pitched when using mono audio. I assume the point of `DriverPDM` is to simulate a DAC, and this config matches that better — especially compared to the old IDF 4 “legacy” driver. Audio now sounds correct.
1 parent 4598ddf commit e7711ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/AudioTools/CoreAudio/AudioI2S/I2SESP32V1.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ class I2SDriverESP32V1 {
351351

352352
protected:
353353
i2s_pdm_tx_slot_config_t getTxSlotConfig(I2SConfigESP32V1 &cfg) {
354-
return I2S_PDM_TX_SLOT_DEFAULT_CONFIG(
354+
return I2S_PDM_TX_SLOT_DAC_DEFAULT_CONFIG(
355355
(i2s_data_bit_width_t)cfg.bits_per_sample,
356356
(i2s_slot_mode_t)cfg.channels);
357357
}
@@ -363,7 +363,7 @@ class I2SDriverESP32V1 {
363363
}
364364

365365
i2s_pdm_tx_clk_config_t getTxClockConfig(I2SConfigESP32V1 &cfg) {
366-
return I2S_PDM_TX_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
366+
return I2S_PDM_TX_CLK_DAC_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
367367
}
368368

369369
bool startTX(I2SConfigESP32V1 &cfg, i2s_chan_handle_t &tx_chan, int txPin) {
@@ -603,4 +603,4 @@ using I2SDriver = I2SDriverESP32V1;
603603

604604
} // namespace audio_tools
605605

606-
#endif
606+
#endif

0 commit comments

Comments
 (0)