python-sonic icon indicating copy to clipboard operation
python-sonic copied to clipboard

Support Sonic-Pi v4+

Open mhl787156 opened this issue 1 year ago • 0 comments

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:

  1. 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 old GUI_ID parameter.
  2. Updates psonic.py with a new function set_server_parameter_from_log which by default parses the file ~/.sonic-pi/log/spider.log, or allows the user to submit the spider.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.
  3. Adds a very simply example psonic_example.py for testing.
  4. 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.

mhl787156 avatar Oct 01 '23 14:10 mhl787156