# Live-Looper with touchOSC control

**URL:** <https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363>\
**Category:** \[P\] Patreon Support\
**Created:** [October 31, 2017, 4:37pm UTC](https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363 "2017-10-31T16:37:10Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [November 1, 2017, 7:18pm UTC](https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363/21 "2017-11-01T19:18:02Z")

</div>

@robin.newman, thanks a lot for you patience and help!

Yes, I do get the errors after sending osc messages from Sonic Pi:

Sonic Pi code:

```ruby
use_osc "192.168.2.120", 9000
live_loop :test do
  osc "/rec/track1_play",1
  osc "/rec/track2_vol",0.5
  sleep 2
  osc "/rec/track1_play",0
  osc "/rec/track2_vol",0
  sleep 2
end

```

Sonic Pi-protocol:

```ruby
=> Starting run 1
=> Defining fn :live_loop_test
{run: 1, time: 0.0}
 ├─ OSC -> 192.168.2.120, 9000, /rec/track1_play, [1]
 └─ OSC -> 192.168.2.120, 9000, /rec/track2_vol, [0.5]
{run: 1, time: 2.0}
 ├─ OSC -> 192.168.2.120, 9000, /rec/track1_play, [0]
 └─ OSC -> 192.168.2.120, 9000, /rec/track2_vol, [0]
=> Stopping all runs...
=> Stopping run 1
=> Completed run 1
=> All runs completed
=> Pausing SuperCollider Audio Server

```

Errors in `erlang.log`:

```ruby
+--------------------------------+
+ This is the Sonic Pi IO Server +
+ Powered by Erlang +
+ Listening on port 4560 +
+--------------------------------+

=ERROR REPORT==== 1-Nov-2017::20:13:45 ===
Error in process <0.33.0> with exit value:
{badarg,[{erlang,system_time,[nanosecond],[]},
         {osc,now,0,[{file,"osc.erl"},{line,54}]},
         {pi_server,send_later,7,[{file,"pi_server.erl"},{line,177}]}]}

=ERROR REPORT==== 1-Nov-2017::20:13:45 ===
Error in process <0.34.0> with exit value:
{badarg,[{erlang,system_time,[nanosecond],[]},
         {osc,now,0,[{file,"osc.erl"},{line,54}]},
         {pi_server,send_later,7,[{file,"pi_server.erl"},{line,177}]}]}

=ERROR REPORT==== 1-Nov-2017::20:13:47 ===
Error in process <0.35.0> with exit value:
{badarg,[{erlang,system_time,[nanosecond],[]},
         {osc,now,0,[{file,"osc.erl"},{line,54}]},
         {pi_server,send_later,7,[{file,"pi_server.erl"},{line,177}]}]}

=ERROR REPORT==== 1-Nov-2017::20:13:47 ===
Error in process <0.36.0> with exit value:
{badarg,[{erlang,system_time,[nanosecond],[]},
         {osc,now,0,[{file,"osc.erl"},{line,54}]},
         {pi_server,send_later,7,[{file,"pi_server.erl"},{line,177}]}]}

```

---

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [November 1, 2017, 7:42pm UTC](https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363/22 "2017-11-01T19:42:14Z")

</div>

ON final possibility. At one time the fast\_osc binary was giving problems, and I reverted to disabling that by changing a line.  
I see from my server errors log that I still hve it disabled

```ruby
Overriding fast_osc c-extension FastOsc::decode_single_message, falling back to pure Ruby version

```

I can’t remember where I disabled it, and have to go now, but will check and let you know later.

---

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [November 1, 2017, 7:46pm UTC](https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363/23 "2017-11-01T19:46:47Z")

</div>

Found the change  
in the vendor fast\_osc folder open fast\_osc.rb  
Then change line 38 to  
`if true #ENV['FAST_OSC_USE_FALLBACK'] == "true"`  
This forces it to ignore using fastosc  
sp still works OK

---

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [November 1, 2017, 8:42pm UTC](https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363/24 "2017-11-01T20:42:08Z")

</div>

Yes, no more erlang errors. But does not affect the initial problem: No osc messages from Sonic Pi.

---

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [November 1, 2017, 9:58pm UTC](https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363/25 "2017-11-01T21:58:25Z")

</div>

Another simple test to try;  
can you send osc messages to yourself using

```ruby
use_osc "localhost",4559

live_loop :tx do
  use_real_time
  osc "/test"
  sleep 1
end

live_loop :rx do
  use_real_time
  sync "/osc/test"
  puts "received"
end

```

Also if you have access to another Sonic Pi machine (perhaps a raspberry pi?) can you send messages to and from that?

---

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [November 2, 2017, 1:22pm UTC](https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363/26 "2017-11-02T13:22:28Z")

</div>

Did check with Mac (SP 3.0) and Linux (SP 3.0 and 3.0.1). Turns out, that I can both receive and send osc messages when using SP 3.0; now also working with touchOSC. My checkout of SP 3.0.1 does receive but not send osc messages.

Many thanks to you @robin.newman. Especially the last tip lead me to this - preliminary - solution.

Should I create an issue about that on Github, or are these kind of transient issues not worthwhile to mention?

---

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [November 2, 2017, 6:00pm UTC](https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363/27 "2017-11-02T18:00:52Z")

</div>

I assume your 3.0.1 (maybe post 3.01?) build is on Linux, in which case I don’t think it helps to put it on github just now.  
I reverted to fast\_osc on my Mac and it worked fine there without giving erlang errors. I think the problem initially rose on RPi, and I’ll need to check if it is disabled there or not. There were worse crashing errors during development of SP3 related to this.  
Glad it is working for you on 3.0 on LInux.  
As I said earlier, the problems I’ve had are with commits AFTER 3.0.1 release as detailed previously, and I think I told Sam about them.

[Previous page](https://in-thread.sonic-pi.net/t/live-looper-with-touchosc-control/363.md?page=1)
