|
Post by zysgmn on Jan 29, 2021 8:41:16 GMT
hi nic! can you help me sovle this problem? i use your code to input notes store in a lookup table which i add +P by uncledaves suggestion for save in a scene for share
if load
# G80 will be the current lookup table index
assign G80 = 0 +P end
# trap all note on events
if MT == 90
# add the note number into the lookup table
assign GG80 = M1
# move to next index, and cycle back
# to zero after 128 notes
calc G80 = G80 + 1
if G80 == 80
assign G80 = 0
end
# update block label with note count
set LB0 G80 +D
end and your another code for play
if load
assign I0 = 0 0
while I0 < G80
send 90 GI0 40 +DI1
calc I1 = I1 + $1000
send 80 GI0 00 +DI1
calc I1 = I1 + $500
calc I0 = I0 + 1
end
the problem is ,if i dont close quit midifire, all work seems fine,i can save in a scene and reload it,and play,all the input notes before are still there, but once i close quit midifire , reopen midifire reload the scene,then all the input notes before ,all gone!to be exact,all notes seems turn into C0,but the number of notes seems still there ,so what happened? please help me ,because i want to share the input notes scene for others ios equipment ,Thank you very much !
|
|
|
Post by zysgmn on Jan 30, 2021 9:14:02 GMT
yes!i did it!after patiently searching and carefully understanding NIC's example code explanation and uncledave's example code, I finally found a solution to the problem
if load
# G80 will be the current lookup table index
ass G0 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P ass G10 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P ass G20 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P ass G30 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P ass G40 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P ass G50 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P ass G60 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P ass G70 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P ass G80 = 0 +P end
# trap all note on events
if MT == 90
# add the note number into the lookup table
assign GG80 = M1
# move to next index, and cycle back
# to zero after 128 notes
calc G80 = G80 + 1
if G80 == 80
assign G80 = 0
end
# update block label with note count
set LB0 G80 +D
end hahaha!so happy! thanks to you nic! thank you uncledave! you guys rock!the most of all ,midifire rocks!!!
|
|
|
Post by zysgmn on Jan 30, 2021 9:26:30 GMT
but one more question,nic ,how can i reset the G array to zero resetting the table ,Can the input notes in G array be displayed like this Gx = 3c 3c 43 43 45 43...or Gx = $60 $62 $64.....and Can lookup table input more than 128 notes? Sorry to ask so many questions,because I want to use the midifire to realize some of my dreams,and its so powerful!!! I've exceeded what I can do for two days,ahahahah!
|
|
|
Post by uncledave on Feb 1, 2021 20:19:15 GMT
Glad to hear you figured it out.
Just a little tech note: Incrementing G80 after storing the note means that G80 holds the number of note stored. The index of the last note will be G80-1. You need to be careful with the playback loop. This is an ancient programming problem, and a source of many bugs.
You could use a CC, or a specific note, or a Program Change, etc. to reset the index. Really depends on what's convenient for your gear.
The arrays have 256 slots (indexes 00 to FF), so you can use up to 255 notes, assuming you store the index in G along with the notes.
Not sure what you mean about displaying the input notes. StreamByter doesn't have a Print function. What you see on the screen is just a listing of the original program; it will never show the notes that were loaded and stored while running the program. You can view the notes as they're output, by using the SB monitor capability. Kinda klunky, but comprehensive.
|
|
|
Post by zysgmn on Feb 3, 2021 7:04:35 GMT
Thank you very much, uncledave. According to your tech note, I have successfully expanded the G array to 239 notes GF0, which is enough for me to use for a period of time, But I still don't know how to reset the G array index. I have tried many times, but I didn't succeed. Could you please give me a simple example with my code, such as CC 12 as trigger example,if i send a cc 12 then the G array all reset to 0,just like if G80 == 80 assign G80 = 0,and there is one more question ,Can there be different G arrays? For example, G1 and G2 have 128 different notes each? Thank you again sincerely
if load # G80 will be the current lookup table index
ass G0 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G10 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G20 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G30 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G40 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G50 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G60 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G70 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G80 = 0 +P
end
# trap all note on events
if MT == 90
# add the note number into the lookup table
assign GG80 = M1
# move to next index, and cycle back
# to zero after 128 notes
calc G80 = G80 + 1
if G80 == 80
assign G80 = 0
end
# update block label with note count
set LB0 G80 +D
end
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Feb 7, 2021 15:49:10 GMT
Hi zysgmn , # reset G0 to 0 on CC12 ON reception if M0 == B0 $12 $127 assign G0 = 0 endThere are more arrays (I, J, K, L, W and P) but they are not shared amongst StreamByter instances like the G array is. G only has 256 slots. Regards, Nic.
|
|
|
Post by zysgmn on Feb 8, 2021 8:11:14 GMT
thank you for your reply nic !After a lot of trying and reading your university carefully, I finally found a way to solve howto reset the G array index problem,is the order in which you write the rules may be important!(see the code)hahaha!so happy! I will continue to learn midifire through various questions and problems!thanks a lot again nic!and best regards!
if load
# G80 will be the current lookup table index
ass G0 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G10 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G20 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G30 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G40 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G50 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G60 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G70 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +P
ass G80 = 0 +P
end
if M0 == B0 $12 #《---IF I PUT IT HERE, IT CAN WORK ass G80 = 0 end # trap all note on events
if MT == 90
# add the note number into the lookup table
assign GG80 = M1
# move to next index, and cycle back
# to zero after 128 notes
calc G80 = G80 + 1
if G80 == 80
assign G80 = 0
end
if M0 == B0 $12 #《--- BUT IF I PUT IT HERE, IT WON’T WORK ,That's why I always failed at first ass G80 = 0
end # update block label with note count
set LB0 G80 +D
end
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Feb 8, 2021 16:23:01 GMT
The reason why your first attempt didn't work is because the if M0 == B0/end is inside if MT == 90/end
If you had moved that outside of that block (like you did!) it would have worked.
Regards, Nic.
|
|
|
Post by uncledave on Feb 8, 2021 23:45:28 GMT
zysgmn Just another little note. You say you've expanded to 239 notes, but your example still shows only 128. To go all the way, you'll need initializers up to GF0, and you'd use GFF for the array count. You'd wrap around (reset the index) when the count reaches FF, not 80 as currently. Maybe you've done this and you're just keeping 128 notes for the example. I just want to make sure.
|
|
|
Post by zysgmn on Feb 9, 2021 7:43:47 GMT
thank you nic!i get it now!as I said before, I'm a rookie who just learned programming, so I'll take the trouble to ask all kinds of questions,hahaha!and yes,uncledave,iam just keeping 128 notes for the example,and thank you for your note!
|
|