none
Using the RecordAudio sample, how to increase volume in per cent? RRS feed

  • Question

  • Example: How do you increase the output-audio volume by 60 per cent, so the perceived audio is 60 per cent louder?


    Eisenanstreicher


    Wednesday, February 29, 2012 2:27 PM

Answers

  • Depends on how you want to do this. There are lots of applications on the internet that can do this for you with the output file that was saved. The file is a regular wave file.

    If you are looking to do this programmatically, then you will have to be comfortable with the buffer data and how to manipulate each sample. One way (and by no means the best), would be add a value to each sample. This will affect the characteristics of the file which might not be what you want.

    Thursday, March 1, 2012 12:09 AM
  • Gain is a multiplier of the audio signal.  To increase gain by 60%, you would want to convert from bytes to samples, multiply by 1.6, and then convert back to bytes and write them into the byte stream.  Any time you increase the gain in this way, you run the risk of clipping (getting an out of range value that is not legal to store), and so a complete implementation would also prevent against this.  This is a relatively deep area, and there are lots of resources online that describe different approaches to this.  (e.g. http://en.wikipedia.org/wiki/Audio_level_compression)

    A simpler approach would be to record the audio exactly as it is sensed, and then import it into one of the many available wave editors and do the gain there.  Generally they have a number of sophisticated algorithms to handle this, and you can tweak their parameters to get your desired results.

    Tuesday, April 3, 2012 6:51 PM

All replies

  • Depends on how you want to do this. There are lots of applications on the internet that can do this for you with the output file that was saved. The file is a regular wave file.

    If you are looking to do this programmatically, then you will have to be comfortable with the buffer data and how to manipulate each sample. One way (and by no means the best), would be add a value to each sample. This will affect the characteristics of the file which might not be what you want.

    Thursday, March 1, 2012 12:09 AM
  • This actually is right but very vague. I had some other person give me detailed code on how to do it - using the RecordAudio sample I had to add only 4 lines.

    Eisenanstreicher

    Monday, March 19, 2012 4:35 PM
  • Gain is a multiplier of the audio signal.  To increase gain by 60%, you would want to convert from bytes to samples, multiply by 1.6, and then convert back to bytes and write them into the byte stream.  Any time you increase the gain in this way, you run the risk of clipping (getting an out of range value that is not legal to store), and so a complete implementation would also prevent against this.  This is a relatively deep area, and there are lots of resources online that describe different approaches to this.  (e.g. http://en.wikipedia.org/wiki/Audio_level_compression)

    A simpler approach would be to record the audio exactly as it is sensed, and then import it into one of the many available wave editors and do the gain there.  Generally they have a number of sophisticated algorithms to handle this, and you can tweak their parameters to get your desired results.

    Tuesday, April 3, 2012 6:51 PM