Why is this audio unit producing a distorted sound
Why is this audio unit producing a distorted sound
- Subject: Why is this audio unit producing a distorted sound
- From: Simon Haycock <email@hidden>
- Date: Tue, 09 Jul 2013 08:03:23 +0100
Hi Chaim.
When I am troubleshooting in AU Lab, I record my output (using the inbuilt record utility) and open the recording in a wave editor. This shows me a graph of the samples produced by my DSP, which can be very useful in uncovering distortions.
What value is being passed in for 'inNumChannels' ? I know the last time I was doing AU stuff, this was always 1, but if it is 2, you could only be filling half the buffer, which will give you a nasty amplitude modulation at 86Hz (if inFramesToProcess is 512, and your sample rate is 44100)...
Cheers
Simon
>
> Hello,
>
> I am trying to get started with a very simple Audio Unit that is supposed to control volume. Here is what I have in my processing code:
>
> void TestAudioUnit::TestAudioUnitKernel::Process(Float32 const* inSourceP, Float32 * inDestP, UInt32 inFramesToProcess, UInt32 inNumChannels, bool & ioSilence) {
> if (!ioSilence) {
> const Float32 *sourceP = inSourceP;
>
> Float32 *destP = inDestP,
> inputSample,
> outputSample,
> gain;
>
> gain = GetParameter (kParameter_Gain);
>
> for (int i = inFramesToProcess; i > 0; --i) {
> inputSample = *inSourceP;
> outputSample = (gain * inputSample);
> *destP = outputSample;
> sourceP += 1;
> destP += 1;
> }
> }
> }
>
> ---
>
> When I use this plugin through AULab, I am hearing a distorted sound, even when the gain is set to 1.0. For that matter even if I change the outputSample to be direct (outputSample = inputSample), I am still getting a distorted sound. It goes away when I bypass the plugin.
>
> Obviously, I am doing something incorrectly. I would appreciate any help in finding and resolving this.
>
> Thanks!
>
> - Chaim
_______________________________________________
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