Where are the sample sound files located max
export( "/path/to/output.mp3", format = "mp3") from_file( "/path/to/sound.wav", format = "wav") Write the AudioSegment object to a file – returns a file handle of the output file (you don't have to do anything with it, though).įrom pydub import AudioSegment sound = AudioSegment. duration | example: 2.5 | default: None.If None, the audio will start loading from the beginning. Offset (in seconds) to start loading the audio file.
start_second | example: 2.0 | default: None.frame_rate | example: 2 raw only - Also known as sample rate, common values are 44100 (44.1kHz - CD audio), and 48000 (48kHz - DVD audio).channels | example: 1 raw only - 1 for mono, 2 for stereo.sample_width | example: 2 raw only - Use 1 for 8-bit audio 2 for 16-bit (CD quality) and 4 for 32-bit.
This extra info is required because raw audio files do not have headers to include this info in the file itself like wav files do. "raw" files require 3 additional keyword arguments, sample_width, frame_rate, and channels, denoted below with: raw only. Supports "wav" and "raw" natively, requires ffmpeg for all other formats.