Tell me more ×
Audio-Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of audio, video, and media creation. It's 100% free, no registration required.

(This is a cross-post from StackOverflow. But I wondered wether some people here might be the better audience to answer this.)

I am using libswresample to resample from any PCM format to 44.1kHz, 16bit int, stereo.

I was playing around with some audio volume analyzing of the resulting audio stream and I figured out that in case I have 44.1kHz, 16bit int mono as the source, I have roughly the formular:

leftSample = sourceSample / sqrt(2);
rightSample = sourceSample / sqrt(2);

But I was expecting:

leftSample = sourceSample;
rightSample = sourceSample;

(In case the source is stereo, I simply have leftSample = leftSourceSample; rightSample = rightSourceSample;.)

My expectation comes from several sources:

  1. That is how my own straight forward solution would probably have been.
  2. I searched a bit around and other people seem to do the same, e.g. here.
  3. In a very common ReplayGain implementation (the only one I know actually, used basically everywhere, I think initially from mp3gain; one copy can be seen here), it also does it.

    This is esp. relevant because ReplayGain was calibrated by this implementation using a reference sound (a pink noise, can be downloaded here) which is in mono.

    In the ReplayGain specification, it is also calculated like this (see here).

My confusion raised after I tried to implement ReplayGain myself and I stumbled upon this.

So, some questions:

  1. Why does libswresample do this?
  2. Is this expected in libswresample or a bug? (I'm trying to understand from the source (e.g. here) but I haven't fully understood it all yet.)
  3. What is the "right" solution?
  4. What are other players doing?
  5. What is a common soundcard doing if you feed mono samples to it?
share|improve this question
Hi Albert, you have a few questions in here. You'd be better off separating them out as per the faq guidance in order to get good answers. – Dr Mayhem Oct 4 '12 at 7:29

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.