belangeo / pyo

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

SfPlayer and SfMarker tracebacks #123

Closed vism2889 closed 3 years ago

vism2889 commented 6 years ago

Have tried with SfPlayer and SfMarker. Code:

from pyo import *

s = Server().boot()
s.start()
sf = SfMarkerLooper("/sample.wav", speed=[.999,1], mul=.3).out()
s.gui(locals())

Terminal Output:

Traceback (most recent call last):
  File "fm_synth.py", line 5, in <module>
    sf = SfMarkerLooper("/sample.wav", speed=[.999,1], mul=.3).out()
  File "/Users/morganvisnesky/anaconda3/lib/python3.6/site-packages/pyolib/players.py", line 514, in __init__
    self._snd_size, self._dur, self._snd_sr, self._snd_chnls, _format, _type = sndinfo(path[0])
TypeError: 'NoneType' object is not iterable

Also getting this message every time i run a pyo script, but using pythonw filename.py at the terminal seems to allow everything to work with the exception of these sample related calls:

"WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h."

belangeo commented 6 years ago

This path, "/sample.wav", means that a file sample.wav is located at the root of the computer... It seems suspicious!

Also, SfMarker* objects work only with AIFF files as it needs to read the markers chunk.

The warning just says that a component involve in the process (my guess would be portaudio) still use some deprecated carbon calls. Nothing to worry about for now...

vism2889 commented 6 years ago

Changed to this:

from pyo import *

s = Server().boot()
s.start()
sf = SfMarkerLooper("sample.aif", speed=[.999,1], mul=.3).out()
s.gui(locals())

using a mac, file is in same folder as .py file

error message is still the same:

Traceback (most recent call last):
  File "sample_test.py", line 5, in <module>
    sf = SfMarkerLooper("sample.aif", speed=[.999,1], mul=.3).out()
  File "/Users/morganvisnesky/anaconda3/lib/python3.6/site-packages/pyolib/players.py", line 514, in __init__
    self._snd_size, self._dur, self._snd_sr, self._snd_chnls, _format, _type = sndinfo(path[0])
TypeError: 'NoneType' object is not iterable

Appreciate your time!

belangeo commented 6 years ago

Is "sample.aif" is a big file? If not, can you attach it so I can try and see what's going wrong?

vism2889 commented 6 years ago

Github doesn't support .aif for drag and drop, but i have the .aif here .

Thanks for the help with this!

belangeo commented 6 years ago

Something's weird with your soundfile... Here is the output of sox when asking for file info:

olivier@Olivier-x270:~/Downloads$ sox --i sample.aif sox FAIL formats: can't open input file sample.aif': Unsupported AIFC compression typeable'

If sox can't read the sound (audacity can't open it neither), I doubt pyo will do...

How did you produce that file?

vism2889 commented 6 years ago

Hmm, yeah its just a sample from a sample pack, just snagged one at random. Its a completely different file from the .wav i used before. Any chance you'd be able to attach an .aiff file that you know is working for me to try, just to confirm on my end that its the issue?

vism2889 commented 6 years ago
01-read-from-disk.py - Soundfile playback from disk.
SfPlayer and friends read samples from a file on disk with control
over playback speed and looping mode.
Player family:
    - **SfPlayer** : Reads many soundfile formats from disk.
    - **SfMarkerLooper** : AIFF with markers soundfile looper.
    - **SfMarkerShuffler** : AIFF with markers soundfile shuffler.
Reading sound file from disk can save a lot of RAM, especially if
the soundfile is big, but it is more CPU expensive than loading
the sound file in memory in a first pass.

In this file description it mentions that SFplayer reads many file formats. I mentioned in the first comment, I have tried SFPlayer and SFMarker with both .wav and .aif files. Willing to try whatever on my end, just kind of lost as to why its not happy with my code and files at the moment.

belangeo commented 6 years ago

There is a few samples installed with pyo. Try this code, it should work without issue:

from pyo import *

s = Server().boot()
s.start() 
mark = RandInt(5, 1)
sf = SfMarkerLooper(SNDS_PATH+"/transparent.aif", speed=[.999,1], mark=mark, mul=.3).out()

s.gui(locals())
belangeo commented 6 years ago

Yep, SfPlayer can read many file formats. Only SfMarker* objects need an AIFF.

vism2889 commented 6 years ago

Alright so, that runs from the command line without errors. Also tried that with my .wav and it runs. I'm not getting any sound though, or visual indicator of sound from the pyo server window.

belangeo commented 6 years ago

You don't get any sound with your wav file because there is no markers in a wav. Try this:

from pyo import *
s = Server().boot()
s.start()
sf = SfPlayer("sample.wav", speed=[.999, 1], loop=True, mul=.3).out()
s.gui(locals())
vism2889 commented 6 years ago

This still just pops up a pyo server that doesn't output any sound :/

belangeo commented 6 years ago

Let me try your file...

belangeo commented 3 years ago

Closing as i don't think there is an issue here. I'm pretty sure the problem is the format of the file itself or a path problem.