sndget
- sndfileio.sndget(path, start=0, end=0)[source]
Read a soundfile and its metadata
- Parameters:
path (
str
) – the path to readstart (
float
) – the time to start readingend (
float
) – the time to end reading (0=until the end)
- Return type:
tuple
[ndarray
,SndInfo
]- Returns:
a tuple (samples – np.ndarray,
SndInfo
)
Example
# Normalize and save as flac, keeping the metadata from sndfileio import * samples, info = sndget("in.wav") maxvalue = max(samples.max(), -samples.min()) samples *= 1/maxvalue sndwrite("out.flac", samples, info.samplerate, metadata=info.metadata)