<< Chapter < Page Chapter >> Page >

Run the program

I encourage you to copy the code from Listing 9 and Listing 10 . Retrieve the necessary source code for the other three classes from the module titled Jbs2010-Your First Sound Program . Compile the code and execute it. Experiment with the code,making changes, and observing the results of your changes. Make certain that you can explain why your changes behave as they do.

Miscellaneous

This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Jbs2040-An Audio Graph of a Sinusoid
  • File: Jbs2040.htm
  • Published: 08/27/14
  • Revised: 09/29/15
Disclaimers:

Financial : Although the OpenStax CNX site makes it possible for you to download a PDF file for the collection thatcontains this module at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, youshould be aware that some of the HTML elements in this module may not translate well into PDF.

You also need to know that Prof. Baldwin receives no financial compensation from OpenStax CNX even if you purchase the PDF version of the collection.

In the past, unknown individuals have copied Prof. Baldwin's modules from cnx.org, converted them to Kindle books, and placedthem for sale on Amazon.com showing Prof. Baldwin as the author. Prof. Baldwin neither receives compensation for those sales nordoes he know who does receive compensation. If you purchase such a book, please be aware that it is a copy of a collection thatis freely available on OpenStax CNX and that it was made and published without the prior knowledge of Prof.Baldwin.

Affiliation :: Prof. Baldwin is a professor of Computer Information Technology at Austin Community College inAustin, TX.

Complete program listings

Complete listings of two of the classes discussed in this module are provided below. Source code for the remaining three classes can be obtained from themodule titled Jbs2010-Your First Sound Program .

Listing 9 . The class named MusicComposer07.
/*File MusicComposer07.java Copyright 2014, R.G.BaldwinRevised 08/23/14 This program creates and plays an audio graph of a sinusoid. It works inconjunction with the following classes: AudioGraphSinusoidalAudioSignalGenerator02 AudioPlayOrFile01AudioFormatParameters01 The sound can be played immediately or can be saved in an audio file oftype AU for playback later. You should be able to play the audio file with any standard media player that can handle the AU file typeTested using JDK 1.8 under Win 7. ******************************************************************************/public class MusicComposer07{ //Instantiate an object containing audio format parameters with predefined// values. They may be modified by the signal generator at runtime. Values // allowed by Java SDK 1.4.1 are shown in comments in the class definition. AudioFormatParameters01 audioParams = new AudioFormatParameters01();//A buffer to hold the audio data that will be played or filed.byte[] melody;//A place to store the incoming args array.String[] args;//-------------------------------------------------------------------------// //Command-line parameter (only one parameter is needed)//If "play", the sound will be played immediately. Otherwise, the string will // be used as a filename for an audio file of type AU. In the latter case,// it must be a string that would be valid as a file name for the operating // system in use.public static void main(String[] args){//Instantiate a new object of this class. new MusicComposer07(args);}//end main //-------------------------------------------------------------------------//public MusicComposer07(String[]args){//constructor //Save the args array.this.args = args;//Create default args data if no args data is provided on the command line. if(args.length == 0){this.args = new String[1];this.args[0] = "play";//Play the melody immediately}//end if //Get a populated array containing audio data for white or pink noise.AudioGraphSinusoidal audioGraphSinusoidal = new AudioGraphSinusoidal(audioParams,this.args,melody);melody = audioGraphSinusoidal.getMelody(); //Play or file the audio datanew AudioPlayOrFile01(audioParams,melody,this.args[0]).playOrFileData();}//end constructor //-------------------------------------------------------------------------//}//end class MusicComposer07.java

Questions & Answers

price elasticity of demand is the degree of responsiveness of a quantity demanded to the change in price of the commodity in question.
Gladys Reply
what is the importance of learning economics?
Thelma Reply
it helps to make the correct choice
Gladys
it helps firm to produce products that will bring more profit
Gladys
the difference between needs and wants
londiwe Reply
needs are things that we basically can't live without wants are just luxury things
Thelma
needs are things without them we can't live but want are things without we can live
KP
what is education
KP
it's a process in which we give or receiving methodical instructions
Thelma
what is mixed economy
Amex
what is a deadweight loss? how monopoly creates a deadweight loss?
Ashraf Reply
who are u?
Lamine
haha
Cleaford
scarm
nura
what it this
Cleaford
hi y'all
Dope
how does group chat help y'all 🤔
Dope
hi y'all
Dope
how does group chat help y'all 🤔
Dope
how does group chat help y'all 🤔
Dope
to learn from one another
Lamine
oh okay
Dope
😟
Creative
Yes
Lamine
what is type of economic
taiwo Reply
how to understand basics of economics
Aarif Reply
what is demand schedle
Princess Reply
When you make a Scedule of the demand you made
Rodeen
this is helpful for rbi grade b
Prema Reply
What is macroeconomics
Kauna Reply
It's one of the two branches of Economics that deal with the aggregate economy.
Mayen
it's about inflation, occupation, gdp and so on
alberto
What is differences between Microeconomics and Macroeconomic?
Bethrand
microeconomics focuses on the action of individual agents in the economy such as businesses, workers and household. while macroeconomics looks at the economy as a whole. it focuses on broad issues in the economy such as government deficit, economy growth, levels of exports and imports, and
Thelma
inflationary increase in prices
Thelma
a price floor of 24 imposed
Annie Reply
monopolistic competition
bintu Reply
yap
nura
any one there to answer my question
Richard Reply
Fixed Costs per week Variable Costs per bear Rent & Rates of Factory Hire & machines Heating & Lighting Repayment of Bank Loan K100.00 K45.00 K5.00 K50.00 Materials Foam Wages K6.00 K1.00 K1.00 Total K200.00 K8.00
Richard
one of the scarce resources that constrain our behaviour is time. each of us has only 24 hours in a day. how do you go about allocating your time in a given day among completing alternatives? once you choose a most important use of time. why do you not spend all your time to it. use the notion of op
naknak Reply
mohsina mala..Bangla app hobe na
Dipam Reply
mani Baba. First learn the spelling of Economics
Dipam Reply
Economics- The study of how people use their limited resources to tey and satisfy unlimited wants.
Kelly
hmmm
Mani
etar bangla apps hobe na?
Mohsina
Difference between extinct and extici spicies
Amanpreet Reply
in a comparison of the stages of meiosis to the stage of mitosis, which stages are unique to meiosis and which stages have the same event in botg meiosis and mitosis
Leah Reply
Researchers demonstrated that the hippocampus functions in memory processing by creating lesions in the hippocampi of rats, which resulted in ________.
Mapo Reply
The formulation of new memories is sometimes called ________, and the process of bringing up old memories is called ________.
Mapo 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?

Ask