![]() |
![]() ![]() ![]() ![]() ![]()
|
next newest topic | next oldest topic |
Author | Topic: scripting |
Pieter Member |
![]() ![]() ![]() Hello, I hope this question is not too basic. How can I change a variable in a funtcion with another funtion from outside? r := Random new. Now I would like to change a every 20 repeats and change the octave through another function? Best Regards Pieter IP: Logged |
SSC Administrator |
![]() ![]() ![]() You may prefer to do this in real time, without having to construct a MIDI script. You can ask for the value of the next iteration of the map of the interval each time you trigger, using the expression: !KeyDown nextChaotic: !k seed: 0.77 reset: !Inject In answer to your question on how to change the octave in your script, if you were to use a do: loop instead of timesRepeat: then you would have an index (i) that you could test for the number of repeats. Every 20 times you could change the octave number. You would need another variable to hold the octave (which could take the values -3, -2, -1, 0, 1, 2, 3 as the numbers of octaves above or below the octave of the pitch you read out of the array using fr). For example, oct := 0. I didn't actually run the compiler on this, so please just look at it as a suggestion as to how to approach it. (I think you might find that the nextChaotic:seed:reset: function is a more interactive and tweakable way to do the same thing) IP: Logged |
Fake Person Member |
![]() ![]() ![]() Alternatively, you could use: r := Random new. IP: Logged |
Pieter Member |
![]() ![]() ![]() Hello Fake, thank you for your suggestion. But this one I tried also and it doesn't work. It seems you can't do a "timesRepeat" inside another "timesRepeat". ??? Best Pieter IP: Logged |
Pieter Member |
![]() ![]() ![]() quote: Sorry but perhaps I expressed my question the wrong way. In the following function I want to change th variable "a" every 20 repeats. I can do it with another if-function but it would interest me how I can use the expression from above. Please excuse my difficulties with the english language. | r t x fr a p oct| IP: Logged |
SSC Administrator |
![]() ![]() ![]() "!KeyDown nextChaotic: !k seed: 0.77 reset: !Inject ------------------------------------------------------------------------ Sorry but perhaps I expressed my question the wrong way. In the following function I want to change th variable "a" every 20 repeats." The variable a in your script corresponds to the hot value (!k + 3) in the expression I suggested. This is the scalar value (usually called R) that determines whether your iterated function will go into a cycle or whether it will be in a chaotic area. You could change !k every 20th time by: (1 bpm: !BPM) nextChaotic: ((1 bpm: (!BPM / 20)) nextRandom) reset: !Gate IP: Logged |
Pieter Member |
![]() ![]() ![]() so much to learn.... thank you for your patience IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() ![]() |
This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.