Re: Ptolemy's scale - correction!

1 Message Forum Options Options
Permalink
edgar-rft
Re: Ptolemy's scale - correction!
Reply Threaded More
Print post
Permalink
Once again...

Like you're meanwhile used no other, the inevitable code correction:

(defun make-ptolemy-notes ()
  (let ((ptolemy-scale '((1.0           c)
                         ((/ 16.0 15.0) cs df)
                         ((/ 9.0 8.0)   d)
                         ((/ 6.0 5.0)   ds ef)
                         ((/ 5.0 4.0)   e)
                         ((/ 4.0 3.0)   f)
                         ((/ 45.0 32.0) fs gf)
                         ((/ 3.0 2.0)   g)
                         ((/ 8.0 5.0)   gs af)
                         ((/ 5.0 3.0)   a)
                         ((/ 9.0 5.0)   as bf)
                         ((/ 15.0 8.0)  b))))
    (dotimes (octave 8)  ; make notes from c0 to b7
      (let ((octave-c (step-to-hz (* 12 octave)))) ; c of current octave
        (dolist (scale-element ptolemy-scale) ; for every line from scale
          (let ((factor (eval (car scale-element))))
            (dolist (note (cdr scale-element))
              (let ((note-name (read (make-string-input-stream
                                       (format nil "~a~a" note octave))))
                     (pitch (hz-to-step (* octave-c factor))))
                (format t "~a  pitch: ~a~%" note-name pitch)
                (set note-name pitch)))))))))

A copy of the code can be found in the attachment.

In the last line 'setf' was changed to 'set', otherwise only the local
"note-name" value changes but not the evaluated "note-name" variable
in the *obarray*.

Also, if you press "Debug" in the "Nyquist Prompt" window you will get a
list of all note names and their new pitch values in the "Debug" window.

I have this tested now several times...

- edgar



--
The author of this email does not necessarily endorse the
following advertisements, which are the sole responsibility
of the advertiser:

______________________________________________________________
Jeden Monat 1 hochkarätiger maxdome-Blockbuster GRATIS!
Exklusiv für alle WEB.DE Nutzer. http://www.blockbuster.web.de



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Audacity-nyquist mailing list
Audacity-nyquist@...
https://lists.sourceforge.net/lists/listinfo/audacity-nyquist

ptolemy-scale.lsp (1K) Download Attachment