Encode text to SYSEX to send over midi
Feb 25 2006 | 9:05 pm
I want to create a sysex message from a Name to send over midi to an external receiver.
e.g. MAX/MASP myname --> midiChannel -> midiOut
JAVA application --> midiIn --> display:"myname"
- Feb 27 2006 | 11:15 pmYou might want to work on the text formatting, but this solves the midi and sysex issue.mzed
- Feb 28 2006 | 12:11 amthanks
- Feb 28 2006 | 7:29 am
- Feb 28 2006 | 2:25 pm"Normally, midi transmits 7bits data. Although your technique works thru an IAC bus, I'm not sure it will work with 8bits char with hardware MIDI device (I cannot test myself now!). So the integer should be split into 2 7 bits words (or whatever other technique). "Not sure that's true. The sysex header byte is 0xf0 (240 decimal), note on is 0x80, etc.. last time I checked, that's 8 full bits. Now, the data might be encoded as 7 bits, but for sysex, 8 bit data is OK.
- Feb 28 2006 | 2:54 pm> "Normally, midi transmits 7bits data. Although your technique works thru > an IAC bus, I'm not sure it will work with 8bits char with hardware > MIDI device (I cannot test myself now!). So the integer should be split > into 2 7 bits words (or whatever other technique)." > > Not sure that's true. The sysex header byte is 0xf0 (240 decimal), note on > is 0x80, etc.. > last time I checked, that's 8 full bits. Now, the data might be encoded as > 7 bits, but for > sysex, 8 bit data is OK.You're forgetting that the MSB in each MIDI byte is reserved for designating whether it's a status or data byte.Cheers.*V*I*R*G*O*
- Feb 28 2006 | 3:35 pmOn around Feb 28, 2006, at 15:25, Mark Hill said something like: > Not sure that's true. The sysex header byte is 0xf0 (240 decimal), > note on is 0x80, etc.. last time I checked, that's 8 full bits. Now, > the data might be encoded as 7 bits, but for sysex, 8 bit data is OK.MIDI Status bytes have the MSB set MIDI Data bytes have the MSB clearEither way, the actual *content* of a MIDI byte is encoded in bits 0-6. Bit 7 (MSB) is the status bit. MIDI **data** are restricted to 7 bits per byte.That is the MIDI standard the way it's been forever.If you want to send arbitrary streams of serial 8-bit bytes, you can do, but it ain't MIDI. If IAC let's you do this... you're maybe in luck, but it's breaking the MIDI spec.> -------------- http://www.bek.no/~pcastine/Litter/ -------------- Peter Castine | ^ | Litter Power & Litter Bundle for Jitter firstname.lastname@example.org | email@example.com | iCE: Sequencing, Recording, and Interface Building firstname.lastname@example.org | for Max/MSP | Extremely cool | http://www.dspaudio.com | http://www.dspaudio.com/software/software.html
- Feb 28 2006 | 3:41 pmMIDI always transmit 8 bits bytes. The first bit indicates if this is a status byte (1) or a data byte (0). Status bytes indicate the start of a new midi message, or in the case of a SYSEX it could also indicate the end of a sysex message (0xFF or 247). If you send sysex messages where the data bytes between the first and last bytes are in the range 128-255 you might risk them being misinterpreted at the receiving for being something else, e.g. the start of a note-on message (144-159) or a pitch-bend message (224-239).For this reason you should reformat your character values so that one char is sent as two bytes, to make sure that the first bit of each of the bytes is 0. Peter Elsea provides externals for dealing with "nibbles" as part of Lobjects.You can do with standard Max obejcts as well. The patch below provides abstractions for converting ascii to and from nibble as well as messages to and from sysex. I did not bother to add Checksum at the end of the sysex messages, or an manufactorer ID to the sysex that could have been used to tell it apart from sysex messages meant for other gear.Best, Trond
- Feb 28 2006 | 4:43 pmOn 28 Feb 2006, at 14:25, Mark Hill wrote:> Now, the data might be encoded as 7 bits, but for sysex, 8 bit data > is OK.As other folks have suggested (or will suggest): MIDI data bytes are 7-bit. Sysex messages start with 0xF0 and end with 0xF7, but all the intermediate bytes have to have the top bit clear. (We could argue about whether realtime messages with the top bit set are allowed within Sysex; I don't know of any kit, hardware or software, that does that.)Back in the days when hardware synthesisers roamed the land, manufacturers used to implement a scheme to "stream" 8-bit data into 7-bit bytes. (Well, the Japanese did; the Americans often favoured nybble-encodings.)Those with long memories might want to check the command options in the configuration files used by Max's "lib" object.nick rothwell -- composition, systems, performance -- http:// www.cassiel.com
- Feb 28 2006 | 9:31 pm> > On 28 Feb 2006, at 14:25, Mark Hill wrote: > > > Now, the data might be encoded as 7 bits, but for sysex, 8 bit data > > is OK. >OK, sorry for my mistake with sysex. I was rembering something that I had in fact done with meta events.You can send a text string over MIDI by starting a meta event (0xFF) of type 1 (0x01) then a string of ascii characters.Max support for meta events isn't strong, but you can parse this data out of the output of [midiin] with a little programming. I have this somewhere... but it's a long time ago. I'll see if I can dig it out.I prefer OSC now. :-)mzed
- Mar 01 2006 | 7:34 amTo send meta events, you may use Peter Swinnen's psw.midifile.parser source to make it real-time, maybe...f.e