• 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: AUMIDIEffectBase Howto
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AUMIDIEffectBase Howto


  • Subject: Re: AUMIDIEffectBase Howto
  • From: Eyal Redler <email@hidden>
  • Date: Mon, 12 Jan 2009 02:43:54 +0200

Thanks Bill,

I'm aware of the SinSynth example but my project is not an instrument but rather an effect which is also controlled via MIDI.

What I figured out in the meanwhile is that the easiest solution would be to put the MIDI events on a queue using the relative (to "Render") sample offsets when I get them (via HandleNoteOn etc.) and then override "Render" to translate the events I've collected so far to "absolute" offests (which is done by adding the "frame processed" counter I maintain in the kernel) which are then passed on to the Kernels. After that my "Render" override calls the super's "Render".

Eyal




override "Render" and


On Jan 11, 2009, at 2:08 PM, William Stewart wrote:

If you are doing an audio unit that plays notes (basically a music instrument/synth/sampler) then you should be using MusicDevicBase as a starting point and the AUInstrumentBase classes (see SinSynth in the examples) is a good illustration of this

MIDI Effects are still basically like effects (they process audio) but just add a layer of control with MIDI that an audio unit can provide a specific implementation for.

So, I'd recommend having a look at the SinSynth example as a good start point

Bill

On Jan 9, 2009, at 12:40 AM, Eyal Redler wrote:

Hi,

I'm working on implementing an AUMIDIEffectBase based audio unit. This is my first venture into Audio Units (and audio programming in general) and it seems that there are not sample projects for AUMIDIEffectBase based AU (or maybe there is and I'm not aware of it) so I'm a bit confused as to how to synchronize the note events with the audio processing.

When I receive the MIDI event (HandleNoteOn) I get the timing information in the inStartFrame parameter I understand that this is relative to the first frame in the next AUEffectBase::Render method, but if I'm not wrong AUEffectBase may split the buffer into several parts (which are then passed to the kernel "Process" method) to accommodate scheduled parameter changes.

This means that inStartFrame can be incorrect relative to the chance I'm processing in the Kernel. For example, if the buffer size is 512 I may have the following situation:
Frame offset Event
120 Note On
240 Parameter Change
330 Note Off
The parameter change in 240 causes the buffer to be split and then I have two invocations of the Kernel "Process":
A. Sample 0-239
B. Sample 240-511
And this means that the 330 offset of the Note Off is no longer valid, I either must adjust it or somehow know what is the real sample offset I'm processing in the kernel.


Some options that I thought about were:
a. Convert the MIDI notes into parameter changes (how?) and then have the (very convenient) assumption that each "Process" invocation is dealing with one note at a time
b. Override AUEffectBase::Render and adjust the MIDI event offsets
c. Enable the Kernel to know what is the real sample offset (relative to "Render"). I'm not sure how this is done


Thanks,

Eyal Redler
------------------------------------------------------------------------------------------------
"If Uri Geller bends spoons with divine powers, then he's doing it the hard way."
--James Randi
www.eyalredler.com



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com


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
References: 
 >AUMIDIEffectBase Howto (From: Eyal Redler <email@hidden>)
 >Re: AUMIDIEffectBase Howto (From: William Stewart <email@hidden>)

  • Prev by Date: Re: WMA on the iPhone
  • Next by Date: Question regarding recording and accounting for drift
  • Previous by thread: Re: AUMIDIEffectBase Howto
  • Next by thread: Re: AUMIDIEffectBase Howto
  • Index(es):
    • Date
    • Thread