Csound Csound-dev Csound-tekno Search About

Need help on csound4ios with MusicSequence and CoreMIDI

Date2016-11-14 11:37
From"Rex S. Wang"
SubjectNeed help on csound4ios with MusicSequence and CoreMIDI
Hello everyone!

I've been working on an iOS APP with csound4ios as the "audio engine". So far, I'm able to load a midi file into MusicSequence, set a virtual midi endpoint and send the midi events from MusicSequence to CsoundObj via the virtual midi endpoint. But I got stuck on multitrack midi routing, ideally what I want to do is sending each MusicTrack in the MusicSequence to one CsoundObj instance, that way I can have multiple csd loaded and make my APP act like a proper multitrack sequencer without MIDI's 16-channel limitation. 

Since I'm totally a newbie in csound4ios, coreAudio and coreMIDI, I believe there should be an easy way but I just can't figure it out... Here's what I tried and failed so far:

1. Setting up an AUGraph, calling "MusicTrackSetDestNode()" to route each track to an AUNode. I retrieved the csound AudioUnit by calling "getAudioUnit()", but soon I got lost on how to connect the AudioUnit to an AUNode...

2. Creating multiple MidiClients, Virtual Midi Endpoints and Midi sources, trying to route the the midi events via coreMIDI using "MusicTrackSetDestMIDIEndpoint()", but I didn't figure out how to connect the endpoints to the CsoundObjs...

This is basically it, any help would be appreciated! Let me know if you need anything else such as the code. Thanks!

Best,

Rex

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-11-18 19:04
FromSteven Yi
SubjectRe: Need help on csound4ios with MusicSequence and CoreMIDI
Hi Rex,

I don't do much on iOS these days, but have you looked at the CsoundMIDI class?

https://github.com/csound/csound/blob/develop/iOS/Csound%20iOS%20Examples/csound-iOS/classes/midi/CsoundMIDI.m

That should be provided with Csound for iOS. What you might do is,
after creating a CsoundObj instance, set midiInEnabled to YES (or
true, can't remember which).  That should then use the code within
CsoundMIDI to setup the connection to CoreMIDI.  From there, you might
want to edit that file in the MidiInDeviceOpen() method to modify the
name of the client and port.  From there you could probably do the
routing from the one endpoint to the one that Csound creates.

Hope that helps!
steven

On Mon, Nov 14, 2016 at 6:37 AM, Rex S. Wang  wrote:
> Hello everyone!
>
> I've been working on an iOS APP with csound4ios as the "audio engine". So far, I'm able to load a midi file into MusicSequence, set a virtual midi endpoint and send the midi events from MusicSequence to CsoundObj via the virtual midi endpoint. But I got stuck on multitrack midi routing, ideally what I want to do is sending each MusicTrack in the MusicSequence to one CsoundObj instance, that way I can have multiple csd loaded and make my APP act like a proper multitrack sequencer without MIDI's 16-channel limitation.
>
> Since I'm totally a newbie in csound4ios, coreAudio and coreMIDI, I believe there should be an easy way but I just can't figure it out... Here's what I tried and failed so far:
>
> 1. Setting up an AUGraph, calling "MusicTrackSetDestNode()" to route each track to an AUNode. I retrieved the csound AudioUnit by calling "getAudioUnit()", but soon I got lost on how to connect the AudioUnit to an AUNode...
>
> 2. Creating multiple MidiClients, Virtual Midi Endpoints and Midi sources, trying to route the the midi events via coreMIDI using "MusicTrackSetDestMIDIEndpoint()", but I didn't figure out how to connect the endpoints to the CsoundObjs...
>
> This is basically it, any help would be appreciated! Let me know if you need anything else such as the code. Thanks!
>
> Best,
>
> Rex
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2016-11-21 06:26
FromRex Wang
SubjectRe: Need help on csound4ios with MusicSequence and CoreMIDI
Hi Steven,

Thank you so much for the crystal clear explanation! I know where to go now.

Cheers!

Rex



> On Nov 18, 2016, at 2:05 PM, Steven Yi  wrote:
> 
> Hi Rex,
> 
> I don't do much on iOS these days, but have you looked at the CsoundMIDI class?
> 
> https://github.com/csound/csound/blob/develop/iOS/Csound%20iOS%20Examples/csound-iOS/classes/midi/CsoundMIDI.m
> 
> That should be provided with Csound for iOS. What you might do is,
> after creating a CsoundObj instance, set midiInEnabled to YES (or
> true, can't remember which).  That should then use the code within
> CsoundMIDI to setup the connection to CoreMIDI.  From there, you might
> want to edit that file in the MidiInDeviceOpen() method to modify the
> name of the client and port.  From there you could probably do the
> routing from the one endpoint to the one that Csound creates.
> 
> Hope that helps!
> steven
> 
>> On Mon, Nov 14, 2016 at 6:37 AM, Rex S. Wang  wrote:
>> Hello everyone!
>> 
>> I've been working on an iOS APP with csound4ios as the "audio engine". So far, I'm able to load a midi file into MusicSequence, set a virtual midi endpoint and send the midi events from MusicSequence to CsoundObj via the virtual midi endpoint. But I got stuck on multitrack midi routing, ideally what I want to do is sending each MusicTrack in the MusicSequence to one CsoundObj instance, that way I can have multiple csd loaded and make my APP act like a proper multitrack sequencer without MIDI's 16-channel limitation.
>> 
>> Since I'm totally a newbie in csound4ios, coreAudio and coreMIDI, I believe there should be an easy way but I just can't figure it out... Here's what I tried and failed so far:
>> 
>> 1. Setting up an AUGraph, calling "MusicTrackSetDestNode()" to route each track to an AUNode. I retrieved the csound AudioUnit by calling "getAudioUnit()", but soon I got lost on how to connect the AudioUnit to an AUNode...
>> 
>> 2. Creating multiple MidiClients, Virtual Midi Endpoints and Midi sources, trying to route the the midi events via coreMIDI using "MusicTrackSetDestMIDIEndpoint()", but I didn't figure out how to connect the endpoints to the CsoundObjs...
>> 
>> This is basically it, any help would be appreciated! Let me know if you need anything else such as the code. Thanks!
>> 
>> Best,
>> 
>> Rex
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here