Sonic Pi, Helm Synth and Touch OSC project

I have just been working on a project to bring together Sonic Pi and Matt Tytel’s great Helm Synth utilising a TouchOSC screen running on a separate tablet to control synth selection on Helm and Sonic Pi features as well. You can see a video of the project, and an article describing the software and containing download links.

(clearest if you view it directly on YOuTube)

1 Like

hi @robin.newman

thanks again for this article : we all learn from yours works.

Thanks for your very well.

I think the files are referenced in the article.
here is the gist link
There are details about downloading installing the TouchOSC template there.
Come back to me if you have problems.

I receive nothing in my iPad : use_osc “”,9000 #address and port of TouchOSC device
Port outgoing : 8000 Port incoming 9000
In the templet : I do Sync and receive iMac
In the program :
dirbase=(ENV[‘HOME’]+"/Library/Audio/Presets/Helm/Factory Presets/") #path to helm presets (Mac) Ok
Configuration : Midi configuration : “sonicpi_connect” OK : use_midi_defaults port: “sonicpi_connect”,channel: 1 #midi port and channel
Keyboard : work well in Helm
TouchOSC : Templet : helmSelector.touchosc ok
SonicPi : I execute the program but in my iPad nothing appear (names of the Synth.
SonicPi and Helm doesn’t communicate. Tests : Vol or Bpm
Helm : Learn MIDI assignment doesn’t work !

Thank for your help!

In the TouchOSC app on your ipad you need to set the outgoing port to 4560, not 9000 so that SP can receive OSC messages from TouchOSC. The incoming port 9000 is fine as that matches the port in the SonicPi program which is set to send to port 9000. Also make sure that the host IP address in TouchOSC is set to the ip address of your iMac, and that the IP address in line 11 of the Sonic Pi program currently
use_osc "",9000 #address and port of TouchOSC device
is adjusted to send to the actual ip address of your iPad/TouchOSC. You can see this in the TouchOSC connections section listed as local IP address.
Once the addresses and ports are OK you should see incoming cues in the SP cue log when you move sliders on TouchOSC.

Finally, if you want Helm to playback via Sonic Pi rather than direct to your imac speaker, you need to have a loopback device (eg Blackhole, VB cable or loopBack) installed and set as your default input BEFORE booting the Sonic Pi Program. Then set your Helm output audio to go to the loopback device. The live_audio setting in Sonic Pi (line 96 in the SP program) will then feed the audio Sonic Pi from the default input (the loopback device), and SP can then adjust the volume.

There is a volume slider in Helm, but this setup is not using it directly.

It is possible however to control this from TouchOSC if you want. If you don’t want to feed the audio back through Sonic Pi, You can get SP to resend the incoming OSC from the volume slider in TouchOSC on a midi control channel to Helm and get Helm to learn that control number. I’ve tried it and it works.

Thanks for your answer, the communication works between my iPad and helm.

  1. I don’t receive in my iPad the names of patches from : dirbase=(ENV[‘HOME’]+"/Library/Audio/Presets/Helm/Factory Presets/")
    BUT Helm receives commande. It’s Ok
  2. the leds doesn"t works
  3. in my iPad the Toushosc templet volume and volume scale doesn’t works
    but Sonicpi receives informations and works well.
  4. How is possible to change the pattern? between Lines 174 - 177 for exemple?
  5. The keyboard works very well.
    Thanks for your help. Moty

@Moty - can you elaborate about what you mean by ‘change the pattern?’

The patterns are only intended as demonstrations. I often don’t use them at all but just use a keyboard to send input to Helm and use SP simply to run the TouchOSC interface to that the Helm Synth can be selected from the list displayed on the iPad screen. If you are not seeng this list then there is a problem in Sonic Pi sending OSC messages back to the TouchOSC app on your ipad.
This is a matter of configuring the addresses and ports correctly.
Here are some pictures of my currently working setup (different from the article values).
First the TouchOSC template loaded onto my iPad

Press the white circle top right and you get similar to the picture below

OSC: is the IP address to which OSC messages will be sent from the iPad. that is the ip address of my iMac. Notice also the name of the selected template which I called helmsSelector. Now press the right pointing arrow head on this line, and you get the picture below:

The enable switch for osc should be ON (green)
The Host entry should be set to the ip of your iMac (in my case adjust it to suit your iMac address)
Port (outgoing) should be set to 4560 the port that Sonic Pi listens to.
Port incoming should be set to 9000
make a note of the local IP address. Here is it This is the address of your iPad which will probably be differnt.

Both the iPad and the iMac must be connected to the same local network. For best results the iMac should be wired to the network and the ipad connected by wireless, although it will work if both are wirelessly connected.

Now look at line 11 in the Sonic Pi program running on your iMac. In the download it reads:
use_osc "",9000 #address and port of TouchOSC device
In the sample I am describing here the ip of the TouchOSC iPad is different so it needs to be changed in my case to
use_osc "",9000 #address and port of TouchOSC device

Now the sending and receiving addresses and ports should match up and when you run the Sonic Pi program on your iMac program it should populate the TouchOSC screen with the names of the helm synths for the Arp (arpeggio) section, as below:

This shows that the TouchOSC app is receiving data from Sonic Pi.
If you now move the volume slider you should see cues being received in the Sonic Pi cues log, showing OSC data travelling in the opposite direction.

You asked two further points.
First adjusting the patterns played.
You should understand that the patterns are just a means of listening to the selected synth rto see what it sounds like. There are basically 2 note patterns which are both based on a minor pentatonic scale. The first plays the notes in sequence, the second chooses them at random, They are set in lines 211 and 212 of the program. You can put any sequence of notes you like instead of these two scale patterns. The first sequence is chosen by patterns 1 ,3 and 5, the second by patterns 2 and 4. The other thing altered by the patterns is the pitch. Some are low some high. This is so that you can choose one suitable for each synth. Some work better with low notes, some high ones.

The idea is that having selected your synth, you actually play it using a keyboard, or if you like you could substitute a longer tune for one of the patterns.

Secondly the program is meant to be used with the helm audio looped back into sonic pi and its output is then combined with any sounds that might be added by sonic pi, and its volume can be controlled. If you don’t want to loopback the sound the program can be modified to directly alter the helm volume control. to do this you can amend line 70 in the program
this reads:
set :vol,b[0]
you can add an extra statement after a ; to give
set :vol,b[0];midi_cc 40,(b[0]*127).to_i #added optional midi_cc on ch 40 to control helm vol slider
This sends a micdi control signal on channel 40 to helm. If you learn the value whilst adjusting the TouchOSC volume slider then it can control the helm volume directly. Of course you can use another midi_cc than 40 if you wish.
Note if you do this, then the volume scale buttons will have no effect.

Well quite a large post, but I hope it helps you.

Thanks very much Robin, I do exactly your configuration and on my iPad the list of patches are OK, (Arp, led and list) but sometime the list works sometime doesn’t works, the buttons doesn’t react and don’t have a communication (between iPad and iMac to Helm).
I’am sorry because your tutorial is very very well.

Dear Hubert
I wonder if you have ticked the box on the Sonic Pi IO Preferences panel which says allows OSC from other computers? This is necessary for SP to receive incoming OSC messages from TouchOSC. See image below, where the cursor arrow is.

Other than that, I find sometimes it misses a button push on TouchOSC as ther is a lot going on, but usually it will respond if you try again.

Thanks, Yes my config is OK, all lists are OK, all things appears in my iPad and works well in SonicPi program, but Helm doesn’t receives anything :frowning: patterns doesn’t works but the config is OK "iac_driver_sonicpi " and the midiconfig to. Thanks

but Helm doesn’t receives anything :frowning: patterns doesn’t works

Hmm. The only thing Helm should receive from Sonic Pi is/are midi signals. You need to have a virtual midi port set up using Audio MIDI Setup. I have the IAC Driver port set up which I have called IAC Driver sonicpi (In sonic PI it appears as the lower case string “iac_driver_sonicpi” which you will see in line 13 of the Sonic Pi program. You need to select this port in Helm too, in the Section Active MIDI ports: Then Helm should receive midi signals from Sonic Pi.

Here is a simple test program to play a repeating scale with the currently selected synth on Helm
It assumes the virtual midi driver iac_driver_sonicpi has been set up using the MIDI Studio page in Audio MIDI Setup

#helm test
use_midi_defaults port: "iac_driver_sonicpi",channel: 1

live_loop :miditest do
  midi scale(:c4,:major).tick,sustain: 0.2
  sleep 0.2

Note if when you stop it Helm continues to play a note you can send the command
midi_all_notes_off to stop it

Hello Robin,
OK, all things works correctly !!!
I’am very Happy and enjoy to play with. Moty

Great! Glad you’ve got it going. The configuration of the project is quite involved.