Feeds:
Posts
Comments

Posts Tagged ‘music’

Many changes. (1) New name –sf2a (2) source code is at github. (3) At github click on download button if you wish to download. (4) Installation on mac: untar or unzip downoaded file, cd to the resulting folder, run sudo sh setup.sh -install YOUR_USER_NAME; (5) after install, run sf2a 'do re mi' A file out.wav should be created. This is the audio file. (6) There is a musical dictation program, dict that creates audio files and a web page for dictation exercises based on the data in a text file. Use the file dictation.txt in the install folder for an example. Just run dict -m in that folder, then open the web page index.html. (7) For a draft manual, see this web page.

All this works on a mac. Adapting it to Linux is easy. Just change the values of $INSTALL_DIR and $BIN_DIR in setup.sh. I don’t know enough about PC’s to advise on this — one ought to be able to modify the file setup.sh

Advertisements

Read Full Post »

We combine the power of tfork and text2sf with the magic of unix to construct a sound file for an A major chord.

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

A Chord

In Audio Programming 1, we compiled the tfork.c program in chapter 1 of the Audio Programming Book, Richard Boulanger and Victor Lazzarini, editors. This program , together with text2sf, gave us the tools needed to algorithmically construct simple sounds, namely an exponentially decaying sine wave. We used these tools to fabricate a file that represents the sound of a tuning fork.

Simple as these two tools are, they gives us the means to construct more complicated sounds without any additional C programming (fun though that is!). We will use the magic of unix. To begin, a short shell script:


# Language: unix/sh
# File: sound.sh
# Example: sh sound.sh 440 a --- writes text representation of
# a 0.2 second 220 Herz sound to a file a.txt

./tfork $2.txt 0.2 $1 44100 0.2

Using sound.sh, we make four sounds, each 0.2 seconds in duration, with frequencies of 220, 275, 330, and 440 Hertz. These correspond to the notes A, C#, E, and A’ = A one octave higher. The frequency ratios are C#/A = 5/4, E/A = 3/2, and A’/A = 2. Thus we are using Pythagorean tuning, in which pitch ratios in the scale are rational numbers with small numerator and denominator.

Let us now execute the following commands:


% sh sound.sh 220 a
% sh sound.sh 275 c#
% sh sound.sh 330 e
% sh sounds.sh 440 a2

The result is the creation of text files a.txt, c#.txt, etc., which represent the given sounds. Next, we concatenate these files, putting a.txt first, c#.txt next, etc:


% cat a.txt c#.txt e.txt a2.txt >chord.txt

Then, we convert chord.txt into a .wav file:


% text2sf chord.txt chord.wav 44100 1 1.0

To conclude, we play the file:


play chord.wav

Here is the sound:

A MAJOR CHORD

Clearly there is more to do, among which are  (1) Clean up this sound: it needs to fade cleanly into silence; (2) Develop a mini language for transforming a sequence of pitch names into a sound file; (3) make more complex sounds.

HH

Read Full Post »

When I was recovering from a serious coding binge back in Iceland, long walks along the seashore and playing the piano were the two things that saved me. Since then, I’ve tried to lead a more balanced life: no coding after sundown, a mix of activities — reading, walking, seeing friends, hanging out at the neighborhood bar, cooking, playing music. The point is to do several things, not just one — one terrible thing that swallows up both the day and the night, demanding your full attention for five, ten, fifteen, twenty hours at a stretch until you finally lie exhausted, shipwrecked in the dawn, clinging to the foot of the bed as if it were a lifeboat, the mess of dishes and books piled high, crowding the sacred space before the altar of the computer.

I’ve tried to keep this healthy routine, part of which is to meet with friends every Thursday to play music. We are so-so amateur musicians, but we have a lot of fun, and also a new “activity:” each of us brings an original composition to play, either individually, or as a group. Well, at the beginning we were pretty bad, but we have learned a lot, and we have had a lot of good times. One of the house rules is that after a piece is played, we all have to improvise on it. This way we all share in the embarrassment, the good musical moments, as well as the beer! I promise to post something of my own soon, since the last person to do so has to buy food and drink for the whole group. I am, however, taking the liberty of linking to a piece by one of the other players:

short piece for solo cello

There is more … this is just the first line of the piece:-)

HH

Read Full Post »

next: action on the home front

At university in Iceland, I studied physics, literature, and graphics design. After graduation, I found work at an advertising agency as a designer. The creative side of the job, especially the art, suited me, but the office chit-chat and politics clashed with my taciturn nature. Frustrated by my square-peg-in-round-hole status, I went back to university, obtaining a masters degree in mathematics after more than the usual number of years. Student life was the perfect arena for the exercise of one of my character disorders: following the interest-of-the-moment rather than doing what I should. The damage done by weeks of inattention to my classes could be repaired by a three-day binge of studying. Yes! I could out-concentrate the most obsessive of the obsessed among my fellow students, even Harald Haraldsson himself!! Out in the real world once again, I found a series of odd jobs, few lasting for more than a year. Waiter at a local restaurant, copy editor for a newspaper, writer of advertising copy, web design. Etc.

It was in the web design job that I learned about programming. For extra money and as a kind of challenge, I started writing software. Creating and shaping code soon morphed from a pastime into a monster that devoured both day and night. I would wake up on the living room couch, exhausted from a three-day binge in a labyrinth of logic, data structures, and context-free grammars, unable to stand the sunlight streaming in from the windows that looked out onto the sea, books, papers, and dinner plates scattered across the room in revolting disorder.

The beast was destroying me. Alcohol could not have been worse, though I barely touched it. A year ago I went cold turkey, writing no software for eight months. A small inheritance helped me to survive during this period, though the money did not go far. I played the piano, tried to compose music, and took long walks by the sea to calm my nerves.

Then, partly due to the economic crisis in Iceland, I decided to come to the US. I needed work, and one of the few options open to me was to resume software development. I am giving it a try, but this time under strict guidelines: I write code only during daylight hours, and preferably in latitudes where neither day nor night last too long, where the Earth itself lives from season to season with less dramatic swings of mood. The hours of darkness are reserved for music and a long-delayed writing project.

So far the experiment has worked. A few dollars are flowing in, and the old obsession seems to have been tamed for now. I live, as always, a somewhat reclusive life. I prefer it that way.

– HH

Read Full Post »