belangeo / pyo

Python DSP module
GNU Lesser General Public License v3.0
1.32k stars 132 forks source link

Invalid sample rate when using ASIO driver #252

Open MiniMinnoww opened 2 years ago

MiniMinnoww commented 2 years ago

I am trying to use the ASIO driver, as I need very low latency with audio being recorded straight in, and sent straight out again. However, when doing this, this error comes up:

Portaudio error in Pa_OpenStream: Invalid sample rate

Here is my code:

from pyo import *
pa_list_devices()
s = Server(winhost="asio", sr=44100)
s.boot()
s.start()
mic = Input().play().out()
h = Harmonizer(mic).out()

while True:
    pass

I have tried with 44100, 48000, and many other sample rates. My settings show my microphone is 44100, 2 channel 16bit.

belangeo commented 1 year ago

Maybe the default input and output devices are the one you expect... You can control the specific devices to use with Server.setInputDevice() and Server.setOutputDevice():

https://belangeo.github.io/pyo/api/classes/server.html#pyo.Server.setInputDevice https://belangeo.github.io/pyo/api/classes/server.html#pyo.Server.setOutputDevice