'Frequently Asked Questions for Lab 3'

Q. How do I start working on the sample Driver code?

Skim through the code and understand the code. There are a few functions which will be need to be modified.

Step 1: Understand the flow of the code.

Step 2: Look into how the data is copied into the buffer

Step 3: The code is NOT PERFECT; you will need to add function calls

Step 4: TAKE CARE of Locks!

Step 5: Make sure DATA is Copied Correctly

Step 6: Read the Datasheet it will give you a better understanding of the Driver Code

Step 7: To be sure that your sound driver is working, verify that the sound can be heard on the audio out jack.

The sound that you would hear would be something like this.  This may be not the exact sound that you may hear. Your output should be something similar.

Q. How to convert a WAV file to text file with unsigned chars?

Matlab is a useful tool to covert WAV file to text file. wavread() command can read data from a .wav file and store it into a buffer; then this buffer data can be written into a .txt file.

In the Matlab command line, go to the directory where your sound file is present.

Eg: Loading a .wav file into buffer

Buffer= wavread(‘filename’,size)


Eg: Converting buffer contents into a text file

FileID = fopen(‘file.txt’,’w’);

Fprintf(fileID,type,Buffer);

Fclose(fileID);



Q. How should the API prototype mentioned in Question 4 look like?

For this Lab it is important to specify the API’s correctly. For example: sendToDriver(buffer *) using this API you can pass the input buffer to the driver and this buffer would be played . Having this API call is useful when switching between multiple buffers.


Q. What is Required from Grad Question?

The grad question requires the student to modify the frequency at run time; this means for the next time instance the value must be changed. Take a look at Figure 1, In this figure F1 is the frequency currently used to generate the sound signals if a user changes the frequency at run time to F2 at the next time instance T4 the sine calculations are generated as per the new frequency F2. When the sound driver is playing the sound, you should have a task that is simultaneously calculating the next set of values.


Figure1: Sine Wave generation at different frequencies