DEPARTMENT OF COMPUTING

CS 3005: Programming in C++

WAV File Creator

Introduction

A WAV file is a binary file that contains audio data. The quality of the audio data is determined by the sample rate and the bits per sample. The duration of the sound is determined by the number of samples. The sound is controlled by the form of the audio data.

Assignment

In this assignment, you will make a program that allows the user to configure a WAV file, including the two audio tracks stored in it to make a stereo sound file.

The program should create a WAV file from two audio tracks designed by the user. The user will choose the “Samples/Second” (the sample rate), the “Seconds” (the duration of the audio tracks), and the “Bits/Sample[8,16,24,32]” the number of bits per sample for the WAV file. The user will also be able to select the form of the audio data for the left and right channels separately. Finally, the user will allowed to choose the name of the WAV file to be stored on the drive. The audio track form will be configured using the functions built in previous assignments.

An interaction with the program may look like this:

$ ./program-wav-file-creator/wav_file_creator 
Samples/Second: 44100
Seconds: 1.75
Bits/Sample[8,16,24,32]: 16
Left Channel
Fill style: sine
Frequency: 440
Right Channel
Fill style: sawtooth
Frequency: 880
WAV filename: sample.wav
$ ls -l sample.wav 
-rw-rw-r-- 1 cgl cgl 308744 Sep 19 14:51 sample.wav

You can download and listen to sample.wav.

Programming Requirements

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

ApplicationData Class

Data Members:

public Methods:

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

Functions:

Update library-commands/Makefile

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

Create program-wav-file-creator/wav_file_creator.cpp

Functions:

Create program-wav-file-creator/Makefile

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

Create program-wav-file-creator/.gitignore

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

wav_file_creator

This will prevent the executable program 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 02/04/2025