Project Documentation - B7
From SoftwarePractice.org
Contents |
Digital Music Sample - The Team
The project we are to be working over the semester will be the Digital Music Sampler.
Our Team is B7 and consists of Gordon Wong, Jeffrey Scarra, Atttaporn Phuangpee, Van Nguyen
We will be following the Minniture Unified Process (MUP) we created, in order to finish our Digital Music Sampler project.
Analysis of The Project
The Digital Music Sampler is a system that digitally records an audio file from a musical instrument or any other sound source. The system then allows the user to play back previously recorded sounds via an electronic (piano-like) keyboard User interface. The main system can be divided into 4 parts:
User Interface
The graphical user interface (GUI) is the interface between the user and the sampler. The GUI uses graphical images and texts to represent any information's and actions that available to the user. For the project, GUI would include some important control interfaces such as volume, octave, pith, record, playback, and piano-like keyboard.
Recorder
The functionality of the recorder is to record and store sounds from inputs such as from a microphone. The user would be able to record sounds and save them as a wave file. Then the system would allow the user to assign each file to the key on the keyboard as they wish. Additionally, the user could access the files at any times, if they could modify by the user, for example, trimming, or deleting.
Trimmer
Trimming is a function that lets the user remove parts of a particular audio file (i.e. silence before and after the recorded 'voice'). Having this option would add a further level of control to the user, in terms of managing the storage size of the file, and provide a more desirable output.
Audio player
Now that the system could record the sound, it would not be as useful, if you could not monitor it. The Audio Player is the class that stores the locations of the recorded 'voices'. This class is called upon when the user plays a key that is no longer set as a particular wave file, it is the job of this class to find that wave file and output the sound.
System Inputs And Outputs
The system inputs would be a recorded sound, which records through a sound card of the computer using a microphone. The recorded sound will keep as a .wav file on the local folder of the computer, this will enable user to assign each files accordingly to the key of keyboard. Furthermore, the system will allow user to edit the file such as trimming, adding, or deleting a particularly sound file. The output of the system will be an audio sound that plays back by the sound card.
| User Inputs | System Outputs |
|---|---|
| Clicks Mouse on Key | Plays corresponding sound |
| Presses 'q' on keyboard | Plays Corresponding sound |
| Presses 'w' on keyboard | Plays Corresponding sound |
| Presses 'e' on keyboard | Plays Corresponding sound |
| Presses 'r' on keyboard | Plays Corresponding sound |
| Presses 't' on keyboard | Plays Corresponding sound |
| Presses 'y' on keyboard | Plays Corresponding sound |
| Presses 'u' on keyboard | Plays Corresponding sound |
| Presses 'c' on keyboard | Plays Corresponding sound |
| Presses 'a' on keyboard | Plays Corresponding sound |
| Presses 's' on keyboard | Plays Corresponding sound |
| Presses 'd' on keyboard | Plays Corresponding sound |
| Presses 'f' on keyboard | Plays Corresponding sound |
| Presses 'g' on keyboard | Plays Corresponding sound |
| Presses 'h' on keyboard | Plays Corresponding sound |
| Presses 'i' on keyboard | Plays Corresponding sound |
| Presses '1' on keyboard | Plays Corresponding sound |
| Presses '2' on keyboard | Plays Corresponding sound |
| Presses '3' on keyboard | Plays Corresponding sound |
| Presses '4' on keyboard | Plays Corresponding sound |
| Presses '5' on keyboard | Plays Corresponding sound |
| Presses '6' on keyboard | Plays Corresponding sound |
| Presses '7' on keyboard | Plays Corresponding sound |
| Presses '8' on keyboard | Plays Corresponding sound |
| Presses '9' on keyboard | Plays Corresponding sound |
| Presses '0' on keyboard | Plays Corresponding sound |
| Move "Pitch Slider" to +0.5 | Increase the tone by 0.5 |
| Move "Pitch Slider" to +1 | Increase the tone by 1 |
| Move "Pitch Slider" to -0.5 | Decrease the tone by 0.5 |
| Move "Pitch Slider" to -1 | Decrease the tone by 0.5 |
| Move Octave Slider up or down | Moves the position of the key according to the keyboard |
| Move Volume up or down | Increase or decrease the sound |
| Click Mute | Moves the volume bar to 0 |
Stakeholders
The highlighted Stakeholders are:
1. Developer - Initial design, implementing the program, writing documentation, testing.
2. User - operating, using, and assisting Developer for the design of system.
3. Musician - correcting sound, quality control.
Usage Scenarios
Scenario 1
- Paul wants to play the keyboard, whilst constantly changing the pitch.
Scenario 2
- Sarah wishes to record and save her guitar notes, so that Paul can play it on the keyboard later.
Scenario 3
- Paul wants to play, using Sarah's previous guitar "voices"
Scenario 4
- Paul expects the keyboard notes to be a 'natural sound', that is so the sound of multiple notes can overlap each other.
Scenario 5
- Sarah wants to trim the sound to remove the silence from the start and end of the recorded sound.
Use Cases
The Use Cases are listed below, which explains how the users ("Actor") should interact with the system:
Playing keyboard using Mouse
| User | System |
|---|---|
| 1. Opens Program | |
| 2. Loads GUI with default settings | |
| 3. Clicks interface with mouse on key | |
| 4. Plays note through speakers as clicked | |
| 5. Clicks interface with mouse on key, again | |
| 6. Repeat Steps 5 & 6 until finished playing | |
| 7. User Clicks Exit | |
| 8. Program Quits |
Recording
| User | System |
|---|---|
| 1. Chooses Record Interface | |
| 2. Loads Recorder window | |
| 3. Clicks Record | |
| 4. Creates new wave file | |
| 5. User plays the sound into the mic 6. User Clicks Stop | |
| 7. Saves 'voice' to created wave file 8. Displays save file name |
Changing the Pitch
| User | System |
|---|---|
| 1. Opens Program 2. Plays Keys using keyboard | |
| 3. Plays corresponding Sound | |
| 4. Changes the Pitch to -1 using the Slider | |
| 5. Adjusts Pitch to -1 | |
| 6. Plays Same note again | |
| 7. Plays corresponding sound with new pitch | |
| 8. Clicks Default Button | |
| 9. Returns Pitch to default value | |
| 10. Clicks Exit | |
| 11. Program Closes |
Trimming
| User | System |
|---|---|
| 1. Opens Trimmer mode | |
| 2. Loads Trimmer Interface | |
| 3. Opens 'voice' | |
| 4. Load 'voice' into trimmer | |
| 5. Edits and saves the 'voice' | |
| 6. Edits the file and replaces the existing file |
Class Diagrams
The systems' class diagram is listed below. The class diagram has shown the attributes, and the relationships between the classes of Digital Music Sampler.
Function List
Below is a table of medthods for each classes
| SynthUI | Keyboard | Key | Synth Controller | Recorder | MainApp | AudioPlayer | MidiPlayer | MidiNote | Trimmer |
|---|---|---|---|---|---|---|---|---|---|
| getVolume() | KeyBoard constructor | Key constructor | SynthController constructor | Recorder constructor | void main(String[]) | AudioPlayer constructor | MidiPlayer constructor | MidiNote constructor | Trimmer constructor |
| getOctave() | void createPitchValues() | void keyPressed() | void playNote(int note) | void startRecording() | void getInputStream() | void open() | void setVolume(int) | void load() | |
| setVolume(int Volume) | void createKeys() | void keyReleased() | void playNote(MidiNote note) | void stopRecording() | SourceDataLine getLine() | void close() | int getVolume() | void play() | |
| setOctave(int Octave) | Key getBKey(int i) | void createPopupMenu(KeyAction kAct) | void changeInstrument(int) | File getNewFile() | void start() | void playNote(int, int) | void setPitch(int) | void trim() | |
| setPitchBend(int PitchBend) | Key getWKey(int i) | File getFile(); | void playBack() | void run() | void run() | void playNote(MidiNote) | int getPitch() | void save | |
| setMute(int MUTE) | getKey(String) | void recording(boolean record, boolean clearRecords) | void stop() | void setPitchBend(int) | void setTime(long) | void createWaveForm(byte[]) | |||
| getPitch() | getPitchValue(String) | boolean hasPitchBend() | long getTime() | void paint(Graphics) | |||||
| getInstrument() | void changeInstrument(int) | void setInstrument(int newValue) | AudioFormat getFormat() | ||||||
| getMidiNote(int note) | int getInstrument() | void setFormat(AudioFormat) | |||||||
| void keyPressed() | |||||||||
| void keyReleased() |
Sequence Diagrams
- Recorder
- Playback Original Sound
- Selecting Files to key
- Playback Custom Sound
- Pitch
- Trimmer
Pre And Post Conditions
This section is a pre & post condition for classes
MainApp
post-conditions:
|
SynthUI
post-conditions:
|
Keyboard
post-conditions:
|
SynthController
post-conditions:
|
Key
post-conditions:
|
MidiNote
post-conditions:
|
AudioPlayer
post-conditions:
|
Recorder
post-conditions:
|
MidiPlayer
post-conditions:
|
Trimmer
post-conditions:
|
Test Cases
he test case is a method that tests the functionality of system. The test that carries out below is to determine whether the system has met all the designing requirements.
Scenario 1:
- Open GUI
- Play the desired note (example Middle C)
- Play the note above (example D)
- Move the pitch Slider to 1
- Play the original key again (middle C in this Case)
- Test to see if Step 5 sounds the same as step 3
- If so test is successful, If not failed
Changing the Pitch Test
| Actions | Inputs | Results | Pass/Fail |
|---|---|---|---|
| 1. Opens Program Digital Music Sampler | N/A | Check the Pitch should be at 'Normal' position, which is a default | Passed |
| 2.Press a 'C' key using the mouse Listen to the sound and take to note of it | C | N/A | Passed |
| 3. Slide the Pitch to -1 using mouse to slide the Pitch bar | 0 | At-1 position | Passed |
| 4. Press a 'C' key again Listen to the sound and take to note of it | N/A | The sound should be different sound form step 2. | Passed |
| 5. Now slide the Pitch to +1 using mouse to slide the Pitch bar | N/A | At +1 position | Passed |
| 6. Press a 'C' key again Listen to the sound and take to note of it | N/A | The sound should be different sound form step 2. | Passed |
| 8. Clicks Default Button | 16383 | Returns Pitch to default value - Normal | Passed |
| 9. Clicks Exit | N/A | Program closes | Passed |
Scenario 2:
- Open GUI
- Select record Mode Button
- In the Recorder Window, Select record Button
- Then click stop (after recording the sound via the microphone input)
- Ignore trimming
- Exit recorder window
- Check if the file has been created, if not created test failed.
Recording Test
| Actions | Inputs | Results | Pass/Fail |
|---|---|---|---|
| 1. Opens Program Digital Music Sampler | Click on the "Record" button | The recording user interface is open | Passed |
| 2. Start recording | Press the 'Record' button | The recording is started, and the button caption changed to "Stop" | Passed |
| 3. Recording | feed sound to the microphone | the sound is recorded | Passed |
| 4. Stop recording | Press the 'Stop' button | The recording is stop and "voice0.wav" is saved and button caption now changed to Record and ready for next recording... | Passed |
| 5. Close the window | Click on the Close "X" button | Window closes and return to main application | Passed |
| 6. Testing the recorded sound | Complete scenario 3 (Playing wav files Test) | The recorded sound is playing back successfully | Passed |
Scenario 3:
- Open GUI
- Right Click on the Key (this instance middle C)
- Select 'select sound...' option
- Choose the desired wave file (in this case sample1.wav)
- Test whether the "voice" is played once that Key is pressed. If so then test successful.
Playing wav files Test
| Actions | Inputs | Results | Pass/Fail |
|---|---|---|---|
| 1. Opens Program Digital Music Sampler | N/A | The Graphic user interface would pop up | Passed |
| 2.Right click on the middle key "c" | N/A | Another Graphic user interface pops up with two options (use default sound, select sound...). | Passed |
| 3. Click on "Select sound..." button | N/A | A new user interface would appear with a list of .wav files you recorded beforehand | Passed |
| 4. Select the wav file for the middle key "c" (this case voice0.wav) | voice0.wav | Sample1.wav would be loaded onto the key "c" | Passed |
| 5. Press the middle key "c" | voice0.wav | The voice0.wav file should be played instead of the default sound file. | Passed |
| 6. Clicks Exit | N/A | Program exits | Passed |
Scenario 4:
- Open GUI
- Play several "natural" keys in rapid succession
- Listen to see if the "voices" overlap
- If they do overlap then test successful
Rapidly playing keys Test
| Actions | Inputs | Results | Pass/Fail |
|---|---|---|---|
| 1. Opens Program Digital Music Sampler | N/A | The Graphic user interface would pop up | Passed |
| 2.Press keys 'q' 'w' 'e' 'r' at the same time | q w e r | Playback of the keys pressed | Passed |
| 3. Listens for overlapping sound | N/A | N/A | Passed |
| 4. Clicks Exit | N/A | Program closes | Passed |
Scenario 5:
- Open GUI
- Load the recorded sound
- Play the sound
- Trim the sound
- Save the sound
- Play back the trimmed sound
- If so test is successful, If not failed
Trimming Test
| Actions | Inputs | Results | Pass/Fail |
|---|---|---|---|
| 1. Opens Program Trimmer interface | Click on the "Trim" button | The Trimming User Interface is open | Passed |
| 2. Loading recorded sound | Click on the "Load" button | The system file dialog is open and prompt for opening a file | Passed |
| 3. Playing back the recorded sound | Click on the "Play" button | The sound is playing back | Passed |
| 4. Trimming the sound | Click on the left and right of the sampling graph | The trimmed off portion of the sound is highlighted red and green | Passed |
| 5. Saving the trimmed sound | Click on the "Save" button | The system file dialog is open and prompt for saving the file | Passed |
| 6. Playing the saved file to verify the trimming | Click on the "Play" button | The trimmed sound is playing back | Passed |
| 7. Closing the trimming | Click on Close button | Return to main application | Passed |
Screenshots
Main GUI - A figure below is a final graphical user interface of the project, which has included the key interface - Volume, Pitch, and Octave Slide bars, Record, Trimmer, Exit, and Default buttons and Keyboard.
Recorder GUI - When the user click on Record button, a new Recorder window will pop up as below;
Trimmer GUI - Again if the user click on Trimmer button, a new window will pop up as below;
Reference
1. Class Diagram - Wikipedia.org[1]
2. Use Case - Wikipedia.org[2]
3. Sun Java Sound API - [3]
4. Wu C. T., 2001, An Introduction to Object-Oriented Programming with Java, 2ndED, McGraw-Hill, US.
5. Larman C., 2002. Applying UML and Patterns,2ndED.,Prentice-Hall International, NJ, US.
Instructor comments
Your usage scenarios are unusually concise... yet I can't fault them! Well done.
The CRC cards were intended to be an aid to discovering classes, I wasn't really expecting them to be part of your final deliverable.
Your use cases need names. So far they look pretty good (although I suspect you will find you need more later).
(JohnR 21st Aug 06)
Looks like you are making progress. Looking forward to seeing more. JohnR 11:05, 9 September 2006 (UTC)









