<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/4.1.92">
</HEAD>
<BODY>
OK, here's rev 3. Now with optional microtonal support. This can be disabled with (set-scala-microtonal #f).<BR>
<BR>
Should accept fractional/float values anytime now.<BR>
<BR>
Joel<BR>
<BR>
On Wed, 2011-12-21 at 17:14 +0100, Kassen wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On 21/12/2011, Joel Matthys <<A HREF="mailto:joel@matthysmusic.com">joel@matthysmusic.com</A>> wrote:
> I think most people who want to do microtonal stuff will want to do it
> with equal temperament, and that's already implemented. Scala files
> aren't really suitable for microtonal because it's possible to define
> vastly different interval sizes from one note to the next, so I think
> anyone who tries it should be happy with what they get. The "purist"
> approach would be your "brutal" method, (floor ) the keynum, but I think
> a little interpolation would be nice.
>
I agree. More strongly even; when we do want to be in a tuning and
want to round floats we will most likely want to do that relative to
some scale, not to the tuning itself.
That way we could -for example- turn a scaled (sin (time)) in to a
sort of melody.
Here is a part of a toolset I'm working on;
(define major (list 0 2 4 5 7 9 11))
(define minor (list 0 2 3 5 7 9 11))
(define acoustic (list 0 2 4 6 7 9 10))
(define whole (list 0 2 4 6 8 10))
;gets the nth note of a given scale
(define (in-scale myscale note)
(let* ( (note (inexact->exact (round note)))
(l (length myscale))
(r (remainder note l)))
(+
(* (quotient note l) 12)
(if (negative? r)
(- (list-ref myscale (+ l r)) 12)
(list-ref myscale r)))))
;rounds to the nearest note that is in the given scale
(define (to-scale myscale x)
(let* ((myscale (append myscale '(12)))
(ret 0)
(over (quotient (inexact->exact (round x)) 12))
(over (if (negative? x) (- over 1) over))
(x (- x (* 12 over))))
(for ((n (in-range 0 (length myscale))))
(when (<
(abs (- (list-ref myscale n) x))
(abs (- ret x)))
(set! ret (list-ref myscale n))))
(+ ret (* over 12))))
Might be interesting/fun/helpful. I'll publish the whole thing once
I'm at least sure of it all myself and we can see whether others like
it and perhaps push it in.
Yours,
Kas.
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>