<< Chapter < Page Chapter >> Page >

Code reuse

It is unlikely that the class named AudioPlayOrFile01 will be modified throughout the next several modules. Therefore, unless I change the name of the class, (which I will do if I modify the file) , you will only need to copy and compile the source code once. After that, you can simply copy the compiled class file from oneproject folder to the next.

The class named AudioFormatParameters01

An object of the class named AudioFormatParameters01 is simply a container for some of the parameters required by the class named AudioPlayOrFile01 . A complete listing of the class named AudioFormatParameters01 is provided in Listing 13 .

With the exception of bigEndian , the comments should be sufficient to describe the parameters. If you would like to learn more about bigEndian , simply Google it.

Disk organization

Although there are more elegant ways to organize your disk by making use of the classpath environment variable, unless stated otherwise, the disk organization that I will use in this collection of sound modules will not usethe classpath environment variable.

With the exception of the classes in the Java Standard Edition library, these modules will assume that source code files or compiled class files for allrequired classes are physically contained in the folder from which the program is executed. For the program that I will explain in this module, this means that the following source code orcompiled class files must be contained in the execution folder:

  • MusicComposer04
  • AudioSignalGenerator02
  • WhiteNoise
  • AudioFormatParameters01
  • AudioPlayOrFile01

The class named MusicComposer04

An object of this class creates and plays three seconds of monaural white or pink noise. It works in conjunction with the following classes:

  • WhiteNoise
  • AudioSignalGenerator02
  • AudioPlayOrFile01
  • AudioFormatParameters01

The sound can be played immediately or can be saved in an audio file of type AU for playback later. (Click WhiteNoise to download and play the audio file produced by this program.)

A complete listing of the class named MusicComposer04 is provided in Listing 14 . I will break this code down and explain it in fragments. The first fragment isshown in Listing 1 .

Beginning of class MusicComposer04

Listing 1 shows the beginning of the class named MusicComposer04 along with the main method.

Listing 1 . Beginning of the class named MusicComposer04.
public class MusicComposer04{ AudioFormatParameters01 audioParams = new AudioFormatParameters01();byte[] melody;String[] args;//-------------------------------------------------------------------------// public static void main(String[]args){ new MusicComposer04(args);}//end main //-------------------------------------------------------------------------//

The instance variables

The first instance variable named audioParams instantiates and saves a reference to anobject containing audio format parameters with predefined values. They may be modified by the signal generator later at runtime. Values that areallowed by Java SDK 1.4.1 are shown in comments in the class definition for the class named AudioFormatParameters01 .

Questions & Answers

anyone know any internet site where one can find nanotechnology papers?
Damian Reply
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
characteristics of micro business
for teaching engĺish at school how nano technology help us
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
what is the actual application of fullerenes nowadays?
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Do you know which machine is used to that process?
how to fabricate graphene ink ?
for screen printed electrodes ?
What is lattice structure?
s. Reply
of graphene you mean?
or in general
in general
Graphene has a hexagonal structure
On having this app for quite a bit time, Haven't realised there's a chat room in it.
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
many many of nanotubes
what is the k.e before it land
what is the function of carbon nanotubes?
I'm interested in nanotube
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!

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?