mp3write

sndfileio.mp3write(outfile, samples, sr, bitrate=224, quality=3)[source]

Write all samples to outfile as mp3

This is the same as:

sndwrite(outfile, samples, sr, bitrate=224, quality=3)

But in this case the arguments are explictely listed instead of being part of **options

Parameters:
  • outfile (str) – the outfile to write to

  • samples (ndarray) – the samples to write (float samples in the range -1:1). They will be converted to int16 so any values outside the given range will clip

  • sr (int) – the samplerate

  • bitrate – the bitrate to use, in Kb/s

  • quality – the quality, a value between 1-7 (where 1 is highest and 7 is fastest)

Return type:

None

Note

To write samples in chunks use sndwrite_chunked. bitrate and quality can be passed as **options.