SndWriter
- class sndfileio.SndWriter(sr, outfile, encoding, fileformat='', bitrate=0, backend=None, metadata=None)[source]
Bases:
objectClass returned by
sndwrite_chunked()to write samples- Parameters:
backend – the Backend instance which created this SndWriter
sr (int) – the samplerate
outfile (str) – the file to wite
encoding (str) – the encoding of the file (pcmXX, floatXX, where XX represents the bits per sample)
fileformat – the fileformat, only needed if the format indicated by the extension in outfile should be overridden
metadata (dict[str, str] | None) – a dict
{str: str}.
Metadata Possible Keys:
title
comment
artist
album
tracknumber
software
Example
>>> from sndfileio import * >>> writer = sndwrite_chunked("out.flac", 44100) # writer is a SndWriter >>> for buf in sndread_chunked("in.flac"): ... # do some processing, like changing the gain ... buf *= 0.5 ... writer.write(buf)
Attributes Summary
Methods Summary
__call__(frames)Write the given sample data.
close()Explicitely close this file
write(frames)Write the given sample data.
Attributes Documentation
- filetypes
Methods Documentation