Menu

#66 struct mpg123_frameinfo: long rate

closed-rejected
nobody
None
5
2022-06-15
2022-06-15
fred vs
No

Hello.

In mpg123_frameinfo, the rate is defined as "long" (integer).

OK, but for other libraries, like PortAudio, the samplerate is defined as double (float).

I agree it should be rare to use a samplerate with decimals, but in case of...

Discussion

  • Thomas Orgis

    Thomas Orgis - 2022-06-15

    That doesn't make sense. Fractional rates at all could be considered for extremely low-frequency signals, but for anything audible … why?! Apart from that, I don't know of audio hardware accepting fractional rates. Of course, arbitrary resampling could use them. But even in my resampler in libsyn123 (which mpg123 uses at times), I took pains to keep the rates integer and have reproducible computations without rounding issues in the timebase (sample values themselves in float, though).

    But anyhow, this general discussion is pointless for mpg123: The value in the frameinfo represents what the MPEG stream has stored, and there are no floating-point sampling rates in the MPEG audio standard.

    Just use the long value in portaudio API, to be cast to double. It doesn't hurt and just works the same.

     
  • Thomas Orgis

    Thomas Orgis - 2022-06-15
    • status: open --> closed-rejected
     

Log in to post a comment.

MongoDB Logo MongoDB