spatialaudio / python-sounddevice

:sound: Play and Record Sound with Python :snake:
https://python-sounddevice.readthedocs.io/
MIT License
980 stars 145 forks source link

Simultaneous audio playback datatype issue #533

Closed Koalllla closed 1 month ago

Koalllla commented 2 months ago

I'm using a Raspberry Pi along with a HiFiBerry DAC + ADC PRO to generate and transmit white noise, and then I'm capturing and reading it back in using a loopback configuration. The problem I have is when I use playrec it scales it to a value between [1 ,- 1]. I think the problem is with the datatype only allowing [-1,1] but I have set the dtype to int32 so I don't get why this is not solved. Is this unusual with this command cause i haven't found anything about scaling in the documentation of this library? Any way I can set the datatype the library uses so I get an accurate output without having to manually scale it? I need to calculate the gain of the recorded / sent signal that's why I don't want to manually scale it.

mgeier commented 1 month ago

i haven't found anything about scaling in the documentation

I think the only mention is at the documentation of the dtype parameter at https://python-sounddevice.readthedocs.io/en/0.4.6/api/streams.html#sounddevice.Stream

What values do you get? What values do you expect?

Koalllla commented 1 month ago

It was a hardware related issue with the HiFiBerry, and had nothing to do with the software.