moviepy.audio.io.AudioFileClip.AudioFileClip#
- class moviepy.audio.io.AudioFileClip.AudioFileClip(filename, decode_file=False, buffersize=200000, nbytes=2, fps=44100)[source]#
An audio clip read from a sound file, or an array. The whole file is not loaded in memory. Instead, only a portion is read and stored in memory. this portion includes frames before and after the last frames read, so that it is fast to read the sound backward and forward.
- Parameters:
filename – Either a soundfile name (of any extension supported by ffmpeg) as a string or a path-like object, or an array representing a sound. If the soundfile is not a .wav, it will be converted to .wav first, using the
fps
andbitrate
arguments.buffersize – Size to load in memory (in number of frames)
- nbytes#
Number of bits per frame of the original audio file.
- fps#
Number of frames per second in the audio file
- buffersize#
See Parameters.
- Lifetime#
- --------
- Note that this creates subprocesses and locks files. If you construct one
- of these instances, you must call close() afterwards, or the subresources
- will not be cleaned up until the process ends.
Examples
snd = AudioFileClip("song.wav") snd.close()