Update README.md
Browse files
README.md
CHANGED
@@ -8,4 +8,56 @@ tags:
|
|
8 |
- speech
|
9 |
- autoencoder
|
10 |
- diffusion
|
11 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
- speech
|
9 |
- autoencoder
|
10 |
- diffusion
|
11 |
+
---
|
12 |
+
|
13 |
+
# Music2Latent
|
14 |
+
Encode and decode audio samples to compressed representations! Useful for efficient generative modelling applications and for other downstream tasks.
|
15 |
+
|
16 |
+
![music2latent](music2latent.png)
|
17 |
+
|
18 |
+
Read the ISMIR 2024 paper [here](https://arxiv.org/).
|
19 |
+
|
20 |
+
Under the hood, __Music2Latent__ uses a __Consistency Autoencoder__ model to efficiently encode and decode audio samples.
|
21 |
+
44.1 kHz audio is encoded into a sequence of __~10 Hz__, and each of the latents has 64 channels.
|
22 |
+
You can then train a generative model on these embeddings, or use them for other downstream tasks.
|
23 |
+
|
24 |
+
Music2Latent was trained on __music__ and on __speech__. Refer to the [paper](https://arxiv.org/) for more details.
|
25 |
+
|
26 |
+
|
27 |
+
## Installation
|
28 |
+
|
29 |
+
```bash
|
30 |
+
pip install music2latent
|
31 |
+
```
|
32 |
+
The model weights will be downloaded automatically the first time you run the code.
|
33 |
+
|
34 |
+
|
35 |
+
## How to use
|
36 |
+
To encode and decode audio samples to/from latent embeddings:
|
37 |
+
```bash
|
38 |
+
audio_path = librosa.example('trumpet')
|
39 |
+
wv, sr = librosa.load(audio_path, sr=44100)
|
40 |
+
|
41 |
+
from music2latent2 import EncoderDecoder
|
42 |
+
encdec = EncoderDecoder()
|
43 |
+
|
44 |
+
latent = encdec.encode(wv)
|
45 |
+
|
46 |
+
wv_rec = encdec.decode(latent)
|
47 |
+
```
|
48 |
+
If you need to extract encoder features to use in downstream tasks, and you don't need to reconstruct the audio:
|
49 |
+
```bash
|
50 |
+
features = encoder.encode(wv, extract_features=True)
|
51 |
+
```
|
52 |
+
These features are extracted before the encoder bottleneck, and thus have more channels (contain more information) than the latents used for reconstruction.
|
53 |
+
|
54 |
+
music2latent2 supports more advanced usage, inclusing GPU memory management controls. Please refer to __tutorial.ipynb__.
|
55 |
+
|
56 |
+
|
57 |
+
## License
|
58 |
+
This library is released under the CC BY-NC 4.0 license. Please refer to the LICENSE file for more details.
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
This work was conducted by [Marco Pasini](https://twitter.com/marco_ppasini) during his PhD at Queen Mary University of London, in partnership with Sony Computer Science Laboratories Paris.
|
63 |
+
This work was supervised by Stefan Lattner and George Fazekas.
|