Hi Jean-Marc, On Jun 15, 2013, at 2:23 AMEDT, Jean-Marc Valin wrote:>> I'm looking at how to run Opus at 44.1K. I have flexibility in the >> frame sizes of the unencoded audio, and packet sizes on the RF link. > > You should probably consider resampling. It's not that expensive and it > would make things easy. But otherwise, see below.Yes, considering your and Ben's remarks, I'm considering this. I saw the 'tools is using the speex resampler, I'll look at it.> > On 06/14/2013 06:23 PM, Marc Lindahl wrote: >> So, I was digging through the code, and I didn't see any attempt to >> measure in realtime the actual audio rate (makes sense, since this >> codec can work offline too). > > What do you mean by "measure in realtime the actual audio rate"?Meaning using the CPU clock via time() to calculate the realtime data rate. Nevermind, it's a red herring.> >> Opus_custom seems to be needed if you have a certain frame size >> constraint with low latency. I don't have that. I can use the >> stock frame sizes ( 120, 240, 480, 960, 1920, and 2880 >> sample/frame). >> >> My conclusion is that I could set up Opus for 48K (stereo), and in >> reality run it at 44.1K, as long as I use stock frame sizes, and it >> would be fine. > > Do not do that, ever. Everything is calibrated for 48 kHz and you will > likely cause audible noise.How would it cause audible noise, I don't understand that part? After all the frequency calculations are off by 8%, that's not too extreme...> Besides, running at the wrong rates means > you lose all compatibility anyway, so you might as well use the custom > modes.Except, based on Ben's previous comments, possibly the quality isn't as good?> Using custom modes means you would probably want to choose a > frame size that's a power of two and save a few extra cycles (maybe even > reuse a platform-specific power-of-two FFT).That's interesting? there isn't anything in the compression (estimators, etc.) or FEC that really 'likes' multiples of 120 samples?> >> The only issue I can think of is any of the perceptual stuff will be >> off by -8%, e.g. crossover/mask frequencies, etc. Or is that true? >> And with Opus_custom is all that stuff recalculated? > > Yes, custom modes properly adjust all the psychoacoustics to the exact > sampling rate.Got it.> >> If I do need to go to opus_custom, it seems that it's still best to >> use the stock frame sizes, true? > > There is no "stock frame size" with Opus custom. Modes are generated on > the fly (or you can always pre-generate them) with any frame size. The > frame size is that it can't have prime factors above 5, but that's about > the only constraint.What I meant was, 120, 240, 480, 960, 1920, or 2880 samples, the sizes imposed in the normal mode. So I still wonder, if you set up a custom mode, but then had all the settings the same as a normal mode, would the codec perform worse, or the same? Thanks for your thoughtful replies. Best, Marc
Jean-Marc Valin
2013-Jun-15 16:20 UTC
[opus] running at 44.1K but with standard frame sizes
On 06/15/2013 12:00 PM, Marc Lindahl wrote:>> Do not do that, ever. Everything is calibrated for 48 kHz and you >> will likely cause audible noise. > > How would it cause audible noise, I don't understand that part? > After all the frequency calculations are off by 8%, that's not too > extreme...Well, the encoder is designed to follow the ear's response and shifting everything by 8% will be sub-optimal. It'll still work, but you'll need a higher bitrate to achieve the same quality.>> Besides, running at the wrong rates means you lose all >> compatibility anyway, so you might as well use the custom modes. > > Except, based on Ben's previous comments, possibly the quality isn't > as good?The quality of custom modes may not be nearly as good as the standard case, but better than using 44.1 kHz and pretending it's 48 kHz.> That's interesting? there isn't anything in the compression > (estimators, etc.) or FEC that really 'likes' multiples of 120 > samples?We use multiples of 120 at 48 kHz because it matches common frame sizes (10 ms, 20 ms, ...) that people use in VoIP. There's nothing special about these values otherwise.>> There is no "stock frame size" with Opus custom. Modes are >> generated on the fly (or you can always pre-generate them) with any >> frame size. The frame size is that it can't have prime factors >> above 5, but that's about the only constraint. > > What I meant was, 120, 240, 480, 960, 1920, or 2880 samples, the > sizes imposed in the normal mode.Well, if you're not running at 48 kHz, there's no point in using these non-power-of-two sizes (i.e. it doesn't give you 20 ms anyway).> So I still wonder, if you set up a custom mode, but then had all the > settings the same as a normal mode, would the codec perform worse, or > the same?You'll have to try normal vs custom modes and choose. The only thing I'm telling you is don't run a 48 kHz encoder at 44.1 kHz. Cheers, Jean-Marc
Hi Jean-Marc, On Jun 15, 2013, at 12:20 PMEDT, Jean-Marc Valin wrote:> > >> So I still wonder, if you set up a custom mode, but then had all the >> settings the same as a normal mode, would the codec perform worse, or >> the same? > > You'll have to try normal vs custom modes and choose. The only thing I'm > telling you is don't run a 48 kHz encoder at 44.1 kHz.Of course, I'm setting up a bunch of tests to evaluate these, what I was asking was more along the lines of, If you set up the same exact, including the sample rate, do you get the same results (e.g. same code path, calculations, etc.?) I'm trying to understand if there's something especially deficient about the custom modes, or whether it's simply normal tradeoffs of frame size vs. ability to compress, etc. etc. Thanks! Marc