Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Sonic Pi 3 (midi) #19

Closed
mbutz opened this issue Jul 15, 2017 · 8 comments
Closed

Support for Sonic Pi 3 (midi) #19

mbutz opened this issue Jul 15, 2017 · 8 comments
Assignees
Labels

Comments

@mbutz
Copy link

mbutz commented Jul 15, 2017

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

@mbutz
Copy link
Author

mbutz commented Aug 11, 2017

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?

@mbutz
Copy link
Author

mbutz commented Aug 23, 2017

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 <[email protected]>
;; Version: 0.1
;; BUGS/TODO:
;;
;; * Timetags and binary blobs are not supported yet.

@mbutz
Copy link
Author

mbutz commented Nov 16, 2017

No. As long as I use self-compiled SP 3.0 with regular GUI everything works well.

@mbutz
Copy link
Author

mbutz commented Nov 16, 2017

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

@josephwilk
Copy link
Member

josephwilk commented Nov 17, 2017

@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 josephwilk self-assigned this Nov 17, 2017
@josephwilk josephwilk added the bug label Nov 17, 2017
@repl-electric repl-electric deleted a comment from samaaron Nov 17, 2017
@repl-electric repl-electric deleted a comment from samaaron Nov 17, 2017
@josephwilk
Copy link
Member

^^ @mbutz If still want to use emacs this is a big one to be aware of and something I've resolved but by editing SP. #21

@mbutz
Copy link
Author

mbutz commented Nov 17, 2017

@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.

@mbutz
Copy link
Author

mbutz commented Nov 17, 2017

Great. Works. Thanks!

(I have to use SP 3.0)

@mbutz mbutz closed this as completed Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants