Re: Pitch detection
Re: Pitch detection
- Subject: Re: Pitch detection
- From: Brian Willoughby <email@hidden>
- Date: Sat, 04 Apr 2015 13:47:49 -0700
Hi Paul,
That's a decent definition of realtime you've given, but the limitations are not as severe as you describe. You cannot read ahead or change the rate at which you receive data. However, you can buffer a reasonable amount of data and thus read behind or slightly ahead, and although you cannot change the amount of data you receive you can control the size of your internal buffering and thus insulate the inner levels of your code from such variables. With AudioUnits, all you need to do is mark your plugin as having the amount of latency created by the buffering, and then you're set.
For example, if you need to read ahead one period at any frequency within the range of human hearing, you could buffer two or three cycles at 20 Hz. At 44.1 kHz, this would only be 4,410 to 6,615 samples, which equates to between 100 ms and 150 ms. The outer layer of your AudioUnit would collect samples in this buffer and pass them to an inner later which would be able to "look ahead" at least a small amount.
If the pitch detection is for display only, then the plugin would not even induce any latency, since the audio would not be processed. If there is pitch correction or other audio processing based on the pitch detection, then latency would be necessary.
It is common for frequency domain effects (based on FFT or similar) to incur some amount of latency in order to work despite the lack of direct control over the amount of data received in each call. As long as the latency is a fraction of a second, most AudioUnit hosts will correct for the latency and time-align the audio track with other tracks in the mix.
The basic gist of your answer is correct, though: Realtime analysis has certain limitations in the available processing techniques compared to off-line processing of audio that is stored in a file.
Brian Willoughby
Sound Consulting
On Apr 2, 2015, at 3:49 PM, Paul Davis <email@hidden> wrote:
> realtime analysis means that you are limited to processing the audio as it flows through the plugin. you cannot read ahead, or behind, you cannot change the amount of data you receive or the rate at which you receive it. your methods must be realtime safe.
>
> non-realtime analysis means, in practice, that you are given a file or fixed buffer with all the data in it, and you can process it in any order, and chunk sizes you want, using any algorithms you feel like.
_______________________________________________
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