Angelos58 Posted July 10, 2018 Share Posted July 10, 2018 I'd like writing a script for counting the number of time a loop is repeated. So I began trying a little script for understanding repeat, count and break. But ... the script repeats the number the time I wanted and goes out. Instead i wanted that waited the first, then the second hit of key and then went out. Where I was wrong. Quote Link to comment Share on other sites More sharing options...
Angelos58 Posted July 10, 2018 Author Share Posted July 10, 2018 Maybe more compact but useless as the first: Quote Link to comment Share on other sites More sharing options...
Atlas007 Posted July 10, 2018 Share Posted July 10, 2018 For what I gather, your script adds a value of "1" to the "a" variable every time a Note On is read by the scripter plugin. That's about it. Your script needs a command to move the playhead (go to) somewhere else. IOW: you need a code to tell it to jump the playback, and a code specifying the destination. Quote Link to comment Share on other sites More sharing options...
Angelos58 Posted July 11, 2018 Author Share Posted July 11, 2018 Atlas007 thank you. But Script can'y containing Meta Event as Go To Marker, so I'll use a Transformer in Environment to transform the note into a Meta Event. And all works. But, with Scripter I'd like count how many time the trigger note has been played. So I could interrupt the repetition when I want, Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted July 11, 2018 Share Posted July 11, 2018 Declare the counter variable at the global level. Inside handlemidi increment if the event matches condition Quote Link to comment Share on other sites More sharing options...
Angelos58 Posted July 11, 2018 Author Share Posted July 11, 2018 Thank Dewdman42. I'll try. Does in this way the counter variable will increment every time encounters the note? And can I put a conditional statement that interrupt the process when the counter riches a certain number? Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted July 11, 2018 Share Posted July 11, 2018 Sure Quote Link to comment Share on other sites More sharing options...
Angelos58 Posted July 11, 2018 Author Share Posted July 11, 2018 For example: Is it right? So I can write a new conditional statement "if", that captures the "var count" value and if is greater than 2 sends a different note. But this new conditional statement would be placed before the first, isn't it? Quote Link to comment Share on other sites More sharing options...
Angelos58 Posted July 11, 2018 Author Share Posted July 11, 2018 Maybe I could using a "for" statement. For "var count" <=2 , do this way, otherwise in this other way. Quote Link to comment Share on other sites More sharing options...
Angelos58 Posted July 11, 2018 Author Share Posted July 11, 2018 Why trace "ciao" also after 1 and 2? I'd like that would be sent only noteon the first and the second time and from the third none note and only another event. Quote Link to comment Share on other sites More sharing options...
Angelos58 Posted July 11, 2018 Author Share Posted July 11, 2018 Eventually I got it! But is not more elegant, in my opinion. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.