Saturday, October 8, 2016

Moving melodies up and down the ledger notes

I run into the problem of a melody tabulature that I want to move two or three semi-tones down the ledger.  The ledger is the column of note that define the horizontal line as in:

B3 -------h2-------q1

The h and q being the beat timing.
I want to move those notes to:

D3----------

Shift the notes down.

But note frequencies are all defined by integer powers of the magic ratio, so I can add and subtract exponents.  I take the relative steps of the note, add it to the exponent of the ledger line, add in my delta, then convert back, relative  to the second ledger line.  I just need to make sure I use modulo 12 arithmetic. (C8-C7=12).

So I just create functions that do modulo 12 arithmetic.    The ledger note gives the whole part and the tabulature beat givess you the fractional part.  Input and output of the arithmetic is always  string representing tabulature format.

Now, the moved notes are placed into a score sheet internal to Basic, but they can be extracted on a cell by cell basis so the inout and output scores both appear on the spreadsheet.  Just beware of the dependencies and use my technique for chaining macros.

MakeWave is strictly an audio synthesizer

So it knows nothing about western music, it just reads the numerical score sheet in units of beats. In fact, it knows nothing about the generation of notes by ratio. It works strictly from frequency lists.

Hence, the idea is to leave it alone, once stable, it has general use as an audio synthesizer.   Then I  create a grammar, or a set of macros to manipulate tabulature from the spread sheet.  Then we have a music grammar, based on the notion of scales, steps by power, western note notation; a basic algebra with the notation.  The macros just manipulate text, no wave generation.  But they generate score sheets that appear directly on the spread sheet, and these can generate a sound file.

The spread sheet is the perfect format for tabulature.  And with the general nature of the note ledger and the tabulature lines, across a rectangle, the beats are maintained.  Score sheets can be combined in various ways.

No comments: