<< Chapter < Page | Chapter >> Page > |
Thus, the audio output provides an overview of the general shape of the graph. The data output is available for detailed quantitative analysis.
Continuing with the explanation of Sinc01 , Listing 17 shows the contents of the file named Sinc01Solver.bat . (This is a Windows batch file. A file with a similar purpose on other operating systems would be different.) If you have the Java Development Kit installed on your (Windows) computer, execution of this batch file will compile and execute the file named Sinc01.java . This will create the text file containing the data that is needed by the AudioGraph program named MusicComposer10 .
Listing 18 shows the contents of the file named Sinc01Player.bat . (Again, this is a Windows batch file.) If you have the Java Development Kit installed on your (Windows) computer, execution of this batch file will compile the file named MusicComposer10 and execute it twice. The first execution will cause the audio to be played immediately. The secondexecution will cause the audio to be saved in a file named Sinc01.au .
The zip file that you can download contains all of the files mentioned above for all of the functions illustrated by the audio in the above list . Simply extract the contents of the zip file into an empty folder, execute the ...Solver.bat files to create the data for the functions. Execute the ...Player.bat files to hear the audio for the functions and to write the audio into output audio files of type AU.
This program requires the following five classes in the same folder. Source code files for all five classes are provided in the zip file that you can download.
The first three classes in the above list have been used in many previous modules. Therefore, I won't discuss them further in this module. However, I will explainthe last two classes in the list.
A complete listing of the class named MusicComposer10 is provided in Listing 19 . As usual, I will break the class down and explain it in fragments.
This is a general purpose AudioGraph program that reads an input text file containing numeric values for y as a function of equally spaced values for xand produces an output melody that represents a graph of that data. The values for y are read as a comma-delimited list of values and are treated as type double . The name of the text file is input as a command-line parameter. Additional details will be provided later in the explanation of the class named AudioGraph01 .
The melody can be played immediately or can be saved in an audio file of type AU for playback later. You should be able to play the audio file with anystandard media player that can handle the AU file type
The class named MusicComposer10 begins in Listing 7 . Note the description of the command-line parameters in Listing 7 . Otherwise, there is nothing new or unusual about the code in Listing 7 so there should be no need for further explanation beyond the embedded comments.
Notification Switch
Would you like to follow the 'Accessible objected-oriented programming concepts for blind students using java' conversation and receive update notifications?