Update README.md

This commit is contained in:
Etienne Gaudrain 2025-03-28 12:16:58 +01:00
parent b654d7f770
commit a86bd55b86

View File

@ -2,6 +2,24 @@
A thin wrapper around the `soundfile` module to allow saving files of any scales.
It is made so you can use it as an in-place replacement for `soundfile` if you only used the `read` and `write` functions.
```python
import soundfile as sf
sf.write("toto.wav", x, fs)
x, fs = sf.read("toto.wav")
```
is replaced with
```python
import scaled_soundfile as sf
sf.write("toto.wav", x, fs)
x, fs = sf.read("toto.wav")
```
The `write` function rescales the input to normalize it and maximize the number of bits it is saved on. The RMS of the original sound is saved in the 'comment' metadata field as part of a JSON object. The files are saved as 'PCM_24'.
The `read` function loads the normalized data, and rescales it so that the RMS matches the original by reading the 'comment' metadata field if it exists.