程序代写代做代考 Project 1

Project 1

This project counts for 35% of your project mark. This project must be done individually.

Write software for editing wave files. The program must be able to read and write wave files and perform a number of editing functions on these sound files.

• Add an additional track that is contained in an another wave file. The original track can be sampled at a different rate, so files need to be normalized.
• Create a mono file from a stereo file.
• Create a loop track, i.e. read a wave file and create a new wave file which repeats the original track n times.
• Perform a low pass or high pass filter of the music. This involves taking an FFT of the original data and deleting components below a certain frequency (high pass), or deleting components of above a certain frequency (high pass).
• Create a new file that plays the file at speed s times faster or slower. s is a real number between 0.5 and 4.
• The system must be able to print out the recording details of a given file, i.e.
• Number of channels
• Sampling rate
• Samples per channel
• Number of samples
• The bits per sample
• The interface can be a command line interface or can be data stored in a file. Each edit must be recorded in a history file. The history file stores the data about the edit.
• Files involved,
• Parameters
• Success or failure of the edits
• Time of edit
• The interface takes in the input filename or filenames, and parameters associated with the modifications.

Wave files consist of a header which is normally 44 bytes (for our class it will always be 44 bytes). Followed by data in bytes.

typedef struct header
{
char chunk_id[4];
int chunk_size;
char format[4];
char subchunk1_id[4];
int subchunk1_size;
short int audio_format;
short int num_channels;
int sample_rate;
int byte_rate;
short int block_align;
short int bits_per_sample;
char subchunk2_id[4];
int subchunk2_size
} header;

subchunk2 is the total number of bytes of data
bits pre sample is the number of bits in a sample
byte rate is the sampling rate 441000 hz is standard
num_chanels is the number of channels

If subchunk2 is 10,000, bits per sample is 16, num_chanels is 2, there would be 10,000 bytes in total. Each sample would be 2 bytes: 5000 bytes for each channel, or 2500 samples per channel.

Byte 0 and Byte 1 would be put together as signed int for sample 1 of channel 1
Byte 2 and Byte 3 would be put together to form signed in sample 1 of channel 2
Byte 4 and Byte 5 would be put together to form signed in sample 2 of channel 1
Byte 6 and Byte 7 would be put together to form signed in sample 2 of channel 2

And so on.

Be very careful reading in data and writing data.