DEPARTMENT OF COMPUTING

CS 3005: Programming in C++

Audio Track Creator (Additional Features)

Introduction

In the previous assignment, you created a program that creates an AudioTrack object and fills it with data, depending on the user’s choice. In this assignment, you will add additional choices for the form of data that can be added to an AudioTrack object.

The two options are sine and sawtooth waves. The sine wave is generated using the std::sin(angle) function from the C++ standard library. An angle must be computed that corresponds to a position on the horizontal axis of the graph.

Given sample_number (the position in the audio track), frequency (how quickly the wave changes), and samples_per_second (the sample rate)

Then: angle = (6.28 * sample_number * frequency) / samples_per_second

The following is a graph for samples_per_second = 1000 over a 1.23 second interval, at frequency = 10.0.

010_sine_test-render.png

A sawtooth wave also follows a periodic pattern. But, it has straight line edges, that produce a pattern that resembles the teeth of a saw. The

Given: sample_number (the position in the audio track), frequency (how quickly the wave changes), and samples_per_second (the sample rate)

Then:

The following is a graph for samples_per_second = 23 over a 1.34 second interval, at frequency = 5.0.

011_sawtooth_test-render.png

Assignment

In this assignment, you will update the audio_track_creator program to allow the user to select sine or sawtooth wave data in addition to the ramp options that were made available in the previous assignment.

An example interaction with the program could look like this:

Samples/Second: 1000
Seconds: 1.23
Fill style[rampup, rampdown, sine, sawtooth]: sine
Frequency: 10
sample_number,amplitude
0,0
1,0.0627587
2,0.12527
3,0.187287
...
1228,0.988864
1229,0.977574

Another example interaction with the program could look like this:

Samples/Second: 1000
Seconds: 1.23
Fill style[rampup, rampdown, sine, sawtooth]: whammy
Only rampup, rampdown, sine or sawtooth are allowed.

Programming Requirements

Update library-application/ApplicationData.{h,cpp}

ApplicationData Class

Data Members:

public Methods:

Update library-commands/audio-track-creator_aux.{h,cpp}

Functions:

Additional Documentation

Grading Instructions

To receive credit for this assignment:

Extra Challenges (Not Required)

Last Updated 09/06/2024