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

Commit de30546

Browse files
remove torchscript and conditional imports to allow compilation with nuitka
1 parent 91768ad commit de30546

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

examples/notochord/generate-demo.scd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Quarks.install("API")
2222

2323
(
2424
///////// define scheduler /////////
25-
~player_instrument = nil;
25+
~player_inst = nil;
2626
~gate = true;
2727

2828
// track the current predicted next event
@@ -64,7 +64,7 @@ Quarks.install("API")
6464
~output.send(inst, pitch, vel);
6565

6666
//get a new prediction in light of current note
67-
~exclude_instrument = ~player_instrument!?([_]);
67+
~exclude_instrument = ~player_inst!?([_]);
6868
~noto.feedQuery(
6969
\inst, inst, \pitch, pitch, \time, dt, \vel, vel,
7070
\handle, event_time, *~noto.globalArgs);
@@ -229,8 +229,8 @@ Quarks.install("API")
229229
~pitch_temp = 1;
230230
~rhythm_temp = 1;
231231
~timing_temp = 0.1;
232-
~min_time = 0.015;
233-
~max_time = 0.125;
232+
~min_time = nil;//0.015;
233+
~max_time = nil;//0.125;
234234
~velocity_temp = 1;
235235
~include_pitch = ([[0,3,7,9]]+[40,52,64,76]).flatten;
236236
~clear_prediction.();
@@ -263,8 +263,8 @@ Quarks.install("API")
263263
~last_event_time = nil;
264264

265265
// choose instruments for the player and Notochord
266-
~player_inst = 12;
267-
~include_instrument = [55, 120,]; //notochord instruments
266+
~player_inst = 57;
267+
~include_instrument = [61]; //notochord instruments
268268
~allow_end = true;
269269

270270
~instrument_temp = 1;

notochord/notochord/__main__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from iipyper import run
44

5+
from notochord.server import main as server
6+
57
def help():
68
print("""
79
available subcommands:
@@ -12,9 +14,8 @@ def help():
1214
# print(sys.argv)
1315
try:
1416
if sys.argv[1] == 'server':
15-
from .server import main
1617
sys.argv = sys.argv[1:]
17-
run(main)
18+
run(server)
1819
else:
1920
help()
2021
except IndexError:

notochord/notochord/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ def __init__(self,
129129
# embeddings for inputs
130130
self.instrument_emb = nn.Embedding(self.instrument_domain, emb_size)
131131
self.pitch_emb = nn.Embedding(self.pitch_domain, emb_size)
132-
self.time_emb = torch.jit.script(
132+
self.time_emb = (#torch.jit.script(
133133
SineEmbedding(
134134
time_sines, emb_size, 1e-3, 30, scale='log'))
135135
# self.vel_emb = MixEmbedding(emb_size, (0, 127))
136-
self.vel_emb = torch.jit.script(
136+
self.vel_emb = (#torch.jit.script(
137137
SineEmbedding(
138138
vel_sines, emb_size, 2, 512, scale='lin'))
139139

@@ -149,7 +149,7 @@ def __init__(self,
149149
for _ in range(2 if kind=='lstm' else 1)
150150
])
151151

152-
mlp_cls = lambda *a: torch.jit.script(GLUMLP(*a))
152+
mlp_cls = GLUMLP#lambda *a: torch.jit.script(GLUMLP(*a))
153153
# projection from RNN state to distribution parameters
154154
self.h_proj = mlp_cls(
155155
rnn_hidden, emb_size, emb_size,

notochord/notochord/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
import numpy as np
1111
from time import time
1212

13-
def main(host="127.0.0.1", receive_port=9999, send_port=None, checkpoint=None):
13+
def main(host="127.0.0.1", receive_port=9999, send_port=None,
14+
checkpoint="artifacts/notochord-latest.ckpt"):
1415
osc = OSC(host, receive_port)
1516

1617
if checkpoint is not None:

0 commit comments

Comments
 (0)