February 27Feb 27 Using this expression(harmonics 'a2 8 :quantize nil :type :hertz)I am getting(110.0 220.0 329.62756 440.0 546.4174 659.2551 772.751 880.0)but I am expecting(110.0 220.0 330.0 440.0 550.0 660.0 770.0 880.0)What am I understanding wrong?Best, Achim
February 27Feb 27 (setf harm (harmonics 'a2 8 :quantize 1/2 :type :hertz)) => (110.0 220.0 329.62756 440.0 554.3653 659.2551 783.99085 880.0) (hertz-to-pitch harm) => (a2 a3 e4 a4 cs5 e5 g5 a5) (hertz-to-pitch '(110.0 220.0 330.0 440.0 550.0 660.0 770.0 880.0)) => (a2 a3 e4 a4 c5.. e5 fs5.. a5)
February 28Feb 28 Author :quantize nil (110.0 220.0 329.62756 440.0 546.4174 659.2551 772.751 880.0) :quantize 1/2 (110.0 220.0 329.62756 440.0 554.3653 659.2551 783.99085 880.0) not exactly the same numbers ... question remains.
February 28Feb 28 Your first example doesn't quantize, and your second example quantizes to the closest semitone, I guess.Sorry, didn't read carefully enough in my deleted answer.Jesper
March 7Mar 7 Author Sorry to insist in this, but my first example is somehow quantizing because the result should be(110.0 220.0 330.0 440.0 550.0 660.0 770.0 880.0)when calculating a harmonic scale in frequencies and not(110.0 220.0 329.62756 440.0 546.4174 659.2551 772.751 880.0)Achim
March 7Mar 7 Only Janusz knows.Could it be that the default is a tempered scale?(harmonics 'a2 8 :quantize nil :type :hertz)=>(110.0 220.0 329.62756 440.0 546.4174 659.2551 772.751 880.0)(* 220 (expt 2 7/12)) ;;tempered fifth=>329.62756Jesper
March 9Mar 9 Author Not quite. There ist still a difference in the 5. and 7. overtone compared to the semitone version of Janusz (5. and 7. overtone):(setf harm (harmonics 'a2 8 :quantize 1/2 :type :hertz))(110.0 220.0 329.62756 440.0 554.3653 659.2551 783.99085 880.0)(setf harm (harmonics 'a2 8 :quantize nil :type :hertz))(110.0 220.0 329.62756 440.0 546.4174 659.2551 772.751 880.0)
March 9Mar 9 The quanize with nil will round all to 1/8 tone (which can be expressed in the notation).
March 9Mar 9 Author Then I would suggest to set :quantize NIL to not quantize at all.And as a feature request: It would be nice to add a functionality to be able to start the harmonic scale from any arbitrary overtone.Achim
March 10Mar 10 Don't know if this simple function will be of use for now.Jesper;; for single pitches(defun harmonics2 (start-pitch length &key (partial 1) quantize)(let ((sp (pitch-to-hertz start-pitch)) (part (max partial 1)) res)(setf res (loop for i from part to (+ length (1- part)) collect (* i sp)))(if quantize (pitch-to-hertz (micro-quantize (hertz-to-pitch res) :quantize quantize)) res)))(harmonics2 'a2 8)=>(110.0 220.0 330.0 440.0 550.0 660.0 770.0 880.0)(harmonics2 'a2 8 :partial 4)=>(440.0 550.0 660.0 770.0 880.0 990.0 1100.0 1210.0)(harmonics2 'a2 8 :partial 1 :quantize 1/8)=>(110.0 220.0 329.62756 440.0 546.4174 659.2551 772.751 880.0)(mapcar (lambda (x) (harmonics2 x 4)) '(a2 c3 d3))=>((110.0 220.0 330.0 440.0) (130.81278 261.62555 392.43832 523.2511) (146.83238 293.66476 440.49713 587.3295))
Create an account or sign in to comment