Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7595

Interfacing (DSI, CSI, I2C, etc.) • Re: STICKY: The I2S sound thread. [I2S works]

$
0
0
At least at this moment, the issue is not the limited RPi performance, or lack of external precise clock source. The issue is that the driver ignores the sample_rate parameter.
I tried parameter = 44100, but I2S still outputting 48000.
So my main question is: how to change the frequency?

I'm initialising I2S using this:

Code:

#define SAMPLE_RATE 44100#define CHANNELS 2    // Allocate hardware parameters    snd_pcm_hw_params_alloca(&params);    snd_pcm_hw_params_any(handle, params);    snd_pcm_hw_params_set_access(handle, params, SND_PCM_ACCESS_RW_INTERLEAVED);    snd_pcm_hw_params_set_format(handle, params, SND_PCM_FORMAT_S32_LE);    snd_pcm_hw_params_set_channels(handle, params, CHANNELS);    unsigned int rate = SAMPLE_RATE;    snd_pcm_hw_params_set_rate_near(handle, params, &rate, 0);    snd_pcm_hw_params(handle, params);
I can share all the code, if necessary.

Statistics: Posted by everito — Wed Feb 05, 2025 10:11 am



Viewing all articles
Browse latest Browse all 7595

Trending Articles