<< Chapter < Page Chapter >> Page >

A template for evaluating functions

In addition to the AudioGraph generator program named MusicComposer10 , this module also develops a simple template for writing programs to evaluate functions and to write theresults into a text file. The zip file mentioned earlier contains the source code for programs to evaluate all of the functions in the above list . This template is so simple that a student with minimal programming knowledge could easily write her ownprograms to evaluate other functions. I will explain the template later .

The audio pulse rate

You may have noticed that the output pulses in most of the audio files in the above list are delivered to the speakers at a fairly rapid rate. The output pulse rate (in pulses per second) is specified by the user as a command-line parameter when the program is run. (Most of the examples in the above list were run at 12 pulses per second but Sinusoid01 was run at only 5 pulses per second.) An overview of the output from a function can be achieved using a fast output pulse rate. A more detailed audio analysis of the outputcan then be achieved by running the program with a slower output rate. And, if you need to do detailed numeric analysis, the numeric data is available forexamination in the corresponding text file.

Play or file ?

Another user input parameter specifies whether the melody is to be played immediately or is to be saved in an audio file for playback later. Saving it inan audio file makes it very convenient to listen to over and over to allow the information content to "sink into" the brain. In addition, a student can buildup a library of audio files for different functions for review later, such as when studying for a test.

Not a substitute for an embossed image

An AudioGraph is not a substitute for an embossed image of a graph. However, it may be much quicker and easier to produce, it may tell you if you need totake the time and effort to create an embossed image, and it may enhance the learning process even if you do produce an embossed image.

For the benefit of those students who have the ability to produce embossed images, the Figures section provides an image for each AudioGraph listed above . In addition, the downloadable zip file contains the JPEG files for those images.

Discussion and sample code

The program named Sinc01

Since this module is all about evaluating functions, I will begin with an explanation of the template that I have developed to evaluate a function and to writethe results of the evaluation into an output text file. A complete listing of the program named Sinc01 is provided in Listing 16 . As is my custom, I will break the program down and explain it in fragments.

This program produces an output text file containing values for y as a function of x for the so called sinc function (more on this later) .

The contents of the text file can be converted into audio and either played or written into an audio file of type AU for playback later using the programnamed AudioGraph01 .

A sinc function

The function that is evaluated by this program is the classic sin(x)/x function, otherwise known a the sinc function. It appears frequently in digital signal processing (DSP) and is one ofmy favorites.

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
Edgar Delgado
Start Quiz
Joanna Smithback
Start Quiz
Anonymous User
Start Quiz
Marion Cabalfin
Start Quiz