python-sonic
python-sonic copied to clipboard
Support Sonic-Pi v4+
The current version of python-sonic only support sonic-pi v3 as changes have been made to sonic-pi's treatment of non-cue OSC messages. This PR seeks to update python-sonic to support these new changes for v4+. This address #42 .
See this issue: https://github.com/sonic-pi-net/sonic-pi/issues/3330 for further details.
In short, Sonic-Pi now randomises the GUI udp port and requires a Token to be sent with any non-cue OSC message like /run-code
. Therefore this PR makes the following changes:
- Updates
synth_server.py
with a new token field.set_parameter
now also takes a token as the second argument.send_command
now inserts the token before a command instead of the oldGUI_ID
parameter. - Updates
psonic.py
with a new functionset_server_parameter_from_log
which by default parses the file~/.sonic-pi/log/spider.log
, or allows the user to submit thespider.log
file. The function parses the spider.log for the token, the server port and osc cues port and sets those as the server parameter. - Adds a very simply example
psonic_example.py
for testing. - Updates the README.md to reflect the above changes.
This has been tested on windows and linux.
Let me know if you want any other updates.