/* $XConsortium: README /main/3 1996/07/15 14:07:33 drk $ */ Piano V2 --------- The Piano demo shows how one might write a MIDI (MOTIF INTERFACE to DUMB INSTRUMENTS) application. Both a staff, for writing music, and keyboard are provided. Piano is a musical demo that allows multiple voices to be played by connecting to other displays. It also provides the capability to save and restore voices. When running the program, you can either play the keyboard directly by 'tickling the ivories' using Button1, or you can enter notes by pressing Button 1 on the staff and depositing the active note specified by the cursor. To change the active note, select another note or rest in the pallet at the bottom. The selected note will be displayed as the new mouse cursor. Though the note selection is limited, it is possible to play sharps as well as naturals. The interface isn't advanced enough to handle flats. Note that E# will play as F and B# will play as C. The staff will automatically resize larger as notes are added past the right side of the staff. To see these notes, scroll the score window as needed. If you wish to delete a note in the staff, press Button2 over the note. The note will disappear and the notes to the right will shift over. Pressing Button3 over the staff will display a popup menu associated with this staff. It contains the following items: Add Voice - This function is used to connect another display to a new staff. After selecting this command, you will be prompted for the display to connect. Any music written in the new staff will play to this display. Note that pressing the right mouse button on the new staff will show the name of the display in the menu's title. In addition, this menu's commands will relate to this staff. The new staff will be added to the bottom of the score and it may be necessary to scroll down to make it visible. Remove Voice - Removes a staff and voice from the score. There is no undo for this command - all music written in this staff will be deleted. Clear Voice - Removes all notes in a staff. This will not effect the display connection. Play Voice - Plays the notes in the selected staff. If the resource, useKeyboard, is set to True, which is the default, the keyboard will play along. Play All - Plays all voices in the score together. Save Voice - Saves the selected voice to a file. A FileSelectionDialog will be displayed to prompt for the name of the file in which to save the voice. The display connection information is not saved. Load Voice - Loads a voice from a file. This will append to any existing notes in the voice. Piano also supports the following resources: baseDuration - sets the duration of a quarter note. (msec) Default value = 200 baseFrequency - sets the frequency of bottom note. (Hz) Default value = 246.9413 useKeyboard - specifies if keyboard should play along. Default value = True wkeyCount - number of white keys on the keyboard. Default value = 28 keyHeight - initial height in pixels of the white keys. Default value = 160 keyWidth - initial width in pixels of the white keys. Default value = 20 Two voices are included with the demo, Inv8_part1.piano and Inv8_part2.piano. These are the two voices of Bach's Invention #8. Try loading these into two voices connected to different displays and play them together. PROBLEMS ======== - So far, changing the pitches doesn't seem to work on SUN, DEC PMAX3100, and SGI Personal Iris. On the RS6000 and HP700 things should work fine. If XBell() doesn't work correctly on your system change the PlayNote() function as needed. ----- Enjoy, Andrew deBlois