<< 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.

The file named Sinc01Solver .bat

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 .

The file named Sinc01Player .bat

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.

The class named MusicComposer10

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.

  • AudioSignalGenerator02
  • AudioPlayOrFile01
  • AudioFormatParameters01
  • MusicComposer10
  • AudioGraph01

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

Beginning of the class named MusicComposer10

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.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Accessible objected-oriented programming concepts for blind students using java. OpenStax CNX. Sep 01, 2014 Download for free at https://legacy.cnx.org/content/col11349/1.17
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Accessible objected-oriented programming concepts for blind students using java' conversation and receive update notifications?

Ask