Rangarajan Posted November 9, 2020 Share Posted November 9, 2020 Hi, vector-to-pitch is a very useful function. I want something quite similar with but with a small change. What it does now (from the doc): (vector-to-pitch '(g3 g4) (gen-white-noise 10 :seed 89))(vector-to-pitch '(g3 g4) (gen-white-noise 10 :seed 89)) => (ab3 g4 eb4 a3 b3 eb4 g4 g3 gb4 e4) Instead of giving (low high) as the first argument, I would like to give, for example, a specific scale. Let us say that I want vector-to-pitch to convert the generated white noise to pitches in Major Scale, with tonic of C4. Is this possible? - Rangarajan Quote Link to comment Share on other sites More sharing options...
opmo Posted November 9, 2020 Share Posted November 9, 2020 (tonality-map '(major) (vector-to-pitch '(g3 g4) (gen-white-noise 10 :seed 89))) => (a3 g4 d4 a3 b3 d4 g4 g3 g4 e4) or (harmonic-path '(major) (vector-to-pitch '(g3 g4) (gen-white-noise 10 :seed 89))) => (c3 d4 e4 f3 g3 a4 b4 c3 d4 e4) Quote Link to comment Share on other sites More sharing options...
Rangarajan Posted November 10, 2020 Author Share Posted November 10, 2020 Thanks Janusz. Let me experiment with it. - Rangarajan Quote Link to comment Share on other sites More sharing options...
Rangarajan Posted November 12, 2020 Author Share Posted November 12, 2020 Thanks to suggestion by Janusz, I have been able to solve my requirement thus: ;; Returns a list of pitches from the given list, satisfying the supplied noise ;; pitch-list => arbitrary list of pitches ;; noise => Any noise (defun noise-to-pitch-map (pitch-list noise) (mapcar #'(lambda (n) (nth n pitch-list)) (vector-round 0 (1- (length pitch-list)) noise))) Examples: (noise-to-pitch-map '(c4 d4 e4 f4) (gen-white-noise 10 :seed 89)) => (c4 f4 e4 c4 d4 e4 f4 c4 f4 e4) (noise-to-pitch-map '(c4 d4 e4 c5 d5) (gen-gaussian-noise 10 :seed 89)) => (d5 d4 c4 e4 d4 e4 c4 d4 e4 d5) (noise-to-pitch-map (expand-tonality '(c4 major)) (gen-pink-noise 10 :seed 89)) => (c4 d4 d4 e4 e4 f4 g4 a4 b4 b4) - Rangarajan Stephane Boussuge and opmo 2 Quote Link to comment Share on other sites More sharing options...
opmo Posted November 12, 2020 Share Posted November 12, 2020 (vector-map '(c4 d4 e4 c5 d5) (gen-gaussian-noise 10 :seed 89)) => (d5 d4 c4 e4 d4 e4 c4 d4 e4 d5) Stephane Boussuge 1 Quote Link to comment Share on other sites More sharing options...
Rangarajan Posted November 13, 2020 Author Share Posted November 13, 2020 Super! I would have saved some time if you had posted this in response to my earlier query! - Rangarajan 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.