At 03:01 AM 3/30/2004, Matthias.Bode@oppenheim.de wrote:
>Hello Steve, hello Marc,
>sorry, I wanted to be concise but was imprecise.
>1. I have music notes (a song) on paper (classical five line system).
>2. I identify (the key) the note(s) and pauses; e.g. "a" (= 440 Hz). (I can
>calculate the frequency for each note.)
>3. How to input this information into Mathematica in order to make it *play*
>4. I do *not* want to write notes in classical notation on paper using
>5. I used "Scale" and entered frequencies: Unsatisfactory and clumsy because
>a longer note has to be put in several times, speed is a problem as well.
I think the open source Java software called JFugue (www.jfugue.org) will
do exactly what you want.
Here is a simple example of playing a song using J/Link. Note that you will
need to change the path below to point to your top JFugue directory (the
place where jfugue.jar is located). This will play a very convincing piano
rendition of Frere Jacques:
pathToJFugue = "d:\\javatools\\jfugue";
player = JavaNew["org.jfugue.Player"];
"C5q D5q E5q C5q C5q D5q E5q C5q E5q F5q G5h E5q F5q G5h G5i A5i
G5i F5i E5q C5q G5i A5i G5i F5i E5q C5q C5q G4q C5h C5q G4q C5h"];
Note that the music is entered in a simple notation giving the note name,
the octave (C5 is middle C), and the duration (q=quarter-note,
i=eighth-note, etc.) JFugue is well documented, easy to use, and very
powerful. It has the ability to do multiple voices, chords, various
instruments including percussion, etc. (the docs have a nice example of
Frere Jacques as a round), and of course it is all incredibly simple to
script from Mathematica using J/Link. Tinkering with a program like this is
an excellent example of why interactive development with Mathematica and
J/Link is often a better Java environment than Java itself.