Search code examples
algorithmaudioencodingeffectspcm

PCMU fade out effect


I want to achieve PCMU fade out effect of the audio. Lets say I have two pieces of 160 bytes of audio which correspond to 20ms audio duration each and I want to insert some silence between them but I want smooth transition from the first piece to silence and then from silence to the second piece.
How do I achieve this?


Solution

  • You would probably need to convert the PCMU samples within the transition to linear values, scale them according to your transition function, then convert them back to PCMU.

    There may be a way of doing this while remaining in the µ-Law domain, since scaling becomes addition/subtraction, but it will be fiddly to get right and probably not worth the loss of portability/simplicity unless you are really pushing the performance envelope.