Jump to content

Scaling Velocity Vectors


Recommended Posts

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

Link to comment
Share on other sites

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))

 

Link to comment
Share on other sites

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))

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy