# Midi out problem

**URL:** <https://in-thread.sonic-pi.net/t/midi-out-problem/703>\
**Category:** \[P\] Patreon Support\
**Created:** [February 2, 2018, 3:28pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703 "2018-02-02T15:28:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![sub\_repeat](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sub\_repeat](https://in-thread.sonic-pi.net/u/sub_repeat)\
**Post date:** [February 2, 2018, 3:28pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/1 "2018-02-02T15:28:04Z")

</div>

Hi guys,  
so here is my problem: whenever I try to call any of midi fns (midi / midi\_note\_on) I get this error message:

```
NoMethodError
ThreadDeath!
undefined method 'send_ts' for nil:NilClass

```

What am I doing wrong? I’m running Sonic Pi 3.1.0 on a Mac with a Steinberg UR44 soundcard.  
Thank You!

---

<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:** [February 2, 2018, 5:04pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/2 "2018-02-02T17:04:36Z")

</div>

Hi, sorry you’re having issues. Which version of macOS are you using?

---

<div class="post-metadata">

**Author:** ![sub\_repeat](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sub\_repeat](https://in-thread.sonic-pi.net/u/sub_repeat)\
**Post date:** [February 2, 2018, 7:00pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/3 "2018-02-02T19:00:27Z")

</div>

Hello Sam,  
no worries 🙂  
It’s a 10.12.6, early 2015 MBP 13" retina

---

<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:** [February 2, 2018, 7:09pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/4 "2018-02-02T19:09:22Z")

</div>

Ok, that’s odd - I’ve not seen any errors like this on 10.12 and above.

Would it be possible to paste a copy of the files:

- `~/.sonic-pi/log/gui.log`
- `~/.sonic-pi/log/server-output.log`
- `~/.sonic-pi/log/server-errors.log`

---

<div class="post-metadata">

**Author:** ![sub\_repeat](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sub\_repeat](https://in-thread.sonic-pi.net/u/sub_repeat)\
**Post date:** [February 2, 2018, 7:27pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/5 "2018-02-02T19:27:01Z")

</div>

there you go:

~/.sonic-pi/log/gui.log

```ruby
[GUI] - Detecting port numbers...
[GUI] - GUI OSC listen port 4558
[GUI] - port: 4558 [OK]
[GUI] - Server OSC listen port 4557
[GUI] - port: 4557 [OK]
[GUI] - Server incoming OSC cues port 4559
[GUI] - port: 4559 [OK]
[GUI] - Scsynth port 4556
[GUI] - port: 4556 [OK]
[GUI] - Server OSC out port 4558
[GUI] - GUI OSC out port 4557
[GUI] - Scsynth send port 4556
[GUI] - Erlang router port 4560
[GUI] - port: 4560 [OK]
[GUI] - OSC MIDI out port 4561
[GUI] - port: 4561 [OK]
[GUI] - OSC MIDI in port 4562
[GUI] - port: 4562 [OK]
[GUI] - Init script completed
[GUI] - using default editor colours
[GUI] - starting UDP OSC Server on port 4558...
[GUI] - UDP OSC Server ready and listening
[GUI] - launching Sonic Pi Server:
[GUI] - Ruby server pid registered: 5468
[GUI] - waiting for Sonic Pi Server to boot...
....
[GUI] - Sonic Pi Server successfully booted.
[GUI] - waiting for Sonic Pi Server to respond...
..
[GUI] - Sonic Pi Server connection established
[GUI] - loading workspaces
[GUI] - stopping OSC server
[GUI] - stopping UDP OSC Server...
[GUI] - saving workspaces
[GUI] - UDP OSC Server no longer listening
[GUI] - asking server process to exit...
[GUI] - executing exit script
[GUI] - exiting. Cheerio :-)

```

~/.sonic-pi/log/server-output.log

```ruby
Sonic Pi server booting...
Using protocol: udp
Detecting port numbers...
Send port: 4558
Listen port: 4557
  - OK
Scsynth port: 4556
  - OK
Scsynth send port: 4556
  - OK
OSC cues port: 4559
  - OK
Erlang port: 4560
  - OK
OSC MIDI out port: 4561
  - OK
OSC MIDI in port: 4562
  - OK
Booting server...

Booting Sonic Pi
----------------

Boot - Booting on OS X
Boot - Checkout audio rates on OSX:
Boot - Input audio rate: 44100.0
Boot - Output audio rate: 44100.0
Boot - Sample rates match, we may continue to boot...
Boot - Starting the SuperCollider server...
Boot - /Applications/Sonic Pi.app/app/server/native/scsynth -u 4556 -a 1024 -m 131072 -D 0 -R 0 -l 1 -i 16 -o 16 -U /Applications/Sonic Pi.app/app/server/native/supercollider/plugins/ -b 4096 -B 127.0.0.1
Started [6624] [-] /Applications/Sonic Pi.app/app/server/native/scsynth -u 4556 -a 1024 -m 131072 -D 0 -R 0 -l 1 -i 16 -o 16 -U /Applications/Sonic Pi.app/app/server/native/supercollider/plugins/ -b 4096 -B 127.0.0.1 [-] /var/folders/pb/nmhptfzs2050_f8747gx__vm0000gn/T/sonic-pi-pids/6624
Boot - SuperCollider booted successfully.
Boot - Connecting to the SuperCollider server...
Boot - Sending /status to server: 127.0.0.1:4556
Boot - Receiving ack from scsynth
Boot - Server connection established
Studio - Initialised SuperCollider Audio Server v3.9.0
Studio - Resetting server
Studio - Studio - clearing scsynth
Studio - Studio - allocating audio bus
Studio - Studio - Create Base Synth Groups
Studio - Starting mixer
Studio - Starting scope
"/Applications/Sonic Pi.app/app/server/native/ruby/bin/ruby" "/Applications/Sonic Pi.app/app/server/native/erlang/erl" -noshell -pz "/Applications/Sonic Pi.app/app/server/erlang" -s pi_server start 4560
Started [6626] [-] /Applications/Sonic Pi.app/app/server/native/erlang/dist/bin/beam.smp -- -root /Applications/Sonic Pi.app/app/server/native/erlang/dist -progname erl -- -home /Users/shortCat -- -noshell -pz /Applications/Sonic Pi.app/app/server/erlang -s pi_server start 4560 [-] /var/folders/pb/nmhptfzs2050_f8747gx__vm0000gn/T/sonic-pi-pids/6626
Studio - Spawning o2m with:
    '/Applications/Sonic Pi.app/app/server/native/osmid/o2m' -L -b -i 4561 -O 4562 -m 6
Started [6629] [-] /Applications/Sonic Pi.app/app/server/native/osmid/o2m -L -b -i 4561 -O 4562 -m 6 [-] /var/folders/pb/nmhptfzs2050_f8747gx__vm0000gn/T/sonic-pi-pids/6629
Studio - Spawning m2o with:
    '/Applications/Sonic Pi.app/app/server/native/osmid/m2o' -b -o 4562 -m 6 'Sonic Pi'
Started [6632] [-] /Applications/Sonic Pi.app/app/server/native/osmid/m2o -b -o 4562 -m 6 Sonic Pi [-] /var/folders/pb/nmhptfzs2050_f8747gx__vm0000gn/T/sonic-pi-pids/6632
Studio - Initialised MIDI subsystems
This is Sonic Pi v3.1 running on osx with ruby api 2.5.0.
Sonic Pi Server successfully booted.

```

~/.sonic-pi/log/server-errors.log

```ruby
/Applications/Sonic Pi.app/app/server/ruby/vendor/sys-proctable-1.1.3/lib/darwin/sys/proctable.rb:163: warning: constant ::Fixnum is deprecated
/Applications/Sonic Pi.app/app/server/ruby/vendor/sys-proctable-1.1.3/lib/darwin/sys/proctable.rb:163: warning: constant ::Fixnum is deprecated
/Applications/Sonic Pi.app/app/server/ruby/vendor/sys-proctable-1.1.3/lib/darwin/sys/proctable.rb:163: warning: constant ::Fixnum is deprecated
/Applications/Sonic Pi.app/app/server/ruby/vendor/sys-proctable-1.1.3/lib/darwin/sys/proctable.rb:163: warning: constant ::Fixnum is deprecated

```

---

<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:** [February 2, 2018, 7:37pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/6 "2018-02-02T19:37:10Z")

</div>

Super weird - those logs look absolutely fine to me…

Would it be possible to copy the full stack trace you’re seeing when you just call `midi :e1`

---

<div class="post-metadata">

**Author:** ![sub\_repeat](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sub\_repeat](https://in-thread.sonic-pi.net/u/sub_repeat)\
**Post date:** [February 2, 2018, 7:39pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/7 "2018-02-02T19:39:10Z")

</div>

something like this?

```
/Applications/Sonic Pi.app/app/server/ruby/lib/sonicpi/lang/core.rb:650:in `__osc_send'
/Applications/Sonic Pi.app/app/server/ruby/lib/sonicpi/lang/midi.rb:1523:in `__midi_send_timed'
/Applications/Sonic Pi.app/app/server/ruby/lib/sonicpi/lang/midi.rb:1519:in `__midi_send_timed_pc'
/Applications/Sonic Pi.app/app/server/ruby/lib/sonicpi/lang/midi.rb:1413:in `block (2 levels) in midi'
/Applications/Sonic Pi.app/app/server/ruby/lib/sonicpi/lang/midi.rb:1412:in `each'
/Applications/Sonic Pi.app/app/server/ruby/lib/sonicpi/lang/midi.rb:1412:in `block in midi'
/Applications/Sonic Pi.app/app/server/ruby/lib/sonicpi/lang/midi.rb:1411:in `each'
/Applications/Sonic Pi.app/app/server/ruby/lib/sonicpi/lang/midi.rb:1411:in `midi'
workspace_five:3:in `block (2 levels) in __spider_eval'
/Applications/Sonic Pi.app/app/server/ruby/lib/sonicpi/runtime.rb:1043:in `block (2 levels) in __in_thread'
```

---

<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:** [February 2, 2018, 7:47pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/8 "2018-02-02T19:47:56Z")

</div>

OK, so what I’m struggling to understand is what’s going on with port 4558 on your machine.

The logs above show that port 4558 isn’t ‘OK’, but it also doesn’t appear to report an issue - which is baffling because it really should.

Do you have anything running on port 4558? If you restart your machine does that fix things?

---

<div class="post-metadata">

**Author:** ![sub\_repeat](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sub\_repeat](https://in-thread.sonic-pi.net/u/sub_repeat)\
**Post date:** [February 2, 2018, 7:57pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/9 "2018-02-02T19:57:07Z")

</div>

I’m pretty sure I restarted my machine when the problem occured. I also reinstalled Sonic Pi. Restarted again just a second ago - it didn’t help. Any hints on how I can check if anything is running on a specific port?

---

<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:** [February 2, 2018, 9:39pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/10 "2018-02-02T21:39:23Z")

</div>

Try:

```
sudo lsof -i udp:4558
```

---

<div class="post-metadata">

**Author:** ![sub\_repeat](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sub\_repeat](https://in-thread.sonic-pi.net/u/sub_repeat)\
**Post date:** [February 2, 2018, 11:49pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/11 "2018-02-02T23:49:39Z")

</div>

Doesn’t tell me much ☹  
Sorry to bother you with this:

```ruby
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Sonic\x20 2521 tomek 19u IPv4 0x8f97200e231171eb 0t0 UDP localhost:4558
ruby 2537 tomek 16u IPv4 0x8f97200e2311a16b 0t0 UDP localhost:60877->localhost:4558
ruby 2537 tomek 19u IPv4 0x8f97200e231171eb 0t0 UDP localhost:4558

```

---

<div class="post-metadata">

**Author:** ![Gezo21](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/gezo21/32/320_2.png) [@Gezo21](https://in-thread.sonic-pi.net/u/Gezo21)\
**Post date:** [February 9, 2018, 8:22pm UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/12 "2018-02-09T20:22:56Z")

</div>

Hi, I have to say that I have the same problem, same logs, same issues on MIDI ☹

It didn’t work on Sonic Pi 3.0 either.

macOS 10.12.6, Sonic Pi 3.1

---

<div class="post-metadata">

**Author:** ![bytezen](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bytezen](https://in-thread.sonic-pi.net/u/bytezen)\
**Post date:** [April 6, 2018, 3:44am UTC](https://in-thread.sonic-pi.net/t/midi-out-problem/703/13 "2018-04-06T03:44:34Z")

</div>

I posted something that may help you out (here)[[Work Around for Midi Out problem](http://in-thread.sonic-pi.net/t/work-around-for-midi-out-problem/941)].

TL; DR;  
Paste this code into the buffer that you are evaluating;  
`@osc_server ||= SonicPi::OSC::UDPServer.new(4559, use_decoder_cache: true) # __nosave__ `

Hope this helps
