electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » Instruments and Equipment » Windows as a music workstation
How do you send MIDI from one computer to another?
Post new topic   Reply to topic Moderators: blue hell
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
destroyifyer



Joined: Mar 22, 2006
Posts: 425
Location: Babylon
Audio files: 4

PostPosted: Fri May 15, 2009 9:58 pm    Post subject: How do you send MIDI from one computer to another?
Subject description: Driver? I know a usb to usb cable will work. Know how?
Reply with quote  Mark this post and the followings unread

Does anyone know of a driver or something that will allow me to send Midi data from a modular program on one computer to one on another computer? I have a USB to USB cable that will certainly do the trick.

Thanks!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Sat May 16, 2009 12:05 am    Post subject: Reply with quote  Mark this post and the followings unread

What immediately comes to me is routing it over the local network. I think writing a ChucK program that does this wouldn't be very hard - if you want I can give it a go (if no one else beats me to it Smile ).

Googling for MIDI over LAN or MIDI of network gives some hits as well, you might want to check those out. I'm not aware of any application that does PC to PC communication over USB, but I may just not be informed well enough.

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Sat May 16, 2009 3:27 am    Post subject: Reply with quote  Mark this post and the followings unread

[color=brown]Edit: Grr, I edited to attach files and it activated htm and smilies and made a mess of my code. If you read this five minutes ago and was confused, please read again.[/color]

OK, I felt like trying this out. It works, kind of. I realize that a ChucK solution maybe isn't what you're after - maybe there is something else out there on the net.

You need some kind of virtual midi device, like Midi Yoke, to route to and from. Sometimes DAWs offer these virtual midi devices as part of them, if you got one of those you should try that because I think midi yoke introduced some kind of weird lag in my tests (they emphasise on the homepage that Midi Yoke isn't really supported for Windows NT/2000/XP etc).

You need to also install ChucK. If you don't feel comfortable with command lines, use MiniAudicle. To find out which device to use (a midi yoke or other virtual device), run probe ("chuck --probe" on the command line).

This runs on the computer you want to send midi from, let's call it the client:

Code:
// Command line arguments
// chuck midi2OSC [midi_device [hostname [port]]]

2 => int MIDI_IN_DEVICE;
"localhost" => string HOSTNAME;
6449 => int PORT;

if( me.args() ) me.arg(0) => Std.atoi => MIDI_IN_DEVICE;
if( me.args() > 1) me.arg(1) => HOSTNAME;
if( me.args() > 2) me.arg(2) => Std.atoi => PORT;

// MIDI stuff
MidiIn midiIn;
MidiMsg midiMsg;

if( !midiIn.open( MIDI_IN_DEVICE ) ) {
   <<< "Couldn't open midi device #", MIDI_IN_DEVICE >>>;
   me.exit();
}


// OSC stuff
OscSend xmit;
xmit.setHost( HOSTNAME, PORT );

fun void sendMidiOverOSC(int data1, int data2, int data3) {
    xmit.startMsg( "/midi/message", "i i i" );
    data1 => xmit.addInt;
    data2 => xmit.addInt;
    data3 => xmit.addInt;
}


while (true) {
   midiIn => now;
   while (midiIn.recv(midiMsg)) {
      <<< "MIDI: ", midiMsg.data1, midiMsg.data2, midiMsg.data3 >>>;
      sendMidiOverOSC(midiMsg.data1, midiMsg.data2, midiMsg.data3);
   }
}


This accepts arguments (though I don't know how to do args on the command line). The first arg is the midi device (a virtual one, like midi yoke), the second is the hostname you want to ssend midi to, the last is the port.

This runs on the computer you want to receive midi events, let's call it the server.

Code:
// Command line arguments
// chuck osc2midi [midi_device [hostname [port]]]

0 => int MIDI_OUT_DEVICE;
"localhost" => string HOSTNAME;
6449 => int PORT;

if( me.args() ) me.arg(0) => Std.atoi => MIDI_IN_DEVICE;
if( me.args() > 1) me.arg(1) => Std.atoi => PORT;

// MIDI stuff
MidiOut midiOut;
MidiMsg midiMsg;
if (!midiOut.open(MIDI_OUT_DEVICE)) {
   <<< "Couldn't open midi device #", MIDI_OUT_DEVICE >>>;
   me.exit();
}

fun void sendMidi(int data1, int data2, int data3) {
   data1 => midiMsg.data1;
   data2 => midiMsg.data2;
   data3 => midiMsg.data3;
   midiOut.send(midiMsg);
}

// OSC stuff
OscRecv oscRecv;
PORT => oscRecv.port;
oscRecv.listen();

oscRecv.event("/midi/message i i i") @=> OscEvent oscEvent;

while (true) {
   oscEvent => now;
   while (oscEvent.nextMsg() != 0) {
      oscEvent.getInt() => int data1;
      oscEvent.getInt() => int data2;
      oscEvent.getInt() => int data3;
      <<< "Got event: ", data1, data2, data3>>>;
      sendMidi(data1, data2, data3);
   }
}



Again, this accepts arguments. The first argument is the midi device that is to receive the midi events sent from the client (a virtual device again, midi yoke or other), the second is the port (which should be equal to the port specified for the client). If you get some error like "port not available" or "could not open network connection", try changing the ports to some other number.

I am attaching these two pieces of source code as files, that you can save and run.

If this turns out to be usable, please say how it worked out. :)

Edit: forgot the attachements.

/Stefan


midi2OSC.ck
 Description:

Download
 Filename:  midi2OSC.ck
 Filesize:  904 Bytes
 Downloaded:  597 Time(s)


osc2midi.ck
 Description:

Download
 Filename:  osc2midi.ck
 Filesize:  1.02 KB
 Downloaded:  603 Time(s)


_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: blue hell
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » Instruments and Equipment » Windows as a music workstation
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use