digego / extempore

A cyber-physical programming environment
1.4k stars 127 forks source link

pc:make-chord-fixed can't take symbols #399

Closed lambdamusic closed 3 years ago

lambdamusic commented 3 years ago

Is this by design ?

Eg this fails:

(define *notes* '(c3 g3 b3))

(let ((a (car *notes*)))
        (pc:make-chord a 90 8 '(0 3 5 6 7)))

;Trace: 
;function(round): argument 1 must be: number
;argument values: (c3) #<PROC round>
;Trace: pc:make-chord

It'd work simply by passing (eval a) to pc:make-chord.

Looks like the culprit is round that only takes integers.

benswift commented 3 years ago

Hey @lambdamusic , I think the confusion comes from the fact that the c3 (SPN) symbols are bound to the corresponding midi note numbers, but as above you're still passing the symbol c3 rather than the number.

This will do what you want:

(define *notes* (list c3 g3 b3))

(let ((a (car *notes*)))
  (pc:make-chord a 90 8 '(0 3 5 6 7)))

Note that by using list above *notes* is no longer a list of symbols, but a list of numbers.

lambdamusic commented 3 years ago

Thanks! My bad - I totally missed the fact I was passing a quoted list..