• 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: Can anyone help me in Fade In...?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can anyone help me in Fade In...?


  • Subject: Re: Can anyone help me in Fade In...?
  • From: Howard Moon <email@hidden>
  • Date: Fri, 17 Jul 2009 09:19:40 -0700


On Jul 17, 2009, at 8:59 AM, Richard Dobson wrote:

Ansh wrote:
I have reduce my algorithm to
        - (void)applyFadeInEffectForBuffer:(float *)buffer
        ofLength:(int)length         {
        * **length = length / sizeof(float);*
        * **for (int i = 0; i < length; i ++) {*
        * **float factor = (float)( i/(float) length); *

What was wrong with simply casting i? That makes the whole expression a float.


        * **buffer[i] = (float)(buffer[i])  * factor;*
        * **}*
        }
    where length is in number of bytes. But still there is a noise in
    fade in.

You will need to specify the noise in a little more detail. Note that a plain linear ramp is less than ideal for an audio fade-in - gets loud too soon. Try a log or quasi-log (rising exp) curve. A simple one would be to change:


	buffer[i] = (float)(buffer[i])  * factor;

to:

 	buffer[i] = (float)((buffer[i])  * (factor * factor));



A sine-curve-shaped fade-in (offset by -pi/2 horizontally and by 1 vertically, and scaled in both axes appropriately) would also work well, wouldn't it? That would give you a (relative) slope of zero at both ends, which would smooth out the transitions nicely.


-Howard


_______________________________________________ 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: 
 >Re: Can anyone help me in Fade In...? (From: Alejandro <email@hidden>)
 >Re: Can anyone help me in Fade In...? (From: Ansh <email@hidden>)
 >Re: Can anyone help me in Fade In...? (From: Richard Dobson <email@hidden>)

  • Prev by Date: Re: I need to analyze MP3 and AAC content in order to determine BPM . . .
  • Next by Date: monitoring system audio output like wire tap
  • Previous by thread: Re: Can anyone help me in Fade In...?
  • Next by thread: Re: Can anyone help me in Fade In...?
  • Index(es):
    • Date
    • Thread