Re: MIDI Transpose?
Re: MIDI Transpose?
- Subject: Re: MIDI Transpose?
- From: Brian Willoughby <email@hidden>
- Date: Fri, 6 Jun 2008 18:26:58 -0700
On Jun 6, 2008, at 07:46, Jay Koutavas wrote:
Based on what I learned from your previous message, and the example
here: http://lists.apple.com/archives/coreaudio-api/2005/May/
msg00301.html I've been able to successfully tune the Apple DLS
Synth using this in a modified PlaySoftMIDI example:
MusicDeviceMIDIEvent(synthUnit, 0xB0, 0x64, 0x02, 0);
MusicDeviceMIDIEvent(synthUnit, 0xB0, 0x65, 0x00, 0);
MusicDeviceMIDIEvent(synthUnit, 0xB0, 0x06, value, 0);
MusicDeviceMIDIEvent(synthUnit, 0xB0, 0x26, 0x00, 0);
A 'value' of 64 here sounds like (to my non-musical ear) that it's
the original tuning.
Yes. The decimal value of 64 corresponds to the hexadecimal value of
0x40 that I cited in a previous message.
My actual application is MusicPlayer and sequence based, with each
channel off on its own track. If I send the four above commands to
the synth's "channel 0" before starting the MusicPlayer, nothing
happens. I assume that this is because the MusicPlayer is resetting
the state of the synth at play start. If correct, then the next
step appears to me to be to inject a tuning command into the front
of each of the tracks using MusicTrackNewMIDIChannelEvent(), right?
If so, we won't be able to tune on the fly this way. We'd have to
stop the MusicPlayer, inject a new tuning command at the current
position we're in the sequence and restart.
I disagree. If you want to change the transposition on the fly, then
you would not stop the player, but would instead inject the MIDI
Control Change messages through another port. The MusicPlayer may
reset Coarse Tuning at start, but I doubt that it will reset Coarse
Tuning that comes from other MIDI sources.
You may find it necessary to insert a Coarse Tuning event at the
start of your sequence any time the user starts playback, but you
should not need to stop and restart playback to tune on the fly.
Thank you, I actually did already know how to create virtual
endpoints in general, just didn't know how to find the DLS synth's
(or make one for it.) Running test code that does "give me all
destinations" didn't list the internal synth.
I believe that the DLS Synth is not technically a "virtual"
endpoint. There are several different ways to enumerate MIDI
destinations, and some include more results than others. At the
moment, I am not sure how you connect to the Apple DLS, but I bet
there is sample code somewhere...
I'm thinking I'll still want to pursue hooking my code between the
music player and the virtual endpoint for the internal synth, so
that I could toss MusicDeviceMIDIEvent()-based transpose events at
the synth while its playing. Though, this may not work, and as an
alternative, I could still manually transpose notes at the hook,
though I really don't like that idea now that I know about MIDI
Course Tuning.
Agreed. Now that you have confirmed that MIDI Coarse Tuning works, I
would not recommend the complexity of attaching the MusicPlayer to a
virtual MIDI endpoint for the purpose of modifying the MIDI data on
the way to the DLS Synth.
What you probably need is a parallel connection to the DLS where you
can inject the Tuning. You'll also need to track the current
transpose value that is active, and make sure the sequence includes a
Coarse Tuning event at the start of the track. That is, unless there
is an API for the MusicPlayer which would stop it from resetting
controllers when playback starts.
Brian Willoughby
Sound Consulting
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden