belangeo/pyo

Does not work on mac

Fraer opened this issue · 6 comments

Fraer commented

On mac with python 3.9.9:

Pyo warning: Portaudio input device `MacBook Pro Microphone` has fewer channels (1) than requested (2).
||PaMacCore (AUHAL)|| Error on line 1301: err='-66748', msg=Unknown Error
Portaudio error in Pa_OpenStream: Internal PortAudio error
Pyo error: From portaudio, Internal PortAudio error
Portaudio error in Pa_CloseStream (pa_deinit): PortAudio not initialized
Portaudio error in Pa_Terminate (pa_deinit): PortAudio not initialized
Pyo error: 
Server not booted.

Hi,

Try with:

Server(ichnls=1)

Fraer commented

thank you!
looks like portaudio was also missing, so i've installed it:

brew install portaudio --HEAD

I'm running the following code:

from pyo import *
pyoServer = Server(ichnls=1).boot()
pyoServer.start()
sf = SfPlayer("/Users/toto/Downloads/sound.wav", speed=2, loop=False).out()
print("ok")

i hear the sound, it's fine but the print("ok") statement is not executed and the following log appears:

||PaMacCore (AUHAL)|| Error on line 2500: err='-50', msg=Unknown Error
||PaMacCore (AUHAL)|| Error on line 2500: err='-50', msg=Unknown Error

I'm getting similar errors. Intel Mac, macOS Monterey, Python 3.8.9.

||PaMacCore (AUHAL)|| Error on line 1316: err='-66748', msg=Unknown Error Portaudio error in Pa_OpenStream: Internal PortAudio error Pyo error: From portaudio, Internal PortAudio error Portaudio error in Pa_CloseStream (pa_deinit): PortAudio not initialized Portaudio error in Pa_Terminate (pa_deinit): PortAudio not initialized Pyo error: Server not booted. Traceback (most recent call last): File "mgen.py", line 220, in <module> main() File "/Users/ant/Library/Python/3.8/lib/python/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/Users/ant/Library/Python/3.8/lib/python/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Users/ant/Library/Python/3.8/lib/python/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/ant/Library/Python/3.8/lib/python/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "mgen.py", line 163, in main population_fitness = [(genome, fitness(genome, s, num_bars, num_notes, num_steps, pauses, key, scale, root, bpm)) for genome in population] File "mgen.py", line 163, in <listcomp> population_fitness = [(genome, fitness(genome, s, num_bars, num_notes, num_steps, pauses, key, scale, root, bpm)) for genome in population] File "mgen.py", line 78, in fitness m = metronome(bpm) File "mgen.py", line 101, in metronome met = Metro(time=1 / (bpm / 60.0)).play() File "/Users/ant/Library/Python/3.8/lib/python/site-packages/pyo/lib/triggers.py", line 120, in __init__ PyoObject.__init__(self) File "/Users/ant/Library/Python/3.8/lib/python/site-packages/pyo/lib/_core.py", line 1201, in __init__ PyoObjectBase.__init__(self) File "/Users/ant/Library/Python/3.8/lib/python/site-packages/pyo/lib/_core.py", line 889, in __init__ raise PyoServerStateException("The Server must be booted before " pyo.lib._core.PyoServerStateException: The Server must be booted before creating any audio object.

Using Python 3.9, here's a similar error:

In [3]: s = pyo.Server(ichnls=1).boot()
||PaMacCore (AUHAL)|| Error on line 1301: err='-66748', msg=Unknown Error
Portaudio error in Pa_OpenStream: Internal PortAudio error
Pyo error: From portaudio, Internal PortAudio error
Portaudio error in Pa_CloseStream (pa_deinit): PortAudio not initialized
Portaudio error in Pa_Terminate (pa_deinit): PortAudio not initialized
Pyo error: 
Server not booted.
Pyo warning: Portmidi warning: no midi device found!
Portmidi closed.

It looks like there's a related discussion here, unresolved as of today.

I was able to move forward with the most recent posts there, by doing this:

>>> import pyo as p
>>> s = p.Server(audio="coreaudio")
>>> s.boot()
>>> s.start()
>>> sf = p.SfPlayer("sound.aif").out()

Same problem here macOS 12.6 (21G115)

This does not run and corrupts CoreAudio. I can't play any song after running this script and must reset sudo killall coreaudiod to get it to go back to normal

s = pyo.Server(audio="coreaudio").boot()
s.start()
a = pyo.Sine(mul=0.01).out()