• 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
Manipulating AudioQueueBuffer audio data results in noise.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Manipulating AudioQueueBuffer audio data results in noise.


  • Subject: Manipulating AudioQueueBuffer audio data results in noise.
  • From: Ilya Kalyuk <email@hidden>
  • Date: Wed, 20 Jan 2010 00:36:45 +0300

Hi!

I'm trying to implement an iPhone sound processing app using SpeakHere
sample app as a starting point. The app involves manipulating buffered
audio samples during playback. When I multiply the samples by a
fractional number (0.9 for instance) I get noise as a result. The
strangest thing about it is that when multiplying samples by whole
numbers (like 1.0, 2.0) or adding or subtracting from them the
playback sounds as expected.

I'm doing it in the playbackCallback function of AudioPlayer.m with
the following code snippet:


      //------------------
      //If buffer samples are multiplied by 0.9 we get noise. If we
multiply it by 1.0 or add to it everything's fine.
      short *buffer = (short *)calloc(1, numPackets * 2);
      memmove(buffer, bufferReference->mAudioData, numPackets * 2);
      for (int i = 0; i < numPackets; i++)
      {
       buffer[i] *= 0.9;
       //buffer[i] *= 1.0;
       //buffer[i] += 10.0;
      }
      memmove(bufferReference->mAudioData, buffer, numPackets * 2);
      free(buffer);
      buffer = NULL;
      //-------------------


The full project could be downloaded here:
http://depositfiles.com/files/lmnkq68n8 or here:
http://www.filefactory.com/file/a2c9c30/n/Speak_Here.zip

Could anyone point me to what am I doing wrong? I've been struggling
with it for a couple of days already and I'm completely lost.

Thank you!
 _______________________________________________
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: Manipulating AudioQueueBuffer audio data results in noise.
      • From: "Hank Heijink (Mailinglists)" <email@hidden>
  • Prev by Date: iPhone 3.1.2: weird AudioFileStreamParseBytes behavior with HTTP Live variant streams
  • Next by Date: Re: Manipulating AudioQueueBuffer audio data results in noise.
  • Previous by thread: Re: iPhone 3.1.2: weird AudioFileStreamParseBytes behavior with HTTP Live variant streams
  • Next by thread: Re: Manipulating AudioQueueBuffer audio data results in noise.
  • Index(es):
    • Date
    • Thread