aus.audiofile¶
- class AudioFile¶
- __init__(self, **kwargs)¶
Initializes an
AudioFileobject. You can pass the following keyword parameters to this method (from https://ccrma.stanford.edu/courses/422-winter-2014/projects/WaveFormat/):audio_format: The audio format (should generally be 1)bits_per_sample: The number of bits per sample (often 8, 16, 24, or 32)block_align: The block align setting (size in bytes of one frame of audio, including all channels)byte_rate: Number of bytes per secondbytes_per_sample: The number of bytes per sample (corresponding tobits_per_sample)duration: The duration in secondsfile_name: The full path of the file_namenum_channels: The number of channelsframes: The number of framessample_rate: The sample byte_rate
- convert(file: AudioFile, format: str)¶
Converts an AudioFile from one sample format to another. Use this to change between int and float format, or to change bit depth (e.g. 16 to 24 bit). Supported conversion types:
'int16','int24','int32','float32','float64'- Parameters:
file (AudioFile) – An
AudioFileformat (str) – The destination format
- find_files(directory_name: str)¶
Finds all WAV and AIFF files within a directory and its subdirectories
- Parameters:
directory_name (str) – The directory name
- Returns:
A list of file names
- Return type:
list
- read(file_name: str, target_sample_rate: int)¶
Reads an audio file (AIFF or WAV) and returns an
AudioFileobject containing the contents of the file. It uses thepedalboardlibrary for speed.- Parameters:
file_name (str) – The name of the file
target_sample_rate – The target sample rate of the audio
- Returns:
An AudioFile
- Return type: