babycat.exceptions¶
Contains all built-in exceptions raised by Babycat.
However, Babycat does raise a few exceptions that are not included
in this module, such as like FileNotFoundError
.
- exception FeatureNotCompiled¶
Bases:
babycat.exceptions.BabycatError
Raised when you are trying to use a feature that wasn’t included at compile-time.
- exception WrongTimeOffset¶
Bases:
babycat.exceptions.BabycatError
Raised when
start_time_milliseconds
and/orend_time_milliseconds
is invalid.For example, this exception is raised if you specify an
end_time_milliseconds
that would actually be before thestart_time_milliseconds
.
- exception WrongNumChannels¶
Bases:
babycat.exceptions.BabycatError
Raised when you want more channels than the audio has.
For example, if you passed
num_channels = 3
as a decoding argument, but the audio file only has two channels, then we’ll raise this exception.
- exception WrongNumChannelsAndMono¶
Bases:
babycat.exceptions.WrongNumChannels
Raised when the user sets both
convert_to_mono = True
andnum_channels = 1
.The
num_channels
flag is used to select the first channel in a (potentially) multi-channel audio file. theconvert_to_mono
flag takes all selected channels and flattens them into a mono channel. It is redundant to setnum_channels = 1
and alsoconvert_to_mono = True
.
- exception CannotZeroPadWithoutSpecifiedLength¶
Bases:
babycat.exceptions.BabycatError
Raised when
zero_pad_ending
is set without settingend_time_milliseconds
.The
zero_pad_ending
argument is used to pad the ending of an audio waveform with zeros if the audio file runs out of audio from offsetsstart_time_milliseconds
toend_time_milliseconds
.If you have not set an
end_time_milliseconds
, then Babycat will return all of the audio fromstart_time_milliseconds
to the end of the audio file. In this context,zero_pad_ending = True
is not meaningful.
- exception CannotRepeatPadWithoutSpecifiedLength¶
Bases:
babycat.exceptions.BabycatError
Raised when
repeat_pad_ending
is set without settingend_time_milliseconds
.If you have not set an
end_time_milliseconds
, then Babycat will return all of the audio fromstart_time_milliseconds
to the end of the audio file. In this context,repeat_pad_ending = True
is not meaningful.
- exception CannotSetZeroPadEndingAndRepeatPadEnding¶
Bases:
babycat.exceptions.BabycatError
Raised if you try to set both
zero_pad_ending
andrepeat_pad_ending
asTrue
.
- exception UnknownInputEncoding¶
Bases:
babycat.exceptions.BabycatError
Raised when we failed to detect valid audio in the input data.
- exception UnknownDecodeError¶
Bases:
babycat.exceptions.BabycatError
Raised when we failed to decode the input audio stream, but we don’t know why.
- exception UnknownEncodeError¶
Bases:
babycat.exceptions.BabycatError
Raised when we failed to encode an audio stream into an output format.
- exception ResamplingError¶
Bases:
babycat.exceptions.BabycatError
Raised when we failed to resample the waveform.
- exception WrongFrameRate¶
Bases:
babycat.exceptions.BabycatError
Raised when the user set
frame_rate_hz
to a value that we cannot resample to.
- exception WrongFrameRateRatio¶
Bases:
babycat.exceptions.WrongFrameRate
Raised when
frame_rate_hz
would upsample or downsample by a factor>= 256
.The ratio between
frame_rate_hz
and the audio’s original frame rate has to be less than 256–in both cases whereframe_rate_hz
is less than the audio’s frame rate (downsampling) or greater than the audio’s frame rate (upsampling).
- exception SourceError¶
Bases:
babycat.exceptions.BabycatError
Raised during input validation of source transforms.
- exception CannotAppendSourcesWithDifferentNumChannels¶
Bases:
babycat.exceptions.SourceError
Raised when we try to concatenate two audio sources with a different number of channels.
- exception CannotAppendSourcesWithDifferentFrameRates¶
Bases:
babycat.exceptions.SourceError
Raised when we try to concatenate two audio sources with different frame rates.