Skip to content
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

Commit b0dfa37

Browse files
Merge branch 'lite-arch' into vs-dev
2 parents c10d4d0 + f7d2828 commit b0dfa37

File tree

24 files changed

+1246
-1682
lines changed

24 files changed

+1246
-1682
lines changed

Readme.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Structure
22

33
- iipyper: python package for easy MIDI, OSC, event loops
4-
- notepredictor: python package for defining+training pytorch RNN models
4+
- notochord: python package for defining+training pytorch RNN models
55
- notebooks: jupyter notebooks
66
- scripts: helper scripts for training, data preprocessing etc
77
- examples:
88
- iipyper: basic usage for iipyper
9-
- notepredictor: interactive MIDI apps with notepredictor and SuperCollider
9+
- notochord: interactive MIDI apps with notochord and SuperCollider
1010
- bela: [Bela](https://bela.io) examples in C++, Pure Data and so on
1111
- faust: [Faust](https://faustdoc.grame.fr/) examples
1212
- tidalcycles [TidalCycles](https://tidalcycles.org) examples
@@ -18,23 +18,23 @@
1818
```
1919
conda env create -f environment.yml
2020
conda activate iil-python-tools
21-
pip install -e notepredictor
21+
pip install -e notochord
2222
pip install -e iipyper
2323
```
2424

25-
# notepredictor
25+
# notochord
2626
## Train a model
2727
```
28-
python scripts/lakh_prep.py --data_path /path/to/midi/files --dest_path /path/to/data/storage
29-
python scripts/train_notes.py --data_dir /path/to/data/storage --log_dir /path/for/tensorboard logs --model_dir /path/for/checkpoints train
28+
python notochord/scripts/lakh_prep.py --data_path /path/to/midi/files --dest_path /path/to/data/storage
29+
python notochord/train.py --data_dir /path/to/data/storage --log_dir /path/for/tensorboard logs --model_dir /path/for/checkpoints train
3030
```
3131

3232
## Run OSC app
3333

3434
```
35-
python examples/notepredictor/server.py --checkpoint /path/to/my/model.ckpt
35+
python examples/notochord/server.py --checkpoint /path/to/my/model.ckpt
3636
```
37-
step through `examples/notepredictor/generate.scd` in SuperCollider IDE
37+
step through `examples/notochord/generate.scd` in SuperCollider IDE
3838

3939
# Develop
4040

environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ channels:
55
- conda-forge
66
dependencies:
77
- python=3.9
8-
- pytorch>=1.10
8+
- pytorch=1.11
99
- torchaudio
1010
- onnx
1111
- tensorboard
@@ -17,5 +17,6 @@ dependencies:
1717
- pip
1818
- pip:
1919
- mido
20+
- pretty-midi
2021
- python-rtmidi
2122
- python-osc

examples/bela/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Unless otherwise stated, these examples assume a set up of a Bela device connect
88
- `cpp-osc-resonator`: controlling a resonant filter
99
- `cpp-osc-resonators`: controlling a bank of resonant filters
1010
- `cpp-osc-gui-sliders`: Bela GUI with sliders controlled by `iipyper`
11-
- `cpp-osc-notepredictor-trill`: using Trill sensors to control `iipyper` `notepredictor` parameters
11+
- `cpp-osc-notochord-trill`: using Trill sensors to control `iipyper` `notochord` parameters
1212

1313
## Pure Data
1414
- `osc-receive`: receive OSC from `iipyper`

examples/notepredictor/generate.scd

Lines changed: 0 additions & 201 deletions
This file was deleted.

examples/notochord/analysis.scd

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
(
2+
Server.default.options.numInputBusChannels = 8;
3+
s.boot;
4+
)
5+
6+
(
7+
SynthDef(\analyzer, {
8+
arg in=0, threshold=0.1, relaxtime=0.05;
9+
var onset1, s1, lv1;
10+
var sdel = 0.04; // this is a small delay to skip the first chaotic miliseconds
11+
12+
var sound_in = HPF.ar(SoundIn.ar(in), 30);
13+
14+
var amp = WAmp.kr(sound_in, sdel);
15+
16+
var f0 = Pitch.kr(sound_in, 300,
17+
ampThreshold:0.001, peakThreshold:0.5, minFreq:30, maxFreq:8000, median:5
18+
)[0];
19+
20+
var onsets = Onsets.kr(FFT(LocalBuf(2048), sound_in, wintype:1), threshold, \wphase,//\rcomplex,
21+
relaxtime:relaxtime, floor:0.1, mingap:1, medianspan:11, whtype:1, rawodf:0);
22+
23+
var delay_onsets = DelayN.kr(onsets, sdel, sdel);
24+
25+
// onsets.poll(5);
26+
27+
SendReply.kr(delay_onsets, '/analysis', [amp, f0]);
28+
}).add;
29+
)
30+
31+
(
32+
~analyzer!?(_.free);
33+
~analyzer = Synth(\analyzer, [\in, 6, \threshold, 0.1]);
34+
)
35+
36+
(
37+
~clear_pending_events.();
38+
b.sendMsg("/predictor/reset");
39+
~release_all.(0);
40+
~allow_end = false;
41+
~duet = true;
42+
~do_synth = false;
43+
~player_sound = true;
44+
~player_inst = 43;
45+
~last_pitch = nil;
46+
~gate = false;
47+
48+
OSCdef(\analysis, {
49+
arg msg;
50+
var amp = msg[3];
51+
var f0 = msg[4];
52+
var vel = (amp.pow(0.5)*126+1).round.asInteger;
53+
var pitch = f0.cpsmidi.round.asInteger;
54+
55+
56+
~last_pitch.notNil.if{
57+
MIDIdef.all[\input_off].func.value(0, ~last_pitch)};
58+
MIDIdef.all[\input_on].func.value(vel, pitch);
59+
60+
~last_pitch = pitch;
61+
62+
}, "/analysis")
63+
)
64+
65+
(
66+
~clear_pending_events.();
67+
~release_all.(0);
68+
)
69+
70+
71+
// ~analyzer.set(\threshold, 0.1)
72+
73+
// OSCdef.trace
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// in this example the Linnstrument displays an interface to perform pitches
2-
// by their likelihood under the NotePredictor model instead of by MIDI number
2+
// by their likelihood under the Notochord model instead of by MIDI number
33

44
// the grid in the upper left gives control of pitches from
55
// the single most likely (cyan) to least likely (pink).

0 commit comments

Comments
 (0)