Support for Sonic Pi 3 (midi)
mbutz opened this issue · 8 comments
Hi Joseph,
I am still a true fan of sonic-pi.el
. It's very nice (and productive) to use emacs with all the features I am used to, to work with Sonic Pi. I now managed to get SP3 with midi-support running on Linux. Wonderful.
But ... there seems to be a basic problem now with sonic-pi.el
. I do very much hope you are willing to have a look at it (but could definitely understand, if not).
If I play the following code:
live_loop :md do
midi (scale :c2, :minor_pentatonic, num_octaves: 3).choose
sleep 0.125
end
I get this error message:
π> Error: [buffer test.rb, line 4] - NoMethodError
Thread death +--> :live_loop_md
undefined method `send_ts'; for nil:NilClass
Did you mean? send
I do assume that sonic-pi.el
can't translate the (or some) midi-related commands. Can that be the case? The same code runs perfectly using the Sonic Pi-Gui.
Martin
I would be a bit disappointed, if I could not use Emacs
anymore for Sonic Pi
-coding. But - on the other hand - I can totally understand, if you just don't want to support this anymore. Any news about making or leaving further adjustments to sonic-pi.el
?
Just a guess:
Can this have something to do with osc.el
not supporting what's necessary for Emacs to communicate via OSC?
;;; osc.el --- Open Sound Control protocol library
;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@delysid.org>
;; Version: 0.1
;; BUGS/TODO:
;;
;; * Timetags and binary blobs are not supported yet.
No. As long as I use self-compiled SP 3.0 with regular GUI everything works well.
Does not change anything:
π> (Starting run 1)
π> (Defining fn :live_loop_md)
π> Error: [buffer test.rb, line 4] - NoMethodError
Thread death +--> :live_loop_md
undefined method `send_ts'; for nil:NilClass
Did you mean? send
Code:
use_midi_defaults channel: '*'
live_loop :md do
midi (scale :c2, :minor_pentatonic, num_octaves: 3).choose
sleep 0.125
end
@mbutz Sorry catching up here, sometimes my head gets too deep in the music I forget to come back up to code.
The good news (if you have survived my inability to notice github notifications) I exclusively use SP server with emacs and have done for most of this year. I use a shed ton of midi also. I've got it running against the latest versions of SP while having all the nice features of the GUI + and emacs being a proper text editor ;)
Yes I've seen this error before, I'm guessing this quick fix will hopefully get you moving while I work out a nicer resolve outside of SonicPis Ruby Server:
Add this line at the header of your File you are evaling.
@osc_server ||= SonicPi::OSC::UDPServer.new(4559, use_decoder_cache: true) #__nosave__
I currently concat this to the head of each file automatically by changing the SP Ruby Server (adding code to the example in this line https://github.com/samaaron/sonic-pi/blob/master/app/server/ruby/bin/sonic-pi-server.rb#L212).
code = args[2].force_encoding("utf-8")
code = "@osc_server ||= SonicPi::OSC::UDPServer.new(4559, use_decoder_cache: true) #__nosave__" + code
Let me know if that helps.
@josephwilk First of all thanks for the feedback! I am glad you are still using (and supporting) sonic-pi.el
.
Tried your fix and seems to work. Seems means that I don't get this error anymore but can't hear anything with my usual midi setup. I'll look into it and I suppose that this is a different thing having rather to do with my Jack connections then with Sonic Pi or Emacs.
Great. Works. Thanks!
(I have to use SP 3.0)