I'm using Opus for a networked ham radio communications receiver. Kudos on the whole project; it sounds excellent even at low bit rates and the API was surprisingly simple and easy to use. And god knows the world needs a really good, general purpose, non-proprietary codec. One question, though. Depending on the mode my receiver can generate mono or stereo. Most operating modes are mono, but a few such as ISB (Independent Sideband AM) are stereo. To simplify the design I followed the API's recommendation to always feed the encoder a 48 kHz stereo stream and let Opus sort it out. This works well, but then I noticed the SET_FORCE_CHANNELS option. Is there any advantage to my detecting identical left and right channels and setting this to force mono? Or does the Opus encoder already do this internally in the AUTO mode? When I force mono the decoder's indicated channel count changes from 2 to 1 as expected, but I can't tell if there's any benefit in increased fidelity and/or lower average bit rate vs just leaving the option to AUTO. My typical channel bit rate is 16-32 kb/s and the input audio is usually low pass filtered to maybe 3-5 kHz. Because most operating modes are mono, efficiency in that mode is important. Thanks, Phil
Timothy B. Terriberry
2017-Oct-23 02:19 UTC
[opus] advantage of OPUS_SET_FORCE_CHANNELS(1)?
Phil Karn wrote:> This works well, but then I noticed the SET_FORCE_CHANNELS option. Is > there any advantage to my detecting identical left and right channels > and setting this to force mono? Or does the Opus encoder already do this > internally in the AUTO mode?No, the automatic setting should be fine. The purpose of this setting is for the case where you know the receiver will only use a mono decoding path. This is common in some VoIP applications. It lets you avoid coding a stereo signal even when you have stereo input, e.g., because you know through out-of-band means that the receiver will discard the stereo image anyway.
On 10/22/17 19:19, Timothy B. Terriberry wrote:> Phil Karn wrote: >> This works well, but then I noticed the SET_FORCE_CHANNELS option. Is >> there any advantage to my detecting identical left and right channels >> and setting this to force mono? Or does the Opus encoder already do this >> internally in the AUTO mode? > > No, the automatic setting should be fine. The purpose of this setting is > for the case where you know the receiver will only use a mono decoding > path. This is common in some VoIP applications. It lets you avoid coding > a stereo signal even when you have stereo input, e.g., because you know > through out-of-band means that the receiver will discard the stereo > image anyway.Got it, thanks. So I guess I can strip out my experimental code that compares samples and forces mono when pairs of samples are identical, and the only effect will be that my decoder tool will indicate stereo when the sound is actually mono. Again, I'm *very* pleasantly surprised at how exceptionally well this codec works even at low bit rates and in what I'd think would be weird corner cases. E.g., single sideband is inherently mono, but if you select "stereo" reception in my receiver the right channel will be the Hilbert transform of the left channel. This produces an interesting subjective pseudo-stereo effect in headphones, which the Opus codec seems to preserve quite nicely even at low bit rates. I find it can relieve some of the auditory fatigue that can come with listening to a mono signal boring a hole in the center of your brain for a long time, e.g., during a ham radio contest. And the price is certainly right. Thanks again! Phil