Computer Science & Software Engineering |
CSCI 135 |
You are tasked with completing a command line utility that lets users mix and mash audio files. Using simple starting sounds, users can create a masterpiece of audacious audio. Using the utility, users can cut out sections of sound, add leading and trailing silence, add echoes, merge sounds, reverse sounds, and loop sounds. Luckily a previous developer has already implemented the main() method and a handful of the utility's effects (play, stats, and gain). Your task is to complete methods for the reverse, loop, merge, echo, cut and pad audio effects. Here is an example mix created from this set of commands. |
Reverse:% java AudioEffects AudioEffects <infile> <effect> [options] Effects: play - play the file stats - print some stats about the audio reverse <out file> - reverse an audio file gain <factor> <out file> - change the volume by given factor loop <times> <out file> - loop audio given number of times merge <infile2> <out file> - merge two audio files together cut <start> <end> <out file> - clip audio from [start, end] seconds pad <start> <end> <out file> - add silence to start and/or end echo <secs> <factor> <out file> - add an echo to audio Supports only 44.1 kHz mono 16-bit signed WAV audio files.
Loop:% java AudioEffects piano.wav reverse piano_reverse.wav Effect: reverse Wrote 226800 samples to piano_reverse.wav % java AudioEffects piano_reverse.wav stats Effect: stats Samples : 226800 Length (s) : 5.142857 Average level : 0.000044 Max level : 0.434431 Below 1% max (%) : 3.113316 Below 5% max (%) : 15.427690
Merge:% java AudioEffects scratch.wav loop 4 scratch_loop4.wav Effect: loop Wrote 282036 samples to scratch_loop4.wav % java AudioEffects scratch_loop4.wav stats Effect stats Samples : 282036 Length (s) : 6.395374 Average level : -0.001621 Max level : 1.000000 Below 1% max (%) : 34.224000 Below 5% max (%) : 59.749819 % java AudioEffects scratch.wav loop -43 scratch_loop-43.wav Effect: loop
Cut:% java AudioEffects cow.wav merge chimes.wav cow_chimes.wav Effect: merge Wrote 275015 samples to cow_chimes.wav % java AudioEffects cow_chimes.wav stats Effect: stats Samples : 275015 Length (s) : 6.236168 Average level : -0.000075 Max level : 0.388287 Below 1% max (%) : 28.735524 Below 5% max (%) : 65.232442 % java AudioEffects beatbox.wav merge harp.wav beatbox_harp.wav Effect: merge Wrote 89491 samples to beatbox_harp.wav % java AudioEffects beatbox_harp.wav stats Effect: stats Samples : 89491 Length (s) : 2.029274 Average level : 0.000768 Max level : 0.509171 Below 1% max (%) : 25.547820 Below 5% max (%) : 63.730431
Pad:% java AudioEffects dialup.wav cut 4.0 5.0 dialup_cut4-5.wav Effect: cut Wrote 44100 samples to dialup_cut4-5.wav % java AudioEffects dialup_cut4-5.wav stats Effect: stats Samples : 44100 Length (s) : 1.000000 Average level : 0.017001 Max level : 0.324198 Below 1% max (%) : 3.269841 Below 5% max (%) : 24.467120 % java AudioEffects dialup.wav cut 4.0 50.0 dialup_cut4-50.wav Effect: cut % java AudioEffects dialup.wav cut 5.0 4.0 dialup_cut5-4.wav Effect: cut
Echo:% java AudioEffects buzzer.wav pad 1.0 2.0 buzzer_pad1-2.wav Effect: pad Wrote 216969 samples to buzzer_pad1-2.wav % java AudioEffects buzzer_pad1-2.wav stats Effect: stats Samples : 216969 Length (s) : 4.919932 Average level : -0.000004 Max level : 0.997925 Below 1% max (%) : 62.104725 Below 5% max (%) : 66.364319 % java AudioEffects buzzer.wav pad -10.0 -20.0 buzzer_pad-10-20.wav Effect: pad
% java AudioEffects singer.wav echo 0.5 0.6 singer_echo_0.5_0.6.wav Effect: echo Wrote 680597 samples to singer_echo_0.5_0.6.wav % java AudioEffects singer_echo_0.5_0.6.wav stats Effect: stats Samples : 680597 Length (s) : 15.433039 Average level : -0.000015 Max level : 0.965667 Below 1% max (%) : 32.031290 Below 5% max (%) : 54.441321
Grading Each method is worth up to 4 points, with an additional 6 points for turning in a program that compiles and runs and has an appropriate header comment, for a total of 30 points, as shown in the following criteria:
Grade Item | Audio Effects | Points Earned |
---|---|---|
Program Compiles | 2 | |
Program Runs | 2 | |
Header Comment | 2 | |
Reverse Method Runs Correctly | 4 | Loop Method Runs Correctly | 4 | Merge Method Runs Correctly | 4 | Cut Method Runs Correctly | 4 | Pad Method Runs Correctly | 4 | Echo Method Runs Correctly | 4 |
Page last updated: August 15, 2018