0

I have a sound source fed into a GStreamer pipeline for conversion into a more suitable format. The sources are varied but at the end of the pipeline I must have Signed 16-bit PCM (Mono) at 48Khz.

The audio source at the begining of the pipeline is 32bit floating point samples at whatever rate the source sees fit (a result of using the playbin element) with 1 or more channels (usually stereo but could be more) so the pipeline as of now does the following in this order:

  • Downmix to mono (fp 32)
  • Resample (fp 32; [anything] -> 48Khz)
  • Conversion (fp32 -> s16)

Doing the conversion first saves me some significant CPU load since all the remaining conversions are done mostly in integers but I am unsure if there would be any noticeable artifacts under some circumstances.

3

I think the way you currently have the pipeline set-up is the right way to do it. Conversion should be the last block in the chain for sure as this will ensure that any processing artifacts are minimised during down-mix and resampling.

Performing conversion at the start may provide some small CPU benefits, but has the possibility of introducing artifacts which may be undesirable.

If you are using Floating Point optimised code and processor instructions you will not have to worry too much about CPU load by having the conversion at the end.

I would also recommend adding dither prior to conversion and truncation.

  • Can you point me to some doc related to adding dither and when is it needed? It is possible the resample element already does it right now, i should check (Edit: It does. 'TPDF' by default, 'RPDF' or 'None' available too). – NeonMan Jan 9 at 14:17
  • Dither is usually employed during a bit-truncation process, for instance when you are truncating your word-length from 24-bits to 16-bits for delivery. IMHO It's always needed if you are reducing your word-length. Here's an article on dither: darkroommastering.com/blog/dithering-explained – Mark Jan 9 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.