Re: Matlab, MIDI (and RME) (Youngmoo Kim )


Subject: Re: Matlab, MIDI (and RME)
From:    Youngmoo Kim  <ykim@xxxxxxxx>
Date:    Thu, 23 Apr 2009 09:06:54 -0400
List-Archive:<http://lists.mcgill.ca/scripts/wa.exe?LIST=AUDITORY>

MATLAB contains Java support, including the javax.sound.midi.* classes (although it somewhat depends on your platform). On Windows, it's quite easy to send MIDI messages, although latency may be an issue. (The Mac OS X Java VM does not make MIDI available to apps, so you need some additional software. See http://www.mandolane.co.uk/ for more info.) Below is some example code that sends a scale from MATLAB via MIDI: import javax.sound.midi.* scale = [60 62 64 65 67 69 71 72]; info = MidiSystem.getMidiDeviceInfo; % This will return a list of available MIDI devices outputPort = MidiSystem.getMidiDevice(info(2)); % The actual device index will vary depending on your configuration outputPort.open; r = outputPort.getReceiver; note = ShortMessage; for i=1:length(scale) note.setMessage(ShortMessage.NOTE_ON, 1, scale(i), 127) r.send(note, -1) pause(0.5); note.setMessage(ShortMessage.NOTE_OFF, 1, scale(i), 127); r.send(note, -1) pause(0.5); end outputPort.close; Hope this is helpful! -Youngmoo -- Youngmoo Kim, Assistant Professor Music & Entertainment Technology Laboratory (MET-lab) Electrical & Computer Engineering Department Drexel University ykim@xxxxxxxx http://ece.drexel.edu/faculty/kim On Apr 23, 2009, at 3:31 AM, Bastian Epp wrote: > Hi list! > > I am currently playing around with a multi-channel setup which uses: > > RME HDSPe MADI with RME ADI8-QS > > The ADI8-QS is supposed to be controllable via MIDI (which is a good > thing in order to ensure the correct settings). I am wondering if > anybody has some experience in sending MIDI-commands within MATLAB > to an audio device (here to the ADI8 using the HDSPe). All I could > find in the internet was a standalone program which can control 8 > channels (1 ADI8). > > So the ideal solution would be to send some MIDI commands (settings) > to the ADI8 just before the sound presentation starts without using > another program that has to be started separately. > > In the web I could only find code converting wav into MIDI and vice > versa, but nothing that actually communicated with a MIDI device via > MATLAB. > > Any pointer would be highly appreciated! Thanks in advance! > > BAstian


This message came from the mail archive
http://www.auditory.org/postings/2009/
maintained by:
DAn Ellis <dpwe@ee.columbia.edu>
Electrical Engineering Dept., Columbia University