Add a Note class with frequency, duration, and volume. This note class is independent of what waveform (instrument) is used to play the note---its just an abstract "note".
A note with frequency 0 can be considered a "rest".
Implement constructors, getters and setters, toString and equals. (Let frequency 0 indicate a rest, let duration be in "beats", where 1 is one beat, 1/2.0 is a half beat 1/4.0 is a quarter beat,etc.). Volume is a double between 0 and 1 (1 is max.) Throw IllegalArgumentExceptions for negative frequencies, negative beats, 0 length or negative length durations, and volume outside range of 0 to 1 inclusive.
Add NoteTest.java with JUnit tests including testing for exceptions for illegal argument values.
Then define a Melody class that extends ArrayList.
Then implement a "play" method that uses the ADSREnvelopedContinuousSound class to play the melody--modelled after the main method of ADSREnvelopedContinuousSound. Make it a method that could be called from a main. The parameters should be an envelope and a Melody. Scale the envelope levels for each note by the volume level of that note.
Create a main that takes a simple hard-coded melody (hard coded as initializations into an ArrayList) and plays it as a demo. The envelope could be hard coded too, or better yet, taken from command line parameters. (There could be a default if no parameters are entered.) This is a first step towards a later issue where the melody is read into the ArrayList from a file, or created via a a GUI and stored in a binary file with Serialization, XML, or JSON.
Add a Note class with frequency, duration, and volume. This note class is independent of what waveform (instrument) is used to play the note---its just an abstract "note".
A note with frequency 0 can be considered a "rest".
Implement constructors, getters and setters, toString and equals. (Let frequency 0 indicate a rest, let duration be in "beats", where 1 is one beat, 1/2.0 is a half beat 1/4.0 is a quarter beat,etc.). Volume is a double between 0 and 1 (1 is max.) Throw IllegalArgumentExceptions for negative frequencies, negative beats, 0 length or negative length durations, and volume outside range of 0 to 1 inclusive.
Add NoteTest.java with JUnit tests including testing for exceptions for illegal argument values.
Then define a Melody class that extends ArrayList.
Then implement a "play" method that uses the ADSREnvelopedContinuousSound class to play the melody--modelled after the main method of ADSREnvelopedContinuousSound. Make it a method that could be called from a main. The parameters should be an envelope and a Melody. Scale the envelope levels for each note by the volume level of that note.
Create a main that takes a simple hard-coded melody (hard coded as initializations into an ArrayList) and plays it as a demo. The envelope could be hard coded too, or better yet, taken from command line parameters. (There could be a default if no parameters are entered.) This is a first step towards a later issue where the melody is read into the ArrayList from a file, or created via a a GUI and stored in a binary file with Serialization, XML, or JSON.
~estimated 360