electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
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 
Live streaming at radio.electro-music.com

  host / artist show at your time
  Jez Adventures in Sound
Please visit the chat
 Forum index » Instruments and Equipment » OSX as a music workstation
How to create a virtual MIDI cable?
Post new topic   Reply to topic Moderators: elektro80
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 1651
Location: Berks County, PA
Audio files: 38

PostPosted: Thu Sep 13, 2007 12:10 pm    Post subject: How to create a virtual MIDI cable?
Subject description: Sending MIDI from process A to process B.
Reply with quote  Mark this post and the followings unread

Just started programming OSX recently, and this task looks fairly straightforward, but I thought I'd run it past the experts.

I just want to create a process that looks like a MIDI cable inside the Mac, so that one application can write MIDI to it and another can read it. It seems that if I do MIDISourceCreate and MIDIDestinationCreate and essentially "pipe" data arriving at Destination -> Source, that this should do it?

Will this virtual MIDI channel appear like a first class device, for example with respect to MIDIGetNumberOfSources() and MIDIGetNumberOfDestinations() and related queries? I would think so.

Maybe there is already a utility that does so? I'd prefer to reuse that, instead of doing more coding, if it's available.

Thanks.

_________________
When the stream is deep
my wild little dog frolics,
when shallow, she drinks.
Back to top
View user's profile Send private message Visit poster's website
EdisonRex
Site Admin


Joined: Mar 07, 2007
Posts: 4529
Location: London, UK
Audio files: 169

PostPosted: Thu Sep 13, 2007 3:14 pm    Post subject: Reply with quote  Mark this post and the followings unread

this is what I have Max/MSP for. It may be overkill some of the time, but it keeps me in practice.

most sequencers implement this function as part of their existence.

I suppose you could write this yourself, but for midi it's kind of trivial, and yes, you are on the right track procedurally.

_________________
Garret: It's so retro.
EGM: What does retro mean to you?
Parker: Like, old and outdated.


Home,My Studio,and another view
Back to top
View user's profile Send private message Visit poster's website
elektro80
Site Admin


Joined: Mar 25, 2003
Posts: 21977
Location: Norway
Audio files: 14

PostPosted: Thu Sep 13, 2007 3:57 pm    Post subject: Reply with quote  Mark this post and the followings unread

There are supposed to be some code examples for this in the various SDK bundles.
_________________
A Charity Pantomime in aid of Paranoid Schizophrenics descended into chaos yesterday when someone shouted, "He's behind you!"

MySpace
SoundCloud
Flickr
Back to top
View user's profile Send private message Visit poster's website
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 1651
Location: Berks County, PA
Audio files: 38

PostPosted: Thu Sep 13, 2007 6:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

Applications -> Utilities -> Audio MIDI Setup -> IAC Driver -> x Device is on line

appears to be the mantra. I figured of CoreMIDI made it relatively easy, they should have included an app that uses it. There is also a Network MIDI driver that I guess talks only to other Macs. Don't see a protocol for it.

I had been using an early copy of LoopBE http://www.nerds.de/ on XP. Looks like those guys now have a network MIDI protocol that'll work cross XP/OSX platform, probably have to buy two copies.

Translating my XP MIDI system calls to CoreMIDI has been straightforward enough. My biggest remaining gripe is that the documentation for CoreMIDI beyond the intro doc is nothing more than the header files in HTML, with terse and at times misleading comments. Surprisinly, Windows XP docs on MSDN were much better commented when I did this for XP 2 years ago. Where OSX overlaps with other UNIX (e.g., pthreads), there is a wealth of docs, but for where Apple is doing its custom value-add, the documentation so far is on the slim side. Some web searches outside Apple have helped a lot.

Thanks.

_________________
When the stream is deep
my wild little dog frolics,
when shallow, she drinks.
Back to top
View user's profile Send private message Visit poster's website
EdisonRex
Site Admin


Joined: Mar 07, 2007
Posts: 4529
Location: London, UK
Audio files: 169

PostPosted: Fri Sep 14, 2007 3:35 am    Post subject: Reply with quote  Mark this post and the followings unread

Acoustic Interloper wrote:
Applications -> Utilities -> Audio MIDI Setup -> IAC Driver -> x Device is on line

appears to be the mantra. I figured of CoreMIDI made it relatively easy, they should have included an app that uses it. There is also a Network MIDI driver that I guess talks only to other Macs. Don't see a protocol for it.

I had been using an early copy of LoopBE http://www.nerds.de/ on XP. Looks like those guys now have a network MIDI protocol that'll work cross XP/OSX platform, probably have to buy two copies.

Translating my XP MIDI system calls to CoreMIDI has been straightforward enough. My biggest remaining gripe is that the documentation for CoreMIDI beyond the intro doc is nothing more than the header files in HTML, with terse and at times misleading comments. Surprisinly, Windows XP docs on MSDN were much better commented when I did this for XP 2 years ago. Where OSX overlaps with other UNIX (e.g., pthreads), there is a wealth of docs, but for where Apple is doing its custom value-add, the documentation so far is on the slim side. Some web searches outside Apple have helped a lot.

Thanks.


Oh, right, IAC. Totally forgot that, thanks for reminding me.

CoreMIDI and CoreAudio are amazingly undocumented for mere users. I did find out how to add custom MIDI devices (hint: Cherrypicker) but even that has mystic bits in it.

_________________
Garret: It's so retro.
EGM: What does retro mean to you?
Parker: Like, old and outdated.


Home,My Studio,and another view
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 3708
Location: Sweden
Audio files: 270
G2 patch files: 96

PostPosted: Mon Sep 17, 2007 4:58 am    Post subject: Reply with quote  Mark this post and the followings unread

I think the XCode docs in general are pretty bad. The ones that aren't empty contain a lot of sales pitch that obscures the info that you're interested in. Java's free docs at java.sun.com are miles ahead. I really wanted to try out XCode when I first got my mac, but after a couple of frustrating searches through the docs after specific information, I gave up, installed Eclipse and returned to the wonderful world of Java.

/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
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 1651
Location: Berks County, PA
Audio files: 38

PostPosted: Mon Sep 17, 2007 7:01 am    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:
I really wanted to try out XCode when I first got my mac, but after a couple of frustrating searches through the docs after specific information, I gave up, installed Eclipse and returned to the wonderful world of Java.
/Stefan

It looks to me like the XCode framework is Microsoft all over again, but without decent documentation. One can argue the 'custom framework' philosophy either way. On one hand a custom framework can provide new capabilities, making it a good thing, but on the other hand it makes for non-portable code and locks one in. What I really dislike about it, having programmed on UNIX for over 25 years, is that none of the OSX framework stuff I have used so far -- Core MIDI, little bits of Core Audio, and some Core Services stuff -- looks the least bit like UNIX system calls and libraries. It looks like a windowing event framework shoved down the throat of the O.S., which is an accurate description of Windows.

I try to write portable code, and nevertheless I am spending many hours porting what were supposed to be two 'little, circumscribed' modules that do generic OS stuff (threads, dynamic libraries, etc.) and low level MIDI IO respectively. Happily, at least the pthreads part of the port will also work on Linux.

So, Apple seem to be raking cues from MS, not only on look & feel, but also on system structure. Too bad.

_________________
When the stream is deep
my wild little dog frolics,
when shallow, she drinks.
Back to top
View user's profile Send private message Visit poster's website
brinxmat



Joined: Oct 24, 2005
Posts: 262
Location: Norway

PostPosted: Wed Oct 03, 2007 12:45 am    Post subject: Reply with quote  Mark this post and the followings unread

Just a historical note: NeXTSTEP/OPENSTEP was portable, but when Apple got their grubbies on it they fruited this entirely. OPENSTEP on Winnt, Solaris, Macos/Rhapsody, etc...

http://en.wikipedia.org/wiki/Image:OPENSTEP_on_Windows_NT.jpg
http://homepage.mac.com/troy_stephens/OpenStep/screenShots/sol-openstep.gif
http://www.kernelthread.com/mac/vpc/images/rhapsody.gif

Add some Carbon and you get platform-dependent poop.

Programming in pure Cocoa (i.e. Obj-C + NIBs) is quite nice, quite easy and efficient. Except that it is platform dependent. Am looking at GNUStep, but this still seems quite incomplete to my mind, and it boogers my Linux install. Great shame.

Java + Swing ? Not sure, but anything is better than Winnt dev.

_________________
-- Say "&Eth;onne hit wæs hrenig weðer"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: elektro80
Page 1 of 1 [8 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 » OSX 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
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


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