You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Polymath uses machine learning to convert any music library (*e.g from Hard-Drive or YouTube*) into a music production sample-library. The tool automatically separates songs into stems (*beats, bass, etc.*), quantizes them to the same tempo and beat-grid (*e.g. 120bpm*), analyzes musical structure (*e.g. verse, chorus, etc.*), key (*e.g C4, E3, etc.*) and other infos (*timbre, loudness, etc.*), and converts audio to midi. The result is a searchable sample library that streamlines the workflow for music producers, DJs, and ML audio developers.
3
+
Polymath uses machine learning to convert any music library (*e.g from Hard-Drive or YouTube*) into a music production sample-library. The tool automatically separates tracks into stems (_drums, bass, etc._), quantizes them to the same tempo and beat-grid (*e.g. 120bpm*), analyzes tempo, key (_e.g C4, E3, etc._) and other infos (*timbre, loudness, etc.*) and cuts loop out of them. The result is a searchable sample library that streamlines the workflow for music producers, DJs, and ML audio developers.
Polymath makes it effortless to combine elements from different songs to create unique new compositions: Simply grab a beat from a Funkadelic track, a bassline from a Tito Puente piece, and fitting horns from a Fela Kuti song, and seamlessly integrate them into your DAW in record time. Using Polymath's search capability to discover related tracks, it is a breeze to create a polished, hour-long mash-up DJ set. For ML developers, Polymath simplifies the process of creating a large music dataset, for training generative models, etc.
13
+
14
+
Polymath makes it effortless to combine elements from different tracks to create unique new compositions: Simply grab a beat from a Funkadelic track, a bassline from a Tito Puente piece, and fitting horns from a Fela Kuti song, and seamlessly integrate them into your DAW in record time. Using Polymath's search capability to discover related tracks, it is a breeze to create a polished, hour-long mash-up DJ set. For ML developers, Polymath simplifies the process of creating a large music dataset, for training generative models, etc.
10
15
11
16
## How does it work?
12
-
- Music Source Separation is performed with the [Demucs](https://github.com/facebookresearch/demucs) neural network
13
-
- Music Structure Segmentation/Labeling is performed with the [sf_segmenter](https://github.com/wayne391/sf_segmenter) neural network
14
-
- Music Pitch Tracking and Key Detection are performed with [Crepe](https://github.com/marl/crepe) neural network
15
-
- Music to MIDI transcription is performed with [Basic Pitch](https://github.com/spotify/basic-pitch) neural network
16
-
- Music Quantization and Alignment are performed with [pyrubberband](https://github.com/bmcfee/pyrubberband)
17
-
- Music Info retrieval and processing is performed with [librosa](https://github.com/librosa/librosa)
17
+
18
+
- Import tracks from youtube or directly from your google drive
19
+
- Process selected (or all) tracks with a configurable selection of nendo plugins:
20
+
- Apply the [classification plugin](https://github.com/okio-ai/nendo-plugin-classify-core) to compute _volume_, _tempo_ (bpm), _key_, _intensity_, _frequency_, and _loudness_ for each track
21
+
- Apply the [stemification plugin](https://github.com/okio-ai/nendo-plugin-stemify-demucs) to separate each track into four source signals: _vocals_, _drum_, _bass_, and _other_
22
+
- Apply the [quantization plugin](https://github.com/okio-ai/nendo-plugin-quantize-core) to quantize each track to a specified target _bpm_
23
+
- Apply the [loopification plugin](https://github.com/okio-ai/nendo-plugin-loopify) to automatically detect and extract loops from each sample
24
+
- Export the results of the processing with informative file names to your google drive in _wav_, _mp3_ or _ogg_ format.
18
25
19
26
## Community
20
27
21
28
Join the Polymath Community on [Discord](https://discord.gg/gaZMZKzScj)
22
29
23
30
## Requirements
24
31
25
-
You need to have the following software installed on your system:
32
+
**Polymath requires Python version 3.8, 3.9 or 3.10.**
33
+
34
+
> It is recommended to use a [virtual environment](https://docs.python.org/3/library/venv.html), in order to avoid dependency conflicts. You can use your favorite virtual environment management system, like [conda](https://docs.conda.io/en/latest/), [poetry](https://python-poetry.org/), or [pyenv](https://github.com/pyenv/pyenv) for example.
35
+
36
+
Furthermore, the following software packages need to be installed in your system:
> Windows support is currently under development. For the time being, we highly recommend using [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) and then following the linux instructions.
28
43
29
44
## Installation
30
45
31
-
You need python version `>=3.7` and `<=3.10`. From your terminal run:
46
+
You need python version `>=3.8` and `<=3.10`. From your terminal run:
The last line is a fix that's needed to avoid a dependency conflict among the plugins.
42
57
43
58
## GPU support
44
59
@@ -54,114 +69,119 @@ docker build -t polymath ./
54
69
55
70
In order to exchange input and output files between your hosts system and the polymath docker container, you need to create the following four directories:
56
71
57
-
-`./input`
58
-
-`./library`
59
-
-`./processed`
60
-
-`./separated`
72
+
-`./polymath_input`
73
+
-`./polymath_library`
74
+
-`./polymath_output`
75
+
-`./models`
76
+
77
+
E.g. run `mkdir -p ./polymath_input ./polymath_library ./polymath_output ./models`.
61
78
62
-
Now put any files you want to process with polymath into the `input` folder.
79
+
Now put any files you want to process with polymath into the `polymath_input` folder.
63
80
Then you can run polymath through docker by using the `docker run` command and pass any arguments that you would originally pass to the python command, e.g. if you are in a linux OS call:
64
81
65
82
```bash
66
83
docker run \
67
-
-v "$(pwd)"/processed:/polymath/processed \
68
-
-v "$(pwd)"/separated:/polymath/separated \
69
-
-v "$(pwd)"/library:/polymath/library \
70
-
-v "$(pwd)"/input:/polymath/input \
71
-
polymath python /polymath/polymath.py -a ./input/song1.wav
To print the help for the python command line arguments:
95
+
96
+
```bash
97
+
python polymath.py -h
98
+
```
99
+
100
+
### 1. Add tracks to the Polymath Library
77
101
78
102
##### Add YouTube video to library (auto-download)
103
+
79
104
```bash
80
-
python polymath.py -a n6DAqMFe97E
105
+
python polymath.py -i n6DAqMFe97E
81
106
```
107
+
82
108
##### Add audio file (wav or mp3)
109
+
83
110
```bash
84
-
python polymath.py -a /path/to/audiolib/song.wav
111
+
python polymath.py -i /path/to/audiolib/song.wav
85
112
```
113
+
86
114
##### Add multiple files at once
87
-
```bash
88
-
python polymath.py -a n6DAqMFe97E,eaPzCHEQExs,RijB8wnJCN0
89
-
python polymath.py -a /path/to/audiolib/song1.wav,/path/to/audiolib/song2.wav
90
-
python polymath.py -a /path/to/audiolib/
91
-
```
92
-
Songs are automatically analyzed once which takes some time. Once in the database, they can be access rapidly. The database is stored in the folder "/library/database.p". To reset everything, simply delete it.
93
115
94
-
### 2. Quantize songs in the Polymath Library
95
-
##### Quantize a specific songs in the library to tempo 120 BPM (-q = database audio file ID, -t = tempo in BPM)
96
-
```bash
97
-
python polymath.py -q n6DAqMFe97E -t 120
98
-
```
99
-
##### Quantize all songs in the library to tempo 120 BPM
##### Quantize a specific songs in the library to the tempo of the song (-k)
104
-
```bash
105
-
python polymath.py -q n6DAqMFe97E -k
106
-
```
107
-
Songs are automatically quantized to the same tempo and beat-grid and saved to the folder “/processed”.
108
123
109
-
### 3. Search for similar songs in the Polymath Library
110
-
##### Search for 10 similar songs based on a specific songs in the library (-s = database audio file ID, -sa = results amount)
124
+
Once in the database, they can be searched through, processed and exported. The database is stored by default in the folder "./polymath_library". To change the library folder use the `--library_path` console argument. To reset everything, simply delete that directory.
125
+
126
+
### 2. Quantize tracks in the Polymath Library
127
+
128
+
##### Find a specific song in the library and quantize it to tempo 120 BPM (-f = find ID in library, -q = quantize to tempo in BPM)
129
+
111
130
```bash
112
-
python polymath.py -s n6DAqMFe97E -sa 10
131
+
python polymath.py -f n6DAqMFe97E -q 120
113
132
```
114
-
##### Search for similar songs based on a specific songs in the library and quantize all of them to tempo 120 BPM
133
+
134
+
##### Quantize all tracks in the library to tempo 120 BPM
135
+
115
136
```bash
116
-
python polymath.py -s n6DAqMFe97E -sa 10 -q all -t 120
137
+
python polymath.py -q 120
117
138
```
118
-
##### Include BPM as search criteria (-st)
139
+
140
+
### 3. Search for specific tracks in the Polymath Library
141
+
142
+
##### Find tracks with specific search keys in the library and export them
Similar songs are automatically found and optionally quantized and saved to the folder "/processed". This makes it easy to create for example an hour long mix of songs that perfectly match one after the other.
123
147
124
-
### 4. Convert Audio to MIDI
125
-
##### Convert all processed audio files and stems to MIDI (-m)
148
+
The default export directory is `./polymath_output`. To specify a different directory, use the `-o /path/to/my/output/dir` flag.
149
+
150
+
##### Find tracks in specific BPM range as search criteria (-bmin and -bmax) and also export loops (-fl)
151
+
126
152
```bash
127
-
python polymath.py -a n6DAqMFe97E -q all -t 120 -m
153
+
python polymath.py -bmin 80 -bmax 100 -fl -e
128
154
```
129
-
Generated Midi Files are currently always 120BPM and need to be time adjusted in your DAW. This will be resolved [soon](https://github.com/spotify/basic-pitch/issues/40). The current Audio2Midi model gives mixed results with drums/percussion. This will be resolved with additional audio2midi model options in the future.
130
-
131
155
132
156
## Audio Features
133
157
134
158
### Extracted Stems
135
-
The Demucs Neural Net has settings that can be adjusted in the python file
159
+
160
+
Stems are extracted with the [nendo stemify plugin](https://github.com/okio-ai/nendo_plugin_stemify_demucs/). Extracted stem types are:
161
+
136
162
```bash
137
163
- bass
138
164
- drum
139
-
- guitare
140
-
- other
141
-
- piano
142
165
- vocals
166
+
- other
143
167
```
168
+
144
169
### Extracted Features
145
-
The audio feature extractors have settings that can be adjusted in the python file
170
+
171
+
Music Information Retrieval features are computed using the [nendo classify plugin](https://github.com/okio-ai/nendo_plugin_classify_core/). Extracted features are:
172
+
146
173
```bash
147
174
- tempo
148
175
- duration
149
-
- timbre
150
-
- timbre_frames
151
-
- pitch
152
-
- pitch_frames
153
176
- intensity
154
-
- intensity_frames
155
-
- volume
156
177
- avg_volume
157
178
- loudness
158
-
- beats
159
-
- segments_boundaries
160
-
- segments_labels
161
-
- frequency_frames
162
179
- frequency
163
180
- key
164
181
```
165
182
166
183
## License
184
+
167
185
Polymath is released under the MIT license as found in the [LICENSE](https://github.com/samim23/polymath/blob/main/LICENSE) file.
186
+
187
+
As for [nendo core](https://github.com/okio-ai/nendo) and the [plugins used in polymath](#how-does-it-work), see their respective repositories for information about their license.
0 commit comments