Jorgalad Posted April 16, 2018 Share Posted April 16, 2018 I'm probably over-complicating things but I'm trying to find the best approach to create 8 bars of random velocity values scaled to a certain range. This is what I have so far, I hope it makes sense: (setf rh-a-dynamics (gen-eval 8 (vector-range 0.55 0.69 '(vector-to-velocity (random* 0.7) (random* 0.9)) (gen-white-noise 5 :seed 12)))) Result: > Error: Too many arguments in call to #<Compiled-function vector-range #x30000113FC4F>: > 4 arguments provided, at most 3 accepted. I also tried making one list to insert into Vector-Range, which results to: > Error: The value (gen-white-noise 5 :seed 12) is not of the expected type real. Could anyone point me into the right direction? Thank you! - Jor Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted April 17, 2018 Share Posted April 17, 2018 (setf rh-a-dynamics (gen-eval 8 '(vector-to-velocity (random* 0.7) (random* 0.9) (vector-range 0.55 0.69 (gen-white-noise 5 :seed 12))))) S. Jorgalad 1 Quote Link to comment Share on other sites More sharing options...
opmo Posted April 17, 2018 Share Posted April 17, 2018 This way you have control over seed in INIT-SEED if used: (setf rh-a-dynamics (gen-eval 8 '(vector-to-velocity 0.55 0.67 (gen-white-noise 5)) :seed 12)) Quote Link to comment Share on other sites More sharing options...
Jorgalad Posted April 17, 2018 Author Share Posted April 17, 2018 Thank you Janusz, will look into INIT-SEED, I have seen it being used in a couple of examples already (including one massively impressive score by yourself) I also noticed that the code snippet from above gives me values outside of the defined range as well. I'm guessing that's because the vector-to-velocity gets evaluated after the vector-range? (setf rh-a-dynamics (gen-eval 8 '(vector-to-velocity (random* 0.7) (random* 0.9) (vector-range 0.55 0.69 (gen-white-noise 5 :seed 12))))) >> ((ppppp pppp ppppp ppppp pppp) (mp ff mp mf fff) (ppppp ppp ppppp pppp ppp) (mp p mp p p) (p ppp p pp ppp) (pp fff ppp p ffff) (ppp f pppp pp ff) (pp p pp p p)) Quote Link to comment Share on other sites More sharing options...
opmo Posted April 17, 2018 Share Posted April 17, 2018 As you can see all values staying with in the range: 0.55 and 0.67 Simple test: (setf rh-a-dynamics (gen-eval 8 '(vector-to-velocity 0.55 0.67 (gen-white-noise 5) :type :float) :seed 12)) => ((0.56 0.67 0.55 0.58 0.67) (0.67 0.61 0.65 0.57 0.55) (0.67 0.63 0.55 0.65 0.6) (0.67 0.55 0.58 0.67 0.62) (0.62 0.67 0.57 0.55 0.58) (0.65 0.55 0.67 0.61 0.62) (0.55 0.58 0.67 0.62 0.63) (0.67 0.57 0.55 0.58 0.66)) 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.