Ning Hu and Roger B. Dannenberg
This page describes how to use the piano synthesizer in Nyquist.
Both SAL and Lisp syntax are used. Lisp syntax is in small type.
First, load the file "pianosyn.lsp" to initialize the synthesizer. The file is in the "lib" directory.
> load "pianosyn"
> (load "pianosyn")
After the piano synthesizer has been initialized and returns, you can use the functions provided by the synthesizer program to generate piano sounds.
The functions are shown as below:
Use the function:
piano-note(duration, step, dynamic)
(piano-note duration step dynamic)
Examples:
> play piano-note(4, 60, 100) > (play (piano-note 4 60 100))The commands above will generate and immediately play a C4 note that lasts 4 seconds, velocity at 100.
To convert a midi file to sound, use the function:
piano-midi(midi-file-name) (piano_midi midi_file_name)
To convert a midi file to a sound file using the piano synthesizer, use the function:
piano-midi2file(midi-file-name, sound-file-name) (piano-midi2file midi-file-name sound-file-name)
> exec piano-midi2file("demo.mid", "demo.wav") > (piano-midi2file "demo.mid" "demo.wav")