I am following this example for a basic use of libmp3lame
, using a 30sec long 440Hz sine wave PCM at 44.1kHz (generated with Audacity) as the input.
The output produced was 15 seconds of a higher pitched tone. I also tried a 48kHz PCM of human speech which came out perfectly (naturally in that case I changed lame_set_in_samplerate(lame, 44100)
to 48000
.
Why would the sine wave change so much and the speech be correct? What do I need to change in the code for the wave to be encoded correctly?
EDIT: It's something to do with the input being mono. Now I just cant seem to find how to specify that with libmp3lame.