Hans Höglund
unread,Sep 21, 2014, 8:27:52 AM9/21/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Edward Lilley, music-sui...@googlegroups.com
> I don't mind about the naming really -- if there's any confusion, I just
> glance at the type signature. So, bearing in mind that I don't actually
> care(!), my suggestion would be the other way round: tuning for the
> general case
That makes sense, I'll go with intonation being `Pitch -> Hertz` and tuning being `Interval -> Hertz(Ratio?)`.
> My reasoning behind introducing the FreqRatio type was to keep the
> expression of the 'synTune' and 'makeBasis' functions as clear as
> possible. Perhaps if it were possible to make an instance of VectorSpace
> with Hertz as both the point *and* the vector type, that notation could
> be retained?
Yes Hertz can be an instance of AffineSpace (the "point" class) with itself as its Diff ("point" to "vector" type function), as with the Double (really Double^n) instances. If will try that and see if it makes the API more intelligible.
> Also, I've just noticed the IsInterval instance for Hertz, and I'm a
> bit confused -- is it assuming some particular tuning system, and what
> is the role of (o,d,c) in general? To my mind, intervals are *anything*
> that:
> a) add and subtract like vectors, and
> b) have a special vector called a unison such that (unison - i) is
> "negating" the interval i (though this is actually redundant because
> all vector spaces necessarily already have this property)
> c) have a special vector called an octave such that (octave - i) is
> "inverting" the interval i.
In IsInterval (o,c,d) is simply a serialization of the name, i.e. octaves, chromatic steps (mod 12) and diatonic steps (mod 7) – all common names have a serialization like that: { m3 -> (0,2,3), _M3 -> (0,2,4), m9 -> (1,1,1) ... }. The role of this class (and its sibling IsPitch) is to make expressions shorter in cases where common pitches and intervals are not being used. It is similar to Num and IsString in that respect: the language does not force you to write `fromInteger 2` or `fromString "hello"` to work with Int and Text as opposed to Integer and String.
You are right, the IsInterval instance is really assuming a "pure" intonation and should probably be removed. On the other hand I *would* like to be able to use things like `up _P8` on (say) a value of type `Score Hertz`. But that would probably be having the cake and eating it too...
Hans