Midi out problem

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!

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

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

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

there you go:

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

[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

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

/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

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

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'

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?

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?

Try:

sudo lsof -i udp:4558

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

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

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

It didn’t work on Sonic Pi 3.0 either.

macOS 10.12.6, Sonic Pi 3.1

I posted something that may help you out (here)[Work Around for Midi Out problem].

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