SndWriter
- class sndfileio.SndWriter(sr, outfile, encoding, fileformat=None, bitrate=0, backend=None, metadata=None)[source]
Bases:
object
Class returned by
sndwrite_chunked()
to write samples- Parameters:
backend – the Backend instance which created this SndWriter
sr (
int
) – the samplerateoutfile (
str
) – the file to witeencoding (
str
) – the encoding of the file (pcmXX, floatXX, where XX represents the bits per sample)fileformat (
Optional
[str
]) – the fileformat, only needed if the format indicated by the extension in outfile should be overriddenmetadata (
Optional
[dict
[str
,str
]]) – 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