You can also take your values mod 12 and use those numbers to read indices in a 12-member table you've populated with a mapping onto your favorite scale. If your values are floats you might round them first. You can also keep track of the whole-number quotient of your value divided by 12 so that you can get your specific octave back as well -- this gives you the equivalent of an "octave-pitch-class" notation, like the kind you might find in csound.
your method does not take into account that the mapping to the closest note has two different widths, 2 halftones for notes not next to a semitone interval, 1.5 halftone for those that are (Mi,Fa,Si,Do).
what I was alluding to, for multiple octaves, is to use something like [wrap], so that you can use a chain of [moses] made for one octave, removing the octave number before going into [moses] and putting back right after.
but since all ranges are multiples of a quartertone, one could multiply the midi note by 2, round, then go through a [tabread]. if you don't convert to quartertones, the rounding to the closest integer will conflict with the goal of rounding to the closest note, so you won't be able to get the closest note.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
Yes, this is all true. What I like about a tabread is the possibility for quickly applying many different kinds of mappings, diatonic or otherwise -- if you assume a chromatic input (rather than a fully microtonal input -- ints instead of floats) this becomes quite a bit easier.
MB
On Mon, Mar 29, 2010 at 10:29 AM, Mathieu Bouchard matju@artengine.ca wrote:
You can also take your values mod 12 and use those numbers to read indices in a 12-member table you've populated with a mapping onto your favorite scale. If your values are floats you might round them first. You can also keep track of the whole-number quotient of your value divided by 12 so that you can get your specific octave back as well -- this gives you the equivalent of an "octave-pitch-class" notation, like the kind you might find in csound.
your method does not take into account that the mapping to the closest note has two different widths, 2 halftones for notes not next to a semitone interval, 1.5 halftone for those that are (Mi,Fa,Si,Do).
what I was alluding to, for multiple octaves, is to use something like [wrap], so that you can use a chain of [moses] made for one octave, removing the octave number before going into [moses] and putting back right after.
but since all ranges are multiples of a quartertone, one could multiply the midi note by 2, round, then go through a [tabread]. if you don't convert to quartertones, the rounding to the closest integer will conflict with the goal of rounding to the closest note, so you won't be able to get the closest note.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801