atomic14 / atomic14/esp32-pdm-audio

I2S PDM output works only on certain sample rates?

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
23
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Hi,
thanks for your nice examples. I was struggling to produce any reasonable sound out of PDM output on my own, but got only a static noise instead. Your PDM example works much better even though it is nearly the same code I used except one small detail. I used sample rate 22050, yours is specified as 16000. The I2S PDM audio with a simple RC filter on the output seems to work only if the sample rate is specified in multiplies of 8000 - so 8000, 16000, 24000,32000, 40000, 48000. Any other value produces PDM pulses that are not compatible with the simple RC filter - it resembles a white noise on the output. I use ESP32-S3 for my testing.

For others reading this note and having an issue with distorted sound: the I2S PDM example multiples the audio samples by 10 and then clamps it (See PDMOutput.h, normalised *= 10.0f). This works well for sound samples with a low volume, but if your digital samples are already well amplified this extra digital amplification in the code makes the audio output distorted. To fix it, reduce the multiplication factor to 2 or less.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the PDM example and PDMOutput.h, then reproduce the output at 22050 Hz and at the listed multiples of 8000 on an ESP32-S3 with the simple RC filter. Compare the generated audio and verify whether the sample-rate behavior and the extra amplification noted in PDMOutput.h are expected. Done means the supported rates or required code change are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.