Feeds:
Posts
Comments

Archive for March 12th, 2011

In version two of solfa2sf: we can enter rhythm as well as pitch values, and we can control tempo and note decay

1 | 2 | 3 | 4 | 5 | Source Code

Source Code for solfa2sf

The first version of solfa2sf took a string of solfa syllables and produced a .wav sound file representing it. This was good as a start, but we want to do more! In particular, we would like to be able to give different rhythm values to the notes. I’ve posted an improved version of solfa2sf that does just this. One can use the program on the command line like this

solfa2sf foo '| q do2 . e mi2 do2 . q sol sol |'

The result is a file foo.wav:

foo

It represents a melody that starts with a quarter note C above middle C, continues with a pair of eighth notes, and ends with a pair of quarter notes.

To work with longer bits of music, it is best to write the solfa in a text editor, then compute the sound file like this.

solfa2sf -f theme.solfa

The file (theme.solfa) is this text below


tempo:120
decay:0.3
| q do2 . e mi2 do2 . q sol sol |
| do2 . e mi2 do2 . q sol sol2 |
| e fa2 mi2 re2 do2 . ti do2 ti do2 |
| re2 do2 ti la . q sol x |

The symbols || . | have no effect on the program and could be omitted. They do help the human who reads or composes tis text, however. The possible rhythm values at this moment are w (whole note), h (half note) q (quarter note), e (eighth note), and s (sixteenth note). The command tempo:120 sets the tempo, and decay:0.1 determines how fast a note trails off into silence: Increase it to make the sound more sustained, decrease it to make it more percussive.

Below is the sound file. Click the link to play it. Do you recognize the piece? I studied it as a child back in Iceland.

theme.wav

HH

Read Full Post »