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

Re: Manipulating AudioQueueBuffer audio data results in noise.


  • Subject: Re: Manipulating AudioQueueBuffer audio data results in noise.
  • From: "Hank Heijink (Mailinglists)" <email@hidden>
  • Date: Tue, 19 Jan 2010 16:55:16 -0500

Audio buffers on the iPhone use signed 16-bit integers. If you multiply by 0.9, the results will be cast back to 16-bit ints and therefore rounded off: that's your noise.

Hank

On Jan 19, 2010, at 4:36 PM, Ilya Kalyuk wrote:

> 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
>

 _______________________________________________
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

References: 
 >Manipulating AudioQueueBuffer audio data results in noise. (From: Ilya Kalyuk <email@hidden>)

  • Prev by Date: Manipulating AudioQueueBuffer audio data results in noise.
  • Next by Date: PlaySequence doesn't compile
  • Previous by thread: Manipulating AudioQueueBuffer audio data results in noise.
  • Next by thread: PlaySequence doesn't compile
  • Index(es):
    • Date
    • Thread