Monday, October 3, 2016

My spreadsheet piano is done

Code here.  It reads a rectangle of music score from your spreadsheet and generates a wave file.  It is multi-phonic, and plays chords.  There are some macros that generate the various notes from the magic ratio.  Multi-tonic notes are attenuated to prevent clipping, but you need to be careful with the volume control.  All parameters come from a second rectngle on your spreadsheet.

Not much code there, wav files, are easy,  These are all pcm 16 bit stereo, but the channels are duplicated.

The score is read and interpreted into a measure buffer with the odes needed to play.  The measure buffer is flushed to the file through the tone generator.  Everything is look up, almost, and computed as integer arithmetic on the indices.  One loop does it all.

But a great idea, generate wav files from the spread sheet, and the professional programmers should grab the few lines of code and make it better.

No comments: