Re: Why is this audio unit producing a distorted sound
Re: Why is this audio unit producing a distorted sound
- Subject: Re: Why is this audio unit producing a distorted sound
- From: Chaim Peck <email@hidden>
- Date: Tue, 09 Jul 2013 11:35:54 -0400
Thanks. I did not consider that it could be more than one channel. If it is more than one, then do I do processing on inFramesToProcess * inNumChannels samples?
This may sound like a dumb question, but what is the best way to print output when trying to debug an audio unit?
I noticed that print_r() statements will be displayed when I run auval, but when debugging the audio unit inside AU Lab, is there an ideal way to display messages?
Thanks,
Chaim
On Jul 9, 2013, at 3:03 AM, Simon Haycock <email@hidden> wrote:
> 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
_______________________________________________
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