Closed Zylvian closed 5 years ago
Yes, this happens when a lot of plays are sent to Sonic Pi in a small time. Note that this can also happen even with sleep.
I temporarily fixed this with restarting Sonic Pi, but after some time, this happened again.
@gkvoelkl Do you know how to fix this? It is annoying and probably an important bug.
Python-Sonic is a very direct Interface for Sonic Pi. It sends a message to Sonic Pi and Sonic Pi makes the sound. All the timing is made by the Python application. Perhaps you can post your example.
@gkvoelkl I will post example and more details later today.
@gkvoelkl I tested this few more times and sometimes there is a bug and sometimes not.
Here is my example code:
while True:
sample(AMBI_LUNAR_LAND, amp=0.5)
First, it will work. But then, the error will appear in Sonic Pi.
Here is the error:
Runtime Error: [eval] - ThreadError
can't create Thread: Not enough space
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:934:in `initialize'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:934:in `new'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:934:in `block in __in_thread'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/util.rb:583:in `block in __no_kill_block'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/util.rb:581:in `synchronize'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/util.rb:581:in `__no_kill_block'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:931:in `__in_thread'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:4240:in `in_thread'
eval:in `block in __spider_eval'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:780:in `eval'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:780:in `block in __spider_eval'```
And another error:
Runtime Error: [eval] - NoMemoryError
failed to allocate memory
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:934:in `new'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:934:in `block in __in_thread'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/util.rb:583:in `block in __no_kill_block'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/util.rb:581:in `synchronize'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/util.rb:581:in `__no_kill_block'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:931:in `__in_thread'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:4240:in `in_thread'
eval:in `block in __spider_eval'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:780:in `eval'
D:/Users/filips/Downloads/SonicPiPortable/App/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:780:in `block in __spider_eval'
After that, the sound will disappear and there will be this in the log:
=> Starting run 10687
=> Aborted Run 10687
So this is probably problem with Sonic Pi.
I started the sample program on my computer.
It called about 25.000 times Sonic Pi in one second. That's too much.
You have to use sleep for time management.
I know this. But sometimes (I currently don't have this problem), this happened a lot earlier and also with (small) sleeps. But this is probably a problem with Sonic Pi.
It can happen, when python-Sonic sends too many messages to Sonic Pi. And that depends on the performance of the computer. Thanks.
So I did
`def live_5():
And I did the rest of the example, where I put it in a thread and played it. But I forgot the sleep(0.125) in live_5(). The program made some weird noises, and now, after reloading the kernel, no sounds are produced.
https://i.gyazo.com/b1f6608f1a9920d2a33231acabab180c.png
Any clue?