<< Chapter < Page Chapter >> Page >

An audio graph of a square wave

I explained the concept of an audio graph in the earlier module titled Jbs2000-What is Sound? but I will explain it again here for your convenience. (Click AudioGraphSquareWave to hear an audio representation of the graph of a square wave.)

This audio graph file contains an 8-second melody consisting of 32 uniformly spaced pulses at different frequencies. The frequencies (pitches) of the pulses are centered on middle-C (261.63 Hz) . The frequency deviation from middle-C versus time is based on a square wave function with a frequency of0.5 Hz.

Points on graph

Each pulse represents one point on a graph of the square wave. Pulses with frequencies at or above middle-C are delivered to the left speaker. Pulses withfrequencies below middle-C are delivered to the right speaker.

The audio output can be thought of as an audio representation of a graph of a square wave. Pulses with frequencies above middle-C represent points on thepositive lobe of the square wave. Increasing pitch represents increasing amplitude on the graph of the square wave.

Pulses with frequencies below middle-C can be thought of as representing points on the negative lobe of the square wave. In this case, decreasing pitchrepresents points on the square wave that are further from the horizontal axis in the negative direction.

Pulses with a frequency of middle-C can be thought of as representing points on the horizontal axis with a value of zero but there are no points on thehorizontal axis for a square wave.

Four complete cycles of the 0.5 Hz square wave are represented by the 32 pulses in the 8-second melody.

Hopefully, by listening to this audio file, you can get an idea of the shape of a square wave.

Discussion and sample code

This program requires the following five classes:

Three classes are unchanged

I won't bore you by repeating the discussion from earlier modules. The first three classes in the above list are completely unchanged from the module titled Jbs2010-Your First Sound Program . Therefore, I won't discuss them furtherin this module.

The class named MusicComposer05

The class named MusicComposer05 differs from the previous version only in the following respects:

  • Changes in the explanatory comments.
  • Replacement of the term WhiteNoise with the term SquareWave .
  • Replacement of the term whiteNoise with the term squareWave .

Therefore, I also won't discuss this class further in this module.

The class named SquareWave

A complete listing of the class named SquareWave is provided in Listing 11 . I will break this class down and explain it in fragments.

Beginning of the class named SquareWave

The sound that you heard when you listened to the audio file named SquareWave was produced by the getMelody method of the SquareWave class. The SquareWave class begins in Listing 1 and the getMelody method begins in Listing 2 .

The code in Listing 1 differs from the corresponding WhiteNoise code from the earlier module only with respect to the name of the class.Therefore, I won't discuss it further.

Questions & Answers

what's Thermochemistry
rhoda Reply
the study of the heat energy which is associated with chemical reactions
Kaddija
How was CH4 and o2 was able to produce (Co2)and (H2o
Edafe Reply
explain please
Victory
First twenty elements with their valences
Martine Reply
what is chemistry
asue Reply
what is atom
asue
what is the best way to define periodic table for jamb
Damilola Reply
what is the change of matter from one state to another
Elijah Reply
what is isolation of organic compounds
IKyernum Reply
what is atomic radius
ThankGod Reply
Read Chapter 6, section 5
Dr
Read Chapter 6, section 5
Kareem
Atomic radius is the radius of the atom and is also called the orbital radius
Kareem
atomic radius is the distance between the nucleus of an atom and its valence shell
Amos
Read Chapter 6, section 5
paulino
Bohr's model of the theory atom
Ayom Reply
is there a question?
Dr
when a gas is compressed why it becomes hot?
ATOMIC
It has no oxygen then
Goldyei
read the chapter on thermochemistry...the sections on "PV" work and the First Law of Thermodynamics should help..
Dr
Which element react with water
Mukthar Reply
Mgo
Ibeh
an increase in the pressure of a gas results in the decrease of its
Valentina Reply
definition of the periodic table
Cosmos Reply
What is the lkenes
Da Reply
what were atoms composed of?
Moses Reply
what is chemistry
Imoh Reply
what is chemistry
Damilola
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

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