Sonic-pi: What's wrong with my Code?

Created on 29 Jan 2021  路  9Comments  路  Source: sonic-pi-net/sonic-pi

canon3.txt
can't play it , on sonic-pi v3.2.2

#appinfo.ini
[Format]
Type=PortableAppsFormat
Version=3.0

[Details]
Name=Sonic Pi Portable
AppId=Sonic Pi Portable
Publisher=SonicPi
Homepage=sonic-pi.net
Category=Utilities
Description=AppName Portable is a tool that does something.
Language=Multilingual
Trademarks=
InstallType=

[License]
Shareable=true
OpenSource=true
Freeware=true
CommercialUse=true

[Version]
PackageVersion=3.2.2.0
DisplayVersion=3.2.2

[SpecialPaths]
Plugins=NONE

[Dependencies]
UsesJava=false
UsesDotNetVersion=

[Control]
Icons=1
Start=Sonic Pi Portable.exe

Most helpful comment

I actually tried it on SP 3.3 running on Ubuntu on a Pi4 and on my Mac on 3.3 I'm pretty sure it would work on 3.2.2 as well. Will try and dig one out. As regards using 3.3 on a Pi you do need to upgrade to the new OS as it is designed to work with the pulse audio which is the norm now.

All 9 comments

when i wrote to part_10,it's ok;
when part_11 added,can't play

@lenkasetGitHub - this may well be a bug in Sonic Pi's own code, not your music code.

@samaaron - I half suspected this was related to the buffer code limit, but it does not generate the error message in the GUI that was added to warn about that.
I do notice when testing this locally, that we end up with the following error in the logs:

OSC handler exception for address: 
undefined method `%' for nil:NilClass
["C:/Users/Ethan/repos/sonic-pi/app/server/ruby/lib/sonicpi/osc/oscdecode.rb:98:in `block in decode_single_message'"

Which corresponds to the following line:
https://github.com/sonic-pi-net/sonic-pi/blob/main/app/server/ruby/lib/sonicpi/osc/oscdecode.rb#L98
(Unless you immediately know what's going on here though, it'd probably need a bit more investigation...)

(@lenkasetGitHub - it could still be related to the issue of Sonic Pi buffers currently having a certain limit on the amount of code that works in them; your code still works for example if you define some of the 'parts' in a separate buffer, and then call them from the main script).

Thanks!
I'll try~ @ethancrawford

Hi, do you still get the same error in v3.3 ?

yes,same error.
must i upgrade my Raspberry Pi OS to 2021-01-11?

I think there are two problems. First you need to move the live_loop :mail to the end. It wont know about what part_0..part_11 are if it is run before they are defined. Secondly the code is too long for a SP buffer. Not sure why the size error doesn't trigger. However it works if you use run_file "path/to/canon3.txt"
Sounds very nice!

I actually tried it on SP 3.3 running on Ubuntu on a Pi4 and on my Mac on 3.3 I'm pretty sure it would work on 3.2.2 as well. Will try and dig one out. As regards using 3.3 on a Pi you do need to upgrade to the new OS as it is designed to work with the pulse audio which is the norm now.

i upgrade my raspberry to 2021-01-11-raspios-buster-armhf and sonicpi to sonic-pi_3.3_1_armhf : same error

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reiner-dolp picture reiner-dolp  路  6Comments

MegumiSoft picture MegumiSoft  路  7Comments

ostephagus picture ostephagus  路  4Comments

AlexandreRangel picture AlexandreRangel  路  7Comments

datramt picture datramt  路  5Comments