belangeo / pyo

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

(midin.py:3351): Gtk-CRITICAL **: 16:13:34.823: gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed #183

Closed alexrjohnston closed 3 years ago

alexrjohnston commented 4 years ago

Hello! I am looking forward to getting started with pyo but I have come unstuck getting the examples working. I think its any of the examples that load an additional window as well as the server window. I don't get the error if I remove s.gui(locals()) but then the script obviously ends immediately.

a small window looks like it tries to load but doesnt get anywhere.. http://donjohnstonmusic.co.uk/tr/pyoerror.png

I am running pyo 1.0.1 compiled from git hub along with: sudo apt-get install -y libsndfile1-dev sudo apt-get install -y libportmidi-dev sudo apt-get install -y liblo-dev sudo apt install -y portaudio19-dev

Rasberry pi 4 desktop version latest

jackd1 is the server, I get the issue using Thonny on the rpi via VNC viewer (no hdmi monitor attached) and also via Visual Studio code remotely.

The error is as per the title. what can I do? (midin.py:3351): Gtk-CRITICAL **: 16:13:34.823: gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed

when compiling 02-notein-object.py and others in the midi examples folder using this code..

many thanks for any help, pyo looks great!

alexrjohnston commented 4 years ago

I spotted this and commented it out!

notes.keyboard()

now working although it would be nice to have the window if anyone knows a solution.

belangeo commented 4 years ago

Do you get the same behaviour if you add sigL.ctrl() right after RCOsc object instantiations?

sigL = RCOsc(freq=freqs, sharp=0.5, mul=amps)
sigR = RCOsc(freq=freqs*1.003, sharp=0.5, mul=amps)
sigL.ctrl()
alexrjohnston commented 4 years ago

Thanks for the reply! Since posting the question I have found your advice on the google forum about using -i so the gui is not needed. I just tried to boot to my desktop via VNC to test the code you kindly provided but I cant get the gui to work at all. it might be due to the SPI screen I have running. Either way commenting out "s.gui(locals())" and using -i to keep the script alive is working a treat! The pyo library is fantastic I haven't even scratched the surface yet and I am really enjoying using it so thank you : )

Is there an argument I can use to prevent SfPlayer from throwing the error below if there is not an audio file with the chosen name in the chosen directory?

I am using multiple SfPlayers to load separate stems for a track but for example not all tracks have a riser stem. in this case it would be nice to be able to continue with out an error for the SfPlayer that is expecting to load a Riser.wav in that tracks directory.

Traceback (most recent call last): File "bdjl2.py", line 296, in <module> RiserPLAYER = SfPlayer(Rtrack, speed=[0], loop=False, mul=0.5).out(10) File "/usr/local/lib/python3.7/dist-packages/pyo-1.0.1-py3.7-linux-armv7l.egg/pyo/lib/players.py", line 112, in __init__ _snd_size, _dur, _snd_sr, _snd_chnls, _format, _type = sndinfo(path[0]) TypeError: cannot unpack non-iterable NoneType object

Thanks again!

alexrjohnston commented 4 years ago

Ive just noticed that if an Sfplayer is initialised with a valid wav file eg:

RiserPLAYER = SfPlayer(Rtrack, speed=[0], loop=False, mul=0.5).out(10)

then it wont show an error if you try and load a file that doesn't exist into it.

What is the best way to stop a Sfplayer? I had a look in the docs: http://ajaxsoundstudio.com/pyodoc/api/classes/players.html?highlight=sfplayer and it doesn't look like there is a way to call the player to stop. apologies if i am being daft

I am currently doing it by putting the speed to 0 but this means it carries on playing the wrong wav if you try and load/play a file that doesn't exist on the drive

alexrjohnston commented 4 years ago

Fixed the issue by just putting a short blank wav file in place of the risers for the tracks without risers! all working well.. time for a console based GUI : )

belangeo commented 3 years ago

Just to wrap up this discussion...

1) You can check if your soundfile exists with sndinfo, and then decide what to do:

if sndinfo(your_file) is not None: sf = SfPlayer(your_file) else: sf = SfPlayer(use_your_placeholder_soundfile)

2) You can call stop() on a SfPlayer object, it derives from the PyoObject, where all common functionalities are defined:

http://ajaxsoundstudio.com/pyodoc/api/classes/_core.html#pyoobject