Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## audacity-nyquist

 Re: [Audacity-nyquist] different temperment From: - 2008-06-10 22:43:32 ```Paul Beach wrote: > It is trivial to calculate Equal Temperment; see Excel modul below for > the usual 12 tone as well as 31 tones. Non-linear is usually mentioned > in the context of differential equations. The 12 tone scale is in every > computer music scale, as I have done, and always unavailable for > modification. If there is a reason to do a glide or glissado, frequency > modulation works quite well in Audacity. > > Sub et() > a440 = 440 > > 'Equal Temperment 12 tone > Cells(1, 1) = a440 > > For i = 2 To 12 > Cells(i, 1) = 2 ^ (i / 12) * 440 > Next i > > 'Equal Temperment 31 tone > > Cells(1, 3) = a440 > For k = 2 To 31 > Cells(k, 3) = 2 ^ (k / 31) * 440 > Next k > End Sub Edgar writes: If you only want to work with equal temperament, but a different numer of semitones than 12, the implementation in Nyquist is quite easy. The only point is that then it would probably not make much sense to work with MIDI natation any longer. But since the Nyquist low-level interface works in terms of physics (frequency in Hertz and time in seconds) it's not neccessary to use MIDI notation at all. If you have e.g. an a440 and want to compute the next higher semitone in 31-TET, 2 ^ (1/31) *440, in Nyquist this would look like: ;; logarithmic math with Nyquist and XLISP: ;; n-th power of x: (exp (* (log x) n)) ;; n-th root of x: (exp (/ (log x) n)) (setf new-hertz-value (exp (* (log 2.0) (/ 1.0 31.0)))) IMPORTANT: write 31.0, a Lisp FLONUM, because (/ 1 31) would be a FIXNUM (integer) computation and result in a value of zero. It's sufficient if ONE of both numbers is a FLONUM to get a FLONUM result. A general 31-TET transformation function would look like: (defun 31-tet (k) (* (exp (* (log 2.0) (/ k 31.0))) 440.0)) NOTE: You only need to exchange the "31.0" by another factor to get a different TET scaling. Because all Nyquist MIDI functions internally work with FLONUMS (the MIDI "step" in Nyquist is just a word but not a real "step") you can use the "31-tet" function like: ;; a sinewave, 4 31-TET semitones higer than a440 ;; (osc (hz-to-step (31-tet 4))) ;; a sinewave, 6 31-TET semitones lower than a440 ;; (osc (hz-to-step (31-tet -6))) One step further, a 31-TET sine oscillator would look like this: (defun 31-tet-osc (k) (osc (hz-to-step (31-tet k)))) The same way you can modify any Nyquist oscillator you like to a different TET tuning scale. For oscillators which need Hertz values just omit the "hz-to-step" transformation. NOTE: How much the Nyquist pitch transformation environment works with the TET functions is a different question (still not tested yet). - edgar -- The author of this email does not necessarily endorse the following advertisements, which are the sole responsibility of the advertiser: _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066 ```