# OSC Received but no sound

**URL:** <https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117>\
**Category:** \[P\] Patreon Support\
**Created:** [June 25, 2020, 4:24am UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117 "2020-06-25T04:24:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![carltesta](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/carltesta/32/1512_2.png) [@carltesta](https://in-thread.sonic-pi.net/u/carltesta)\
**Post date:** [June 25, 2020, 4:24am UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/1 "2020-06-25T04:24:28Z")

</div>

I’ve been experimenting tonight with Troop and Extramuros and Sonic-Pi-Tool in an attempt to get networked coding working. I’ve been able to get Sonic-Pi to receive the OSC messages from all three tools, but I’ve been unable to get Sonic-Pi to produce sound. I see the messages come into the Cues window but no sound occurs? Any ideas what I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [June 25, 2020, 4:33am UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/2 "2020-06-25T04:33:02Z")

</div>

Hi @carltesta - some more details about your setup would be very helpful. What version of Sonic Pi are you using? what operating system? any suspicious looking log messages in the `log` folder inside `.sonic-pi` in your home directory?, etc 👍

---

<div class="post-metadata">

**Author:** ![carltesta](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/carltesta/32/1512_2.png) [@carltesta](https://in-thread.sonic-pi.net/u/carltesta)\
**Post date:** [June 25, 2020, 4:39am UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/3 "2020-06-25T04:39:47Z")

</div>

Thanks for offering to help. I’m using Sonic Pi 3.2.2 on MacOS Mojave 10.14.6. I’ve got Troop up and running and when I evaluate some code in Troop I get the following message in the Cues window in Sonic Pi but no sound:

```ruby
/osc:127.0.0.1:56912/run-code ["0", "live_loop :one do\nplay 80\nsleep 1\nend"]

```

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [June 25, 2020, 7:01am UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/4 "2020-06-25T07:01:48Z")

</div>

please post the code you use.  
Thanks

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [June 25, 2020, 7:43am UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/5 "2020-06-25T07:43:49Z")

</div>

> [@carltesta](#):
>
> Troop and Extramuros

by the way, what are these tools ? Software ?

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [June 25, 2020, 7:54am UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/6 "2020-06-25T07:54:56Z")

</div>

They are both software tools for networked collaborative live coding.

> **[Qirky/Troop](https://github.com/Qirky/Troop)**
>
> Real-time Live Coding collaboration app. Contribute to Qirky/Troop development by creating an account on GitHub.

  

> **[dktr0/extramuros](https://github.com/dktr0/extramuros)**
>
> language-neutral shared-buffer networked live coding system - dktr0/extramuros

---

<div class="post-metadata">

**Author:** ![emlyn](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/emlyn/32/1460_2.png) [@emlyn](https://in-thread.sonic-pi.net/u/emlyn)\
**Post date:** [June 25, 2020, 8:21am UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/7 "2020-06-25T08:21:14Z")

</div>

Are you expecting Sonic Pi to execute the code in the OSC message? It looks to me look you’re sending it to the wrong port.

Sonic Pi listens for OSC on two different ports, the OSC port that appears in the cue log - these don’t do anything on their own, you need code running in Sonic Pi to handle them - and the command port that is used internally by Sonic Pi for sending commands from the GUI to the server component.

I think you want to be sending to the command port - you can see what port that is by looking in .sonic-pi/logs/server-output.log once Sonic Pi is started.

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [June 25, 2020, 10:38am UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/8 "2020-06-25T10:38:33Z")

</div>

> [@carltesta](#):
>
> Thanks for offering to help. I’m using Sonic Pi 3.2.2 on MacOS Mojave 10.14.6. I’ve got Troop up and running and when I evaluate some code in Troop I get the following message in the Cues window in Sonic Pi but no sound:
> 
> ```ruby
> /osc:127.0.0.1:56912/run-code ["0", "live_loop :one do\nplay 80\nsleep 1\nend"]
> 
> ```

Hi @carltesta - by default Sonic Pi does _not_ do anything within incoming OSC messages other than printing them to the screen and storing them in the event system.

**Sonic Pi does not officially support receiving code via OSC - incoming OSC events are for data not code**

It’s true that the GUI talks to the internal server in this way which can currently be hijacked by other GUI apps (such as VSCode or Emacs etc.) - but it’s an internal undocumented API and may change without notice or warning. If you do want to play with this API, you can see which port Sonic Pi is listening to the code API in the logs during boot up. This port is selected randomly during boot. It’s possible this will change and/or disappear in future versions as we tighten up security and restrict what code people can inject into the system.

I have already started to work on a restricted language subset which will be much safer to transmit over the wire rather than arbitrary Ruby code. The eventual plan is for all code to be remotely executed be encoded in this new language format. This will open up a whole set of new opportunities for multiple instances of Sonic Pi and external apps to start collaborating with greater expressivity 🙂

---

<div class="post-metadata">

**Author:** ![carltesta](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/carltesta/32/1512_2.png) [@carltesta](https://in-thread.sonic-pi.net/u/carltesta)\
**Post date:** [June 25, 2020, 12:51pm UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/9 "2020-06-25T12:51:21Z")

</div>

@samaaron Thanks for the clarification. When using Troop with SuperCollider a Troop instance in SuperCollider is required via the [TroopQuark](https://github.com/Qirky/TroopQuark) which basically just registers an OSCFunc to evaluate the code included in the OSC message. Would it be possible to simply create some kind of responder on the Sonic-Pi end to evaluate these OSC messages which would be slightly more secure since you need to start something running?

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [June 25, 2020, 9:29pm UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/10 "2020-06-25T21:29:09Z")

</div>

It might be a compromise to make it easy to specify a specific API listening port on boot via a config file.

In general I want to hold back on remote code execution until I have this new network-ready language in place.

---

<div class="post-metadata">

**Author:** ![carltesta](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/carltesta/32/1512_2.png) [@carltesta](https://in-thread.sonic-pi.net/u/carltesta)\
**Post date:** [June 25, 2020, 11:11pm UTC](https://in-thread.sonic-pi.net/t/osc-received-but-no-sound/4117/11 "2020-06-25T23:11:42Z")

</div>

I’d definitely be interested in working something out via a config file. I’m trying to work on some remote learning for students and I’m excited about the possibility of getting this working with Sonic Pi.
