I'm trying to get started with programming a small synthesizer (wave generator) on my raspberry pi 3a+. To start off, I tried to use python's sounddevice module to play a stream from a numpy - array. However, my raspberry pi doesn't output any sound, which is weird, since the exact same code works perfectly fine on my laptop and produces a nice, steady sine - wave tone, like you'd expect.
The code I used is basically just a copied example code from the sounddevice documentation, it can be found here: https://python-sounddevice.readthedocs.io/en/0.4.1/examples.html#play-a-sine-signal
I think downloaded all required modules on my pi (portAudio etc.), as I have downloaded the same ones on my laptop, where the code works.
Could it be that sounddevice just can't handle some part of the pi's hardware, or that I messed up somewhere in the ALSA - settings (although I checked several times)?
Interestingly, the pi plays sound perfectly fine with the simpleaudio - module, which is sadly not versatile enough for what I'm planning to do, which is why I need sounddevice or something similar. I'd be very thankful if someone could help me here.
You need to set the samplerate in /etc/asounc.config to whatever samplerate you plan to use.
Your applications will need to use this samplerate to work corretly so ensure that it is set properly in you code.
Hopefully this solves your issue