Jump to content
Sign in to follow this  
AM

what's up with quantize?

Recommended Posts

why are there different results (have a look to the number of length values)?

...i get in troubles with my work -  "phase shift" between pitch/length when i change/use QUANTIZE 😕 

(setf rhy '(0.375 -0.625 0.25 0.375 0.125 0.125 -0.25 0.625 0.125 -0.625 0.125 0.125 -0.625 0.375 0.25 -0.25 0.625 -0.125 0.125 -0.125 0.125 0.375 0.375 0.125 0.125 0.375 0.125 -0.25 0.125 0.25 -0.25 0.625 0.125 0.375 0.375 0.375 0.375 0.125 -0.25 0.625 0.125 -0.25 0.125 0.125 -0.375 0.125 0.25 -0.375 0.25 -0.375 0.125 -0.125 0.125 -0.25 0.625 -0.5 0.25 0.375 -0.125 0.375 0.25 -0.25 0.625 0.25 -0.125 0.125 0.125 0.125 0.125 0.125 0.375 -0.125 0.125 0.125 1.25 0.375 0.25 -0.125 0.125 0.25 -2.5 0.25 0.375 3.75 0.125 0.125 -0.375 0.375 0.125 0.625 0.25 2.5 0.125 0.125 2.5 -0.125 3.75 -0.375 1.25 -0.125 0.125 0.125 0.125 0.125 0.25 0.625 0.25 -0.375))


(setf l1 (quantize (x+b rhy 0.0) '(1 2 3 5 8)))
(length l1)
=> 116

(setf l2 (quantize (x+b rhy 0.02) '(1 2 3 5 8)))
(length l2)
=> 105

 

Share this post


Link to post
Share on other sites

but it makes no sense to get more LENGTH-values by adding 0.02 (also by adding 0.12 what ist no such a little change...)? whats the idea behind it?

 

in that way its not usable for many ways.... 

 

Share this post


Link to post
Share on other sites

here is a very simple example:

 

a sequence in 1/8-structure -> i will add 0.25 (=> + 1/16), and QUANTIZE-output-sequences are with different lengths!!

compare: (length rhy) with l1 with l2

 

(setf rhy '(1.5 -2.5 1.0 1.5 0.5 0.5 -1.0 2.5 0.5 -2.5 0.5 0.5 -2.5 1.5 1.0 -1.0 2.5 -0.5 0.5 -0.5 0.5 1.5 1.5 0.5 0.5 1.5 0.5 -1.0 0.5 1.0 -1.0 2.5 0.5 1.5 1.5 1.5 1.5 0.5 -1.0 2.5 0.5 -1.0 0.5 0.5 -1.5 0.5 1.0 -1.5 1.0 -1.5 0.5 -0.5 0.5 -1.0 2.5 -2.0 1.0 1.5 -0.5 1.5 1.0 -1.0 2.5 1.0 -0.5 0.5 0.5 0.5 0.5 0.5 1.5 -0.5 0.5 0.5 5.0 1.5 1.0 -0.5 0.5 1.0 -10.0 1.0 1.5 15.0 0.5 0.5 -1.5 1.5 0.5 2.5 1.0 10.0 0.5 0.5 10.0 -0.5 15.0 -1.5 5.0 -0.5 0.5 0.5 0.5 0.5 1.0 2.5 1.0 -1.5))


(float-to-ratio rhy)
=> (3/8 -5/8 1/4 3/8 1/8 1/8 -1/4 5/8 1/8 -5/8 1/8 1/8 -5/8 3/8 1/4 -1/4 5/8 -1/8 1/8 -1/8 1/8 3/8 3/8 1/8 1/8 3/8 1/8 -1/4 1/8 1/4 -1/4 5/8 1/8 3/8 3/8 3/8 3/8 1/8 -1/4 5/8 1/8 -1/4 1/8 1/8 -3/8 1/8 1/4 -3/8 1/4 -3/8 1/8 -1/8 1/8 -1/4 5/8 -1/2 1/4 3/8 -1/8 3/8 1/4 -1/4 5/8 1/4 -1/8 1/8 1/8 1/8 1/8 1/8 3/8 -1/8 1/8 1/8 5/4 3/8 1/4 -1/8 1/8 1/4 -5/2 1/4 3/8 15/4 1/8 1/8 -3/8 3/8 1/8 5/8 1/4 5/2 1/8 1/8 5/2 -1/8 15/4 -3/8 5/4 -1/8 1/8 1/8 1/8 1/8 1/4 5/8 1/4 -3/8)


(length rhy)
=> 108

(setf l1 (quantize (x+b rhy 0.00)  '(1 2 4 8)))
(length l1)
=> 135

(setf l2 (quantize (x+b rhy 0.25) '(1 2 4 8)))
(length l2)
=> 137

 

Share this post


Link to post
Share on other sites
(setf rhy '(1.5 -2.5 1.0 1.5 0.5 0.5 -1.0 2.5 0.5 -2.5 0.5 0.5 -2.5 1.5 1.0 -1.0 2.5 -0.5 0.5 -0.5 0.5 1.5 1.5 0.5 0.5 1.5 0.5 -1.0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16 -3/16 11/16 3/16 -3/16 3/16 3/16 -5/16 3/16 5/16 -5/16 5/16 -5/16 3/16 -1/16 3/16 -3/16 11/16 -7/16 5/16 7/16 -1/16 7/16 5/16 -3/16 11/16 5/16 -1/16 3/16 3/16 3/16 3/16 3/16 7/16 -1/16 3/16 3/16 21/16 7/16 5/16 -1/16 3/16 5/16 -39/16 5/16 7/16 61/16 3/16 3/16 -5/16 7/16 3/16 11/16 5/16 41/16 3/16 3/16 41/16 -1/16 61/16 -5/16 21/16 -1/16 3/16 3/16 3/16 3/16 5/16 11/16 5/16 -5/16)

(setf l1 (quantize rhy1 '(1 2 4 8)))
(get-count rhy1 :length :note)
=> 80
(setf l2 (quantize rhy2 '(1 2 4 8)))
(get-count rhy2 :length :note)
=> 80

 

Share this post


Link to post
Share on other sites

i know, but the error/wrong output is coming up when would add (individual) float-numbers to RHY and afterwards use QUANTIZE 🙂

 

the concret idea is: to a basic FLOAT-seq like RHY -values (above) i would like to add some little noisy-floats - 0.5 becomes 0.55 or 0.75 beomes 0.70 etc... so the precise structure beomes some fuzziness - but after quantizing, the snychronization with the pitches is wrong - because QUANTIZE doing more/less length-values

 

 

Share this post


Link to post
Share on other sites

This is not an error and not wrong result.

(setf rhy '(1.5 -2.5 1.0 1.5 0.5 0.5 -1.0 2.5 0.5 -2.5 0.5 0.5 -2.5 1.5 1.0 -1.0 2.5 -0.5 0.5 -0.5 0.5 1.5 1.5 0.5 0.5 1.5 0.5 -1.0 0.5 1.0 -1.0 2.5 0.5 1.5 1.5 1.5 1.5 0.5 -1.0 2.5 0.5 -1.0 0.5 0.5 -1.5 0.5 1.0 -1.5 1.0 -1.5 0.5 -0.5 0.5 -1.0 2.5 -2.0 1.0 1.5 -0.5 1.5 1.0 -1.0 2.5 1.0 -0.5 0.5 0.5 0.5 0.5 0.5 1.5 -0.5 0.5 0.5 5.0 1.5 1.0 -0.5 0.5 1.0 -10.0 1.0 1.5 15.0 0.5 0.5 -1.5 1.5 0.5 2.5 1.0 10.0 0.5 0.5 10.0 -0.5 15.0 -1.5 5.0 -0.5 0.5 0.5 0.5 0.5 1.0 2.5 1.0 -1.5))

(setf l1 (quantize rhy '(1 2 4 8)))
(get-count l1 :length :note)
=> 80

(setf l2 (quantize (x+b rhy 0.25) '(1 2 4 8)))
(get-count l2 :length :note)
=> 80

Please check how quantise is working. You will find many papers on the web on that.

Share this post


Link to post
Share on other sites

but with other ADD and QUANTIZE

 

(setf l2 (quantize (x+b rhy 0.22) '(1 2 4 8)))
(get-count l2 :length :note)
=> 82

 

(setf l2 (quantize (x+b rhy 0.22) '(1 2 3 4 5 6 7 8)))
(get-count l2 :length :note)
=> 86

so for me, quantize works a little bit like a BLACK BOX  🙂

 

would absolutely GREAT if it would work always with same COUNT! any idea? 🙂

thanx for help!!

 

Edited by AM

Share this post


Link to post
Share on other sites

voilà:

here is a concret example -  with 12 length-values (in my work there are about 700, so the problems are BIGGER 🙂 )

 

if you evaluate a few times you get some WRONG output. you see it if the last pitch is not an f5, that's because there are (don't know why) from time to time (from eval to eval) more then 12 length-values in the output - should be 12  length and 3 rest values. this is the problem and makes the result too inconsistent for me...

 

;;; LENGTH

(setf rhy (gen-length '(1 1 3 -2 5 7 3 -2 1 5 8 -7 3 1 2) 32))
(setf float-rhy (ratio-to-float rhy))
(setf float-rhy+fuzziness (loop for i in float-rhy 
                            when (> i 0) 
                            collect (+ i (rnd-pick '(0.05 0.1 0.15)))
                            else collect i))

(setf rhy+fuzziness (quantize float-rhy+fuzziness '(1 2 3 4 5 6 7 8)))

;;; PITCHES 

(setf pitches '(fs3 bb3 c4 d4 eb4 e4 g4 gs4 a4 b4 cs5 f5))


;;; MAKE OMN + SCORE

(def-score example
           (:title "example"
                   :key-signature 'atonal   
                   :time-signature '(4 4) 
                   :tempo 90)
  
  (instr
   :omn (make-omn :length rhy+fuzziness
                  :pitch pitches) 
   :span :pitch
   :sound 'gm-trumpet))

 

 

 

 

Share this post


Link to post
Share on other sites

You can control the output with the two keywords: speed and trust:

#|
(setf rhy (gen-length '(1 1 3 -2 5 7 3 -2 1 5 8 -7 3 1 2) 32))
(setf float-rhy+fuzziness (loop for i in rhy 
                            when (> i 0) 
                            collect (+ i (rnd-pick '(0.05 0.1 0.15)))
                            else collect i))
|#
(setf float-rhy+fuzziness '(0.13125 0.08125 0.24375 -1/16 0.20625 0.26875 0.19375
                            -1/16 0.08125 0.30625 0.35 -7/32 0.14375 0.18125 0.1625))
                            
(setf rhy+fuzziness (quantize float-rhy+fuzziness '(1 2 3 4 5 6 7 8) :speed -.2))
(setf pitches '(fs3 bb3 c4 d4 eb4 e4 g4 gs4 a4 b4 cs5 f5))

(setf mat (make-omn :length rhy+fuzziness :pitch pitches))
=> (3e fs3 bb3 -3q 3e c4 d4 t eb4 s e4 - t g4 s gs4 s. a4 -et -s t b4 cs5 f5 -s.)

 

However, if the input list smallest value is smaller then the minimum quantum value then you end up with less length-notes values.

Share this post


Link to post
Share on other sites

dear janusz

 
IT IS A BUG 🙂
 
what a strange output you have…?! 
 
with this litle LOOP i will never get a value like  0.08125…  because the minimum will be 0.125+add (= rnd-pick) => 1/32+add… so THIS could not be the problem!!!!
you have to "convert" to FLOAT (you did not in YOUR example) -> then you have not such too-small-values -
do it like in MY example above... so NO too small value, BUT SAME QUANTIZE BUG
 
(setf float-rhy '(0.125 0.125 0.375 -0.25 0.625 0.875 0.375 -0.25 0.125 0.625 1.0 -0.875 0.375 0.125 0.25))
(setf float-rhy+fuzziness (loop for i in float-rhy 
                            when (> i 0) 
                            collect (+ i (rnd-pick '(0.05 0.1 0.15)))
                            else collect i))

 

 

and you get the SAME bug with 1/16 as minimum value and much larger adds -> test it 🙂

 



;;; LENGTH

(setf rhy (gen-length (rnd-order '(1 3 2 -1 7 1 2 -1 2 1 5 -1 3 2 1)) 16))
(setf float-rhy (ratio-to-float rhy))
(setf float-rhy+fuzziness (loop for i in float-rhy 
                            when (> i 0) 
                            collect (+ i (rnd-pick '(0.1 0.2 0.3)))
                            else collect i))

(setf rhy+fuzziness (quantize float-rhy+fuzziness '(1 2 3 4 5 6 7 8)))

;;; PITCHES 

(setf pitches '(fs3 bb3 c4 d4 eb4 e4 g4 gs4 a4 b4 cs5 f5))



;;; MAKE OMN + SCORE

(def-score example
           (:title "example"
                   :key-signature 'atonal   
                   :time-signature '(4 4) 
                   :tempo 90)
  
  (instr
   :omn (make-omn :length rhy+fuzziness
                  :pitch pitches
                  :velocity '(pppp)) 
   :span :pitch
   :port 0
   :channel 1
   :sound 'gm-trumpet))

;;;

 

 

the speed-thing changes nothing, same BUG

 

(setf rhy+fuzziness (quantize float-rhy+fuzziness '(1 2 3 4 5 6 7 8) :speed -.2))

 

Share this post


Link to post
Share on other sites

"you have to "convert" to FLOAT (you did not in YOUR example)" you don't need to do that, the quantize can deal with ratios, floats or both.

 

Share this post


Link to post
Share on other sites

okay, i see... but the QUANTIZE-problem (or whatever) stays... wrong number of LENGTH values from time to time

-> evaluate this example (with ratios and longer values) a few time... and you will see. so it's not possible to work correct with QUANTIZE 😥 

 

greetings 

andré

 


;;; LENGTH

(setf rhy (gen-length (rnd-order '(1 3 2 -1 7 1 2 -1 2 1 5 -1 3 2 1)) 16))
(setf float-rhy+fuzziness (loop for i in rhy 
                            when (> i 0) 
                            collect (+ i (rnd-pick '(0.4 0.2 0.3)))
                            else collect i))

(setf rhy+fuzziness (quantize float-rhy+fuzziness '(1 2 3 4 5 6 7 8) :speed -.2))

;;; PITCHES 

(setf pitches '(fs3 bb3 c4 d4 eb4 e4 g4 gs4 a4 b4 cs5 f5))



;;; MAKE OMN + SCORE

(def-score example
           (:title "example"
                   :key-signature 'atonal   
                   :time-signature '(4 4) 
                   :tempo 90)
  
  (instr
   :omn (make-omn :length rhy+fuzziness
                  :pitch pitches
                  :velocity '(pppp)) 
   :span :pitch
   :port 0
   :channel 1
   :sound 'gm-trumpet))

 

Share this post


Link to post
Share on other sites

There is no bug in the function. In the current version the tie quantum is fixed to the minimum-quantum value (smallest tuplet value). I will make a possible to control the tie quantum with an additional keyword.

 

Example:

(setf rhy '(0.375 -0.625 0.25 0.375 0.125 0.125 -0.25 0.625 0.125 -0.625 0.125 0.125
                  -0.625 0.375 0.25 -0.25 0.625 -0.125 0.125 -0.125 0.125 0.375 0.375
                  0.125 0.125 0.375 0.125 -0.25 0.125 0.25 -0.25 0.625 0.125 0.375
                  0.375 0.375 0.375 0.125 -0.25 0.625 0.125 -0.25 0.125 0.125 -0.375
                  0.125 0.25 -0.375 0.25 -0.375 0.125 -0.125 0.125 -0.25 0.625 -0.5
                  0.25 0.375 -0.125 0.375 0.25 -0.25 0.625 0.25 -0.125 0.125 0.125
                  0.125 0.125 0.125 0.375 -0.125 0.125 0.125 1.25 0.375 0.25 -0.125
                  0.125 0.25 -2.5 0.25 0.375 3.75 0.125 0.125 -0.375 0.375 0.125
                  0.625 0.25 2.5 0.125 0.125 2.5 -0.125 3.75 -0.375 1.25 -0.125 0.125
                  0.125 0.125 0.125 0.25 0.625 0.25 -0.375))

(setf l1 (quantize rhy '(1 2 4 8)))
=> (s. -et s s. t t -t -t et t -t -e t t -s -s. s. s -s et -t t -t t s.
       s. t t s. t -t -t t s -s et t s. s. s. s. t -s et t -s t t -s.
       t s -s. s -s. t -t t -s et -s. -t s s. -t s. s -s et s -t t t t
       t t s. -t t t qs s. s -t t s -e -q -q s s. h... t t -s. s. t et
       s he t t he -t h... -s. qs -t t t t t s et s -t -q)

(get-count l1 :length :note)
=> 80

(setf l2 (quantize (x+b rhy 0.02) '(1 2 4 8) :tie 0.5))
=> (s. -et e e q -et t t -t -e s. t t -s et -t t -t t s. t e e t -s t
       s -s q e e s. t -s s s. t -s t t -e e -s s -s. t q -e s s s e
       s -s et t t -t t t t t s s. -t t t s q e s s s -e. -q -e. s s.
       h..t t t t -s. s q s he t t he e h. e -e q t -t t t t t s e. s -q)

(get-count l2 :length :note)
=> 80

(setf l3 (quantize (x+b rhy 0.02) '(1 2 3 4 5 6 7 8) :tie 0.06))
=> (s. -et 7h 7h. 7q 7q -3e 3h 3e -et t t -t -e s. s -s et -t t -t t s
       t_7h 7q 7q 7h. t -s t s -s 7wq 7q 7q_5q 5h 5h s. t -s et t -s t
       t -3q 3e 3q -3e -s s -s. t 7q -7h 7w -e s e e s -s et t_7q -7q
       7q 7q 7q 7q 7q s. -t t t qs 7h. 7h -7q 7q 5q -5w -q -e. s s.
       h... t t -s. s_3e 3e 3h s he t t he -3e 3q_h.. -3q 3e_qt -t t t
       t t s 7wq 7h -q)

(get-count l3 :length :note)
=> 80

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×