[CM] latest FOMUS not working with latest Grace [SOLVED]

taube at illinois.edu taube at illinois.edu
Tue Jun 1 10:00:44 PDT 2010


>spectr.clm: "They contain a large set of instrument steady-state spectra, gathered many years ago (before 1976) by James A Moorer.

ok ive added clm-frame->spectrum which converts one of these to a spectrum object. from that point you can use it like any spectrum,  eg play it or notate it.

; load the data
(load "/Users/hkt/Software/sndlib/spectr.scm")

; create a spectrum
(define spec (clm-frame->spectrum bc-c2 :fundamental (hz 'c2)))

; access info
(spectrum-size spec)
(spectrum-minfreq spec)
(spectrum-maxfreq spec)
(spectrum-keys spec)
(note (spectrum-keys spec :quant 1 :unique #t))

; play it as midi
(mp:tuning 4)
(loop for k in (spectrum-keys spec)
      for t from 0 by .1
      do (mp:midi t .2 k))


;---- here is the function (its it svn already)

(define (clm-frame->spectrum data . args)
  (with-optkeys (args (fundamental 1) (amplitude 1))
     (let* ((frqs (list #f))
            (tail1 frqs)
            (amps (list #f))
            (tail2 amps))
       (do ((dat data (cddr dat))
            (siz 0 (+ siz 1)))
           ((null? dat)
            (make-spectrum 0 siz (cdr frqs) (cdr amps)))
         (set-cdr! tail1 (list (* (car dat) fundamental)))
         (set! tail1 (cdr tail1))
         (set-cdr! tail2 (list (* (cadr dat) amplitude)))
         (set! tail2 (cdr tail2))))))



More information about the Cmdist mailing list