Question: In C Programing In this project, you will create a WAVE audio file with pseudo-random valued audio data. When running correctly, the WAV file created

In C Programing

 In C Programing In this project, you will create a WAVE

In this project, you will create a WAVE audio file with pseudo-random valued audio data. When running correctly, the WAV file created your program will play a continuous hissing sound often referred to as "white noise" If your program is correct, when you double-click on the WAVE file created by your program your computer's default audio app will open the file and play it through your computer's speakers The wav file your program creates will contain 16-bit audio data (short int), and it will be a stereo audio file. 1) Your main program will 1st call a subroutine that prints out instructions to the user and asks the user for the name of the output file. This subroutine will receive a FILE pointer from the main function. The subroutine is responsible for assuring that the filename entered by the user ends in extension "wav" and that the file opens correctly for writing in mode "wb". If the filename entered by the user fails, the subroutine reprints the instructions until the user enters a correct filename that opens correctly. After the file is opened correctly, your main program will have the FILE pointer to the file, so your main program does not need to receive the filename. 2) After the file is opened correctly, your main program will call a 2nd function to prompt the user for the float-valued length in seconds of the audio file. The argument for this subroutine is the memory addresses of the float length variable from your main program. 3) Given the float-valued length of audio in seconds, your main program will malloc() a 1-D array of short variables of dimension sufficient to hold all of the audio data. 4) Your main program will then call a subroutine that fills in the audio data with pseudo-random values. This subroutine will receive (as an argument) the pointer to the short int malloc'd audio-data array 5) Your main program will then malloc() a 44-byte signed char array to hold the wav file header and fill-in the bytes of the header with the appropriate values. See the previous programming assignment for information about the wav file header 6) Your main program will then write out the wav header 1-D array to the file, then write out the audio data to the file, and finally close the file. Use the rand() function to generate the random short int values -32768 to +32767 Seed the rand() function using the srand0 function with the argument of srand() being the time-of-day obtained from your computer using the following syntax: srand(unsigned int)time(NULL)); You will need to include in your preprocessor commands the line # include in order to use the function call "time(NULL);". the macro The pseudo-random values generated by rand() will be between 0 and RAND MAX. You will need to use these non- negative psudorandom values to generate signed random values in the range -32768 to +32767. Do these calculations in float or double so that you do not error in using integer divisions that lead to all 0's If your program is correct, when you double-click on the created wav file, your computer's default audio app will play a continuous hissing sound often referred to as "white noise

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!