Closed boblsturm closed 6 years ago
It's a valid token, as per the generated-on-load folk_rnn_models.js
.
So, hmm... will look into this tomorrow.
It goes wrong here. flag_indur
is correctly set, but flag_innote
is also set, which it shouldn't be – and its if
clause comes first.
@boblsturm To my understanding, at line 70 (see link above) as well as flag_indur=1
there should be flag_innote=0
. If you're passing a (
then you're no longer in a note, and this would fix the behaviour here.
But... I checked your original script, and it doesn't have that unsetting of innote
.
?
Here's your script, for ease of reference.
#!/usr/bin/env python
import sys
noteset = {'a','b','c','d','e','f','g','z','x','A','B','C','D','E','F','G'}
octset = {',','\''}
accset = {'=','_','^'}
symbset = {'|','[',']',':'}
numbset = {'1','2','3','4','5','6','7','8','9'}
modset = {'/'}
contset = {'>','<'}
result = []
with sys.stdin as inputline:
w=""
flag_expectingnote=0
flag_innote=0
flag_indur=0
for c in str(inputline.read()):
if c in ('|','[',']'):
if flag_innote or flag_indur:
result.append(w)
w=c
else:
w+=c
flag_innote=0
flag_indur=0
elif c in ':':
if flag_innote or flag_indur:
result.append(w)
w=""
flag_innote=0
flag_indur=0
w+=c
elif c in ('('):
result.append(w)
w=c
flag_indur=1
elif c in numbset:
if flag_innote:
result.append(w)
w=c
flag_indur=1
flag_innote=0
elif flag_indur:
w+=c
else:
result.append(w)
w=c
flag_indur=1
elif c in octset:
w+=c
elif c is '/':
if flag_innote:
result.append(w)
w=c
else:
w+=c
flag_indur=1
flag_innote=0
elif c in accset:
if flag_innote: # terminate previous note
result.append(w)
w=c
elif flag_expectingnote: # double accidental
w+=c
else:
result.append(w)
w=c
flag_indur=0
flag_innote=0
flag_expectingnote=1
elif c in noteset:
if flag_expectingnote:
w+=c
flag_expectingnote=0
else:
if len(w)>0:
result.append(w)
w=c
flag_innote=1
flag_indur=0
elif c in contset:
if flag_indur:
w+=c
else:
result.append(w)
w=c
flag_innote=0
flag_indur=1
# append final part
result.append(w)
#print result
print ' '.join(result)
Yes, I agree. Seems
elif c in ('('): result.append(w) w=c flag_indur=1
should be
elif c in ('('): result.append(w) w=c flag_indur=1 flag_innote=0
On Tue, Oct 23, 2018 at 10:43 AM Toby Harris notifications@github.com wrote:
@boblsturm https://github.com/boblsturm To my understanding, at line 70 (see link above) as well as flag_indur=1 there should be flag_innote=0. If you're passing a ( then you're no longer in a note, and this would fix the behaviour here.
But... I checked your original script, and it doesn't have that unsetting of innote.
?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tobyspark/folk-rnn-webapp/issues/124#issuecomment-432154115, or mute the thread https://github.com/notifications/unsubscribe-auth/AJy6ZJ1Agkwh2_J_oe8lrufhx3WJ0xErks5untbDgaJpZM4Xxwq8 .
-- Bob L. Sturm, Associate Professor Speech, Music and Hearing School of Electronic Engineering and Computer Science Royal Institute of Technology KTH, Sweden https://highnoongmt.wordpress.com
Deployed.
Great! works.
On Tue, Oct 23, 2018 at 11:41 AM Toby Harris notifications@github.com wrote:
Deployed.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tobyspark/folk-rnn-webapp/issues/124#issuecomment-432175435, or mute the thread https://github.com/notifications/unsubscribe-auth/AJy6ZKMUkRYfwMA2r25U5BevkporItkKks5unuQ3gaJpZM4Xxwq8 .
-- Bob L. Sturm, Associate Professor Speech, Music and Hearing School of Electronic Engineering and Computer Science Royal Institute of Technology KTH, Sweden https://highnoongmt.wordpress.com
For some reason this is invalid initial abc "cB |: GC (3 C C C c2 GA"
It complains about (