• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MIDI Transpose?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MIDI Transpose?


  • Subject: Re: MIDI Transpose?
  • From: Jay Koutavas <email@hidden>
  • Date: Tue, 3 Jun 2008 10:29:42 -0400

Thanks Brian, Bill and Peter.

The preflight tweaking of the loaded file is a clever idea which had not occurred to me. However, reloading the file each time the transpose request occurs is cumbersome. We need to transpose numerous times after a given load. Even while playing, ideally.

Manipulating the notes mathematically on the fly seemed less daunting then pitch bending. But Peter's suggestion about tweaking the time pitch unit makes it seem less so.

Bill pretty much put the nail in the per-midi note transpose on-the-fly when he stated there's not destination endpoint representing speakers.

Thank you,

/Jay

At 6:46 PM -0700 6/2/08, Brian Willoughby 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.


--
--------------------------------------------------------
Jay Koutavas mailto:email@hidden Heynow Software http://www.heynow.com
Windham, New Hampshire, USA
--------------------------------------------------------
_______________________________________________
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
  • Follow-Ups:
    • Re: MIDI Transpose?
      • From: Brian Willoughby <email@hidden>
    • Re: MIDI Transpose?
      • From: Jay Koutavas <email@hidden>
References: 
 >Re: MIDI Transpose? (From: William Stewart <email@hidden>)
 >Re: MIDI Transpose? (From: Jay Koutavas <email@hidden>)
 >Re: MIDI Transpose? (From: William Stewart <email@hidden>)
 >Re: MIDI Transpose? (From: Jay Koutavas <email@hidden>)
 >Re: MIDI Transpose? (From: Brian Willoughby <email@hidden>)

  • Prev by Date: Re: Crash for AAC codec
  • Next by Date: Re: MIDI Transpose?
  • Previous by thread: Re: MIDI Transpose?
  • Next by thread: Re: MIDI Transpose?
  • Index(es):
    • Date
    • Thread