Question: First, put a .wav file in the same directory as your python program. Then, Write a python program to do the following: 1. Prompt the

First, put a .wav file in the same directory as your python program. Then, Write a python program to do the following:

1. Prompt the user for a filename to read. Use: input()

2. Open the .wav file.

3. Print a statement that says, mono or stereo, as appropriate

4. Print a statement that says, 8 bit or 16 bit, as appropriate.

5. Print the sampling frequency: Sampling Frequency=0

6. Print the number of frames: Number of audio frames =>>

7. Print the sampling rate: Sample Rate =

8. Calculate and print the amount of time for the sound file: Time = >> seconds

9. Plot the sound wave by:

a. Read in the data using Wave_read.readframes(). This stores the data in a bytes object

b. Convert the bytes object into an array" object using np.frombuffer()

c. If stereo, convert to a 2D array using np.reshape()

d. Create a time array using range()

e. Plot one channel of the sound wave using plt.plot(t,y) and plt.show()

10. Now plot just the first 0.5 seconds.

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 Programming Questions!