Quantcast
Viewing all articles
Browse latest Browse all 5097

General • Help understanding I2S audio example

I'm trying to make sense of the sine_wave.c example from the pico-playground repository (which uses this pico_audio and pico_audio_i2s code as well).

I'm caught up on a few things, and if anyone has tips to understand one or more of these (by all means, please jump in even if you only have a little bit of insight)....

1. EDIT: NEVERMIND #1 here. Default step is 33, which leads to 33*24000/2048 == 387. Original question: With .sample_freq = 24000, and SINE_WAVE_TABLE_LEN 2048, and iterating through the sine table one step at a time, wouldn't that make the output frequency 24000/2048 == ~11.7 Hz ? I'm measuring ~370 Hz.

2. Is give_audio_buffer(ap, buffer) blocking for the appropriate amount of time to ensure that number of samples gets sent in the appropriate time span? Or if not, how is timing ensured? I don't see any timer usage in the main program

3. Why are there multiple buffers? It seems 3 was chosen here

4. Why is step being calculated with increments of 0x10000, then right shifted 16bits

Statistics: Posted by mstrat — Mon Jul 22, 2024 5:09 pm



Viewing all articles
Browse latest Browse all 5097

Trending Articles