• 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: Why is this audio unit producing a distorted sound
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Fri, 12 Jul 2013 02:32:19 -0400

Thank you for such a thorough answer.

I found the problem with the distortion. I was using inSourceP and not sourceP:


void TestAudioUnit::TestAudioUnitKernel::Process(Float32 const* inSourceP, Float32 * inDestP, UInt32 inFramesToProcess, UInt32 inNumChannels, bool & ioSilence) {
    if (!ioSilence) {
        const Float32 *sourceP = inSourceP;
...


But at the end of the loop, I was incrementing sourceP. So as far as I understand, I was essentially downsampling everything by the buffer size (512), by not incrementing the value that I was getting the source from.

And for debugging, I found that if I have Xcode launch AU Lab, it will break at breakpoints, etc. I followed the steps here for that:
http://sample-hold.com/2011/11/23/create-a-fft-analyzer-part-iv-debugging-our-audio-unit-with-au-lab/

I am not sure where printf() statements are going, but I should be able to find the console when I need it. In the meantime, the breakpoints and being able to inspect variables that way is almost more helpful.

I am curious which wave editor you are using. I would like to automate some sort of process so that I can build and run and it will automatically run against a particular audio file and show me the before and after waveforms. Is there a lightweight application that will help me do that?

Thanks for your help,
Chaim


On Jul 11, 2013, at 5:25 PM, Simon Haycock <email@hidden> wrote:

Hi Chaim

I am sure I managed to get Xcode 2/3 to run and monitor AU Lab, which opened a default AU Lab session containing my plugin. This allowed me to view printf messages... It was a scrappy way of printing, but it worked nonetheless. I have tried 'Attach To Process' with AU Lab, but didn't seem to do much... An alternative (which I worked on initially) is to create some sort of logging system to write your sample values to a text file.

I just tried to build my old AU, but got nasty clangs, so tried to make a new AU. I had no idea the entry had gone from the templates list to make a new AU. So found this to restore my templates: http://www.mojolama.com/restore-apples-audio-unit-templates
I then found a link to Apple's template for an AU with a cocoa view (could have really done with a few years ago!).
https://developer.apple.com/library/mac/#samplecode/StarterAUEffectWithCocoaUI/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011650
I have built and tested it and it works fine (OS 10.7.5, Xcode 4.6.2). It does exactly the same as your AU. Perhaps you could use Apple's example to see where your problem lies?

About the number of channels, I believe I am thoroughly mistaken, as numOfChannels is always 1, and if your AU is stereo, two kernels are made which use the same process function on both channels, so your process function should be made for mono audio only. To do stereo requires special considerations which have been discussed in detail in other list topics.

Did you manage to record the output of your unit and load the recording into a wave editor?

Simon

On 9 Jul 2013, at 16:35, Chaim Peck wrote:

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



 _______________________________________________
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: Why is this audio unit producing a distorted sound
      • From: Simon Haycock <email@hidden>
References: 
 >Why is this audio unit producing a distorted sound (From: Simon Haycock <email@hidden>)
 >Re: Why is this audio unit producing a distorted sound (From: Chaim Peck <email@hidden>)
 >Re: Why is this audio unit producing a distorted sound (From: Simon Haycock <email@hidden>)

  • Prev by Date: Re: Why is this audio unit producing a distorted sound
  • Next by Date: Re: Why is this audio unit producing a distorted sound
  • Previous by thread: Re: Why is this audio unit producing a distorted sound
  • Next by thread: Re: Why is this audio unit producing a distorted sound
  • Index(es):
    • Date
    • Thread