CS 3005: Programming in C++
Reverse Sawtooth
Introduction
The reverse sawtooth waveform is similar to the sawtooth. However, it is generated by starting at maximum amplitude, ramping down to minimum amplitude and then jumping back to maximum amplitude.
The formula for the reverse sawtooth is
amplitude = 1.0 - (2.0 * j) / (cycle_size - 1)
Task
In this task, you will add the reverse sawtooth pattern to the options to fill in audio track data. The results should be available in the audio track creator and wav file creator programs.
An interaction with audio track creator may look like this:
$ ./program-audio-track-creator/audio_track_creator
Samples/Second: 10
Seconds: 1
Fill style: reverse-sawtooth
Frequency: 2
sample_number,amplitude
0,1
1,0.5
2,0
3,-0.5
4,-1
5,1
6,0.5
7,0
8,-0.5
9,-1
Programming Requirements
Update library-commands/audio_track_creator_aux.{h,cpp}
Functions:
void reverse_sawtooth_fill_audio_track(ApplicationData& app_data);
Fills the audio track in the application data with a reverse sawtooth pattern. See the formula above.void fill_audio_track(ApplicationData& app_data);
If the user selectsreverse-sawtooth
as the fill style, this function prompts the user for the double “Frequency? “, stores the frequency in the application data’s double registers, then callsreverse_sawtooth_fill_audio_track
to fill the audio track.
Additional Documentation
- None
Grading Instructions
To receive credit for this assignment:
- your code must be pushed to your repository for this class on GitHub
- all unit tests must pass
- all acceptance tests must pass
- all programs must build, run, and execute as described in the assignment descriptions.
Last Updated 02/04/2025