I’ve been working with HH on some interesting problems in musical synthesis — just having fun, not breaking new ground. We’ve worked up a small command line program, sf2a, which transforms solfa syllables into audio files. These were monophonic “compositions”, e.g. e do do q re do fa mi — two eighth notes followed by four quarter notes, a recognizable melody:-) It suffices to say
% sf2a 'allegro: e do do q re do fa mi' -o happy % play happy.wav
to play this melody. Or you could say just sf2a 'allegro: e do do q re do fa mi' -p to have the melody played forthwith.
It occurred to us that it would be interesting to be able to do the same with multi-voice compositions. A minimal example would be something like
voice1: w mi re voice2: w do_ sol_
Both voices move in whole notes. The second is an octave below the first. The solution to this little problem is amazingly simple and elegant. Intermediate files representing the sampled waveforms for voice1 and voice2 are generated. Think of them as representing columns of numbers. So we just add corresponding numbers together to make a third column. This is the sampled waveform for the two voices played together. Of course we all learned that in high-school physics: the superposition principle at work!
Here are the audio files:
voice1: E D + voice 2: C G = Counterpoint!
For the code, see HH’s blog, or our github repository.
zipTimer: an app for pacing your music practice – or any practice!