Page 1 of 4

how to send Midi Message

Posted: Sat Mar 19, 2016 9:26 pm
by Walter Sommerfeld
Hi FS users,

i need some help - again...

dunno how i get this Midi Message send in my attached schematic - please have a look!

Keep on Doing!
Walter

P.S.: I left a little gimmick as a thank U => did u found it :)

Re: how to send Midi Message

Posted: Sat Mar 19, 2016 10:27 pm
by tulamide
There is no midi message. The string @message is just a visualization of an address in RAM, where a midi object once was created by Ruby.

Re: how to send Midi Message

Posted: Sat Mar 19, 2016 10:38 pm
by billv
Not sure if it helps you Walter...
But I got a result in the Midi Analizer by adding "Midi.new"....
SysEx F0..F7 11 bytes

Code: Select all

def init
   @message = []
end

def event i,v,t
   if i==0
      @message = Midi.new "#<Midi:0x1b21526c>"
      output 0,@message,t #ime
   end
end

Re: how to send Midi Message

Posted: Sun Mar 20, 2016 2:10 pm
by Walter Sommerfeld
@tulamide: I thought so.

@billv: nice idea but - see tulamide's answer...
btw: How are u dude?! Newest project of yours?

Is there a way in FS to record and save/reload Midi sequences?

P.S.: I also need CC's and timing recorded 2 (not only notes)

Re: how to send Midi Message

Posted: Sun Mar 20, 2016 2:36 pm
by tulamide
Walter Sommerfeld wrote:Is there a way in FS to record and save/reload Midi sequences?

P.S.: I also need CC's and timing recorded 2 (not only notes)


Yes, there is. The critical part is the timing. If you are recording premade sequences from the DAW, then you can use the ppq info for the timing. If not, you can only use Ruby's timing, which is reliable down to 10ms.

The basics of a recording are simple. Everything in Ruby is an object, so you can just add the incoming midi object, together with the timing info, to an array. For saving/loading you can use Ruby's marshalling.

I don't have the time to make a demo, but you can find an example of marshalling in my ACM (advanced color manager), where it is used to save the user defined color palettes. Only difference is that you wouldn't save/load on schematic saving/loading, but through some trigger (probably an open/save-dialog).

Re: how to send Midi Message

Posted: Sun Mar 20, 2016 2:46 pm
by tulamide
I'm very sorry, I just realized that I used marshalling in Apex, where you don't have access to the code. In ACM only the standard schematic marshalling (loadState, saveState) is used.

Re: how to send Midi Message

Posted: Sun Mar 20, 2016 3:05 pm
by Walter Sommerfeld
Yeah - i heard about the 'Marshall' routine but didn't had the time to look into it...

Maybe someone here can enlighten me and/or give me some good links 4 more info...


Thanks in advance!
Walter

btw: will have a look into ur ACM...

Re: how to send Midi Message

Posted: Sun Mar 20, 2016 3:30 pm
by tulamide
My source of choice for Ruby is always ruby-doc.org

Here are 2 pages that you need to use marshalling and saving/loading:
http://ruby-doc.org/core-1.9.3/Marshal.html
http://ruby-doc.org/core-1.9.3/IO.html

On the first page you'll want to read everything, but the keywords are dump and load
On the second page you'll be interested in binread and binwrite

Combined it is really easy to create files that contain the current state of any object, for example:

Code: Select all

IO.binwrite("myfilename.myending", Marshal.dump(myobject))
# writes a serialized binary version of myobject to the file myfilename.myending


Code: Select all

myobject = Marshal.load(IO.binread("myfilename.myending"))
# loads back the serialized object from the file

Re: how to send Midi Message

Posted: Sun Mar 20, 2016 3:34 pm
by Walter Sommerfeld
Thanks Tom => really appreciate your help!

Had a look there already now and i'll give it a go... ;-)

Cheers,
Walter

=> done - It works like a charm :)
U saved my day!

Re: how to send Midi Message

Posted: Mon Mar 21, 2016 1:11 am
by tulamide
Walter Sommerfeld wrote:=> done - It works like a charm :)
U saved my day!

GREAT! Nice to have feedback, and impressive that you could work it out without real demos!