DEPARTMENT OF COMPUTING

CS 3005: Programming in C++

Audio Track Creator

Introduction

Audio tracks can be configured by sample rate (samples per second) and by duration (number of seconds). After configuration, audio tracks can be filled with audio data. For audio data to be converted to interesting sounds, there are usually patterns to the values stored.

One simple pattern for values is a “ramp”. A ramp smoothly changes its values from the beginning to the end. Below are examples of ramp up and ramp down.

001_rampup_test-render.png

002_rampdown_test-render.png

The mathematical definition of a ramp is:

Given: v1 and v2 at the beginning and ending values in the ramp, s is the number of entries in the ramp, and i is the current entry in the ramp;

Then: v(i) = v1 + (v2 - v1) * i / (s - 1)

Assignment

In this assignment, you will make a program that allows the user to configure an audio track, and fill it with either a ramp up or a ramp down pattern. The program will ask the user for samples per second and number of seconds. It will then ask the user whether the audio track should be filled with ramp up or ramp down.

After applying the configuration and inserted the ramp data, the program should display the contents of the audio track. The format of the display will look like this:

sample_number,amplitude
0,0
1,0.0666667
2,0.133333
3,0.2
4,0.266667
5,0.333333
6,0.4
7,0.466667
8,0.533333
9,0.6
10,0.666667
11,0.733333
12,0.8
13,0.866667
14,0.933333
15,1

Note there is a header line with sample_number,amplitude, followed by one line per entry. The commas in the output cause the data to be comma separated, and appropriate for creating CSV files. You can put this output into a CSV file, by copying and pasting it.

Visualize your output using the show_graph.py program we have provided.

./show_graph.py --data-file file_name.csv

Programming Requirements

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

ApplicationData Class

Data Members:

public Methods:

Create library-commands/audio_track_creator_aux.{h,cpp}

Functions:

Update library-commands/Makefile

Add audio_track_creator_aux.{h,cpp} in the appropriate places to add them to the library and install the header file.

Create program-audio-track-creator/audio_track_creator.cpp

Functions:

Create program-audio-track-creator/Makefile

This file must contain rules such that any of the following commands will build the audio_track_creator program:

Create program-audio-track-creator/.gitignore

The file program-audio-track-creator/.gitignore needs to store one line of text:

audio_track_creator

This will prevent the executable program questions3 from being committed to the repository. It is a derived file.

Update Makefile

Additional Documentation

Grading Instructions

To receive credit for this assignment:

Extra Challenges (Not Required)

Last Updated 09/04/2024