[Flac-dev] Legal sample rates

Josh Coalson xflac at yahoo.com
Thu Nov 11 13:33:42 PST 2004


--- Erik de Castro Lopo <erikd-flac at mega-nerd.com> wrote:
> On Wed, 10 Nov 2004 16:08:21 -0800 (PST)
> Josh Coalson <xflac at yahoo.com> wrote:
> 
> > > Is there someway of figuring out if a sample rate is valid?
> > 
> > that's the right way.
> 
> But it doesn't tell me that the sample rate is invalid it tells
> me FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR or
> FLAC__STREAM_ENCODER_NOT_STREAMABLE.

oh, I meant FLAC__format_sample_rate_is_valid() is the right way
to check.

> > the reason it's being rejected is the encoder is configured to
> > obey the subset:
> > 
> > http://flac.sourceforge.net/format.html#subset
> > 
> > to encode 11.025 kHz you need to call
> > FLAC__seekable_stream_encoder_set_streamable_subset()
> 
> OK, from reading the documentation, FLAC is limited to 8 channels
> and sample rates other than 11025. However, if I try to create a 
> file with too many channels I get an error of
> 
>    FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS
> 
> which is fine. If I try to create a file at a sample rate of
> 11025 I get an error of 
> 
>     FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR or
>     FLAC__STREAM_ENCODER_NOT_STREAMABLE
> 
> which says nothing about the sample rate.

11025 is a valid sample rate, but 9 channels is not a valid
# of channels.

the FLAC__STREAM_ENCODER_NOT_STREAMABLE error means you are
violating the "set streamable subset" setting that is in effect.

I guess FLAC__STREAM_ENCODER_NOT_STREAMABLE could be expanded
to FLAC__STREAM_ENCODER_NOT_STREAMABLE_BAD_SAMPLE_RATE,
FLAC__STREAM_ENCODER_NOT_STREAMABLE_BAD_BITS_PER_SAMPLE etc
but it doesn't seem worth changing the API for.

Josh



		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 



More information about the Flac-dev mailing list