write
write(
self ,
spool: BaseSpool ,
resource: str | pathlib.Path[str, Path] ,
resample_frequency = None,
**kwargs ,
)
Write the contents of the patch to one or more wav files.
Parameters
Parameter | Description |
---|---|
resource |
If a path that ends with .wav, write all the distance channels to a single file. If not, assume the path is a directory and write each distance channel to its own wav file. |
resample_frequency |
A resample frequency in Hz. If None, do not perform resampling. Often DAS has non-int sampling rates, so the default resampling rate is usually safe. |
The sampling rate in the wav format must be an int, so the patch’s sampling rate is cast to an integer before writing wav file. This may cause some distortion (but it isn’t likely to be noticeable).
The array data type is converted to np.float32 before writing. This requires values to be between (-1, 1) so the data are detrended and normalized before writing.
If a single wavefile is specified with the path argument, and the output the patch has more than one len along the distance dimension, a multi-channel wavefile is created. There may be some players that do not support multi-channel wavefiles.
If using VLC, often it won’t play the file unless the sampling rate is 44100, in this case just set resample_frequency=44100 to see if this fixes the issue.