2

I am using Pyo (http://ajaxsoundstudio.com/software/pyo/) in Python 2.7.14 and I an trying to play an audio file with this code

from pyo import *
s = Server()
s.boot()
s.start()
sf  = SfPlayer("C:\Users\name\Downloads\audio.mp3", speed=1, loop=True).out()

but I get this message:

Traceback (most recent call last):
  File "C:\Python27\pyotest.py", line 5, in <module>
    sf  = SfPlayer("C:\Users\name\Downloads\audio.mp3", speed=1, loop=True).out()
  File "C:\Python27\lib\site-packages\pyolib\players.py", line 98, in __init__
    PyoObject.__init__(self, mul, add)
  File "C:\Python27\lib\site-packages\pyolib\_core.py", line 967, in __init__
    PyoObjectBase.__init__(self)
  File "C:\Python27\lib\site-packages\pyolib\_core.py", line 809, in __init__
    raise PyoServerStateException("The Server must be booted before "
PyoServerStateException: The Server must be booted before creating any audio object.
romoon
  • 21
  • 3
  • This could be a misleading error message actually caused by something else: [`\a` in a string does not mean a backslash followed by an `a`, it means the BEL character.](https://docs.python.org/2.7/reference/lexical_analysis.html#string-literals) Always either escape your backslashes, use forward slashes instead, of use raw string literals when dealing with Windows paths. – abarnert Aug 22 '18 at 01:29
  • @abarnert I changed the \ to / but I still get the same message – romoon Aug 22 '18 at 04:08
  • Relatd: https://stackoverflow.com/questions/32445375/pyo-server-boot-returns-error-on-ubuntu-14-04 – Ciro Santilli OurBigBook.com Nov 22 '20 at 23:06

1 Answers1

0

I had the same error once (on Windows). Started the E-Pyo Editor that comes with installing Pyo. After that it worked fine.

If that doesn't help you might want to set the server options and the output device manually.

Get the ID of the desired output device with

pa_list_devices()

If you found your ID you can set it with this command (change the 0 to your device ID) and then boot the server:

s.setOutputDevice(0)
s.boot()
Olfred
  • 41
  • 2