Installation
|
InstallationDownload jaclBinaryp from Tcl/Java Download Page and extract it, you will find jacl.jar and tcljava.jar under the folder, lib\tcljava1.4.0. Then download mdpw30.zip and extract it, you will find mdpw.jar. Add those three Jar files to your Java environment. There are at least three ways.
c:\mdpw\sample> dir /w ..\*.jar mdpw.jar jacl.jar tcljava.jar C:\mdpw\sample> dir /w jacl.bat sample.tcl C:\mdpw\sample> java -cp ..\mdpw.jar;..\jacl.jar;..\tcljava.jar tcl.lang.Shell sample.tcl C:\mdpw\sample> dir /w jacl.bat sample.tcl sample.mid C:\mdpw\sample> Top of this page| Next step How to make a noteI will show you an example of only one note first. This example if for jacl version "1.26". If you use older version of jacl, you may have to omit the first "package" line. mdpw.tcl,which is a file for utility functions, is in the sample folder. The arguments of :mn represent pitch(0-127), duration(positive double), velocity(0 - 127) and program number (0 - 127, 129) respectively.package require java java::load com.cwbp.mdpw.PlayExtension source mdpw.tcl play MIDIFilePlayer "note.mid" play tempo 60 play [:mn 60 1 64 0] play end exit 0 Top of this page| Next step How to make a SequenceYou can make a sequence of notes by function :ms. You only have to place notes in arguments of this function. In this sample, you will hear "C-D-E". If you omit arguments of :mn, the valeus of the note before are applied.package require java java::load com.cwbp.mdpw.PlayExtension source mdpw.tcl play MIDIFilePlayer "seq.mid" play tempo 120 play [:ms [:mn 60 1 64 0] [:mn 62 1] [:mn 64 1]] play end exit 0 Top of this page| Next step How to make a ChordThe function :mc can make a chord from notes in its arguments. This is a C major chord sample. If you omit arguments of :mn, the valeus of the note before are applied.package require java java::load com.cwbp.mdpw.PlayExtension source mdpw.tcl play MIDIFilePlayer "chord.mid" play tempo 120 play [:mc [:mn 60 2 55 0] [:mn 64] [:mn 67]] play end exit 0 Top of this page| Next step How to make a Musical pieceA musical piece is consist of sequneces and chords. :ms and :mc retrun list data in tcl. The data can be contain in :ms and :mc. You can make a list of arbitrary depth and a complicated musical piece. And you will find how to repeat by repeated invocation of play command.package require java java::load com.cwbp.mdpw.PlayExtension source mdpw.tcl set chord_c [:mc [:mn 60 2 0 0] [:mn 64 2] [:mn 67 2]] set chord_part [:ms $chord_c $chord_c] set melody [:ms [:mn 60 1 16 0] [:mn 62 1] [:mn 64 1] [:mn 64 1 0]] set phrase [:mc $melody $chord_part] play MIDIFilePlayer "sample.mid" play tempo 120 play $phrase play $phrase play end exit 0Enjoy your Music Programing. Top of this page |