Re: MIDI Transpose?
Re: MIDI Transpose?
- Subject: Re: MIDI Transpose?
- From: Peter Rebholz <email@hidden>
- Date: Mon, 2 Jun 2008 21:08:30 -0500
If you _really_ wanted to change the pitch of the audio generated from
the MIDI you could use the time pitch unit to modify the pitch w/o
changing the speed. It should be as easy as adding the unit to your
graph and setting a parameter. I suggest testing it out with AULab so
you know what to expect.
That said, I agree with what others have said before me.
Peter
On Jun 2, 2008, at 8:46 PM, Brian Willoughby <email@hidden>
wrote:
Transposing the audio between the MusicPlayer and the speakers would
take an inordinately higher amount of CPU than simply modifying the
MIDI data before generating the audio. Even if this is possible,
your users don't want you to do it that way. Besides, the sound
quality will be much better if you transpose the MIDI data and not
the audio waveform.
If you parsed the MIDI file on your own, then you could transpose it
while reading it from disk into the MusicPlayer sequence, long
before playing the sequence. However, the MusicPlayer API makes it
far too easy to directly read MIDI files, so it's probably not
worthwhile to write your own Standard MIDI File parser just to avoid
a two-pass system.
Alternatively, if the MusicPlayer utilized a callback to get track
data, rather than keeping track data in an opaque storage, then you
could transpose the data as it was requested during playback.
However, this is not the way MusicTrack, MusicSequence, and
MusicPlayer were designed.
In light of the design of the Music Player API, Bill's suggested is
actually the most straightforward. His example really takes less
code than any other approach. You can take advantage of the
existing SMF parser to get the MIDI file into one or more
MusicTracks, then simply modify the data as soon as it has finished
loading. Your users should never notice the additional load time.
By the time they hit play, the transposition will already be complete.
I have not tried the following, but it might be possible to
intercept the MIDI data between the Music Player and the MIDI
device. If you create a virtual end point, connect the Music Player
output to this virtual end point, and then implement code to receive
MIDI data on this virtual end point and modify it on the fly, you
might be able to get exactly what you're asking for without audio
waveform manipulation. Your virtual end point could connect
directly to the desired MIDI output device, and whenever you receive
MIDI data, you can transpose it and immediately send it on to the
device. I think this would take more lines of code than Bill's
suggestion, but it would allow on-the-fly changes to the
transposition amount. This assumes that it is possible to use a
virtual end point in this manner.
Brian Willoughby
Sound Consulting
On Jun 2, 2008, at 17:56, Jay Koutavas wrote:
The idea is to transpose them (change them to a different key)
during real time playback to the speaker. Is there no way to
intercept the audio on the way to the speaker and achieve this?
On May 31, 2008, at 11:02 AM, Jay Koutavas wrote:
What's the recommended way to transpose MIDI notes coming off a
playing MusicPlayer sequence before it hits the speakers?
.MIDI file --> MusicPlayer --> (transposer) --> speakers
I sort of expect MIDIThruConnection to have some role in this,
but I've yet to figure out how to identify the destination
endpoint representing the speakers (built-in audio). Ihave
succeeded in making my own endpoints for tracks in the sequence
and can read the notes -- just don't know where to send them to.
_______________________________________________
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
_______________________________________________
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