# How is the sound converted to matrix in Matlab?

I am using the audioread(filename,y,Fs) function of Matlab and it converts an audio file to a matrix. I want to know how is each value of that matrix generated. Is it possible to produce a specific sound like the sound of a guitar by giving your own values to the matrix and then sounding it using the sound() function?

• how did you converts an audio file to a matrix ? – user23914 Sep 27 '16 at 8:44
• using the audioread(filename,y,Fs) function of Matlab – Jordan Sep 27 '16 at 12:54

The function audioread doesn't generate any values, it just reads audio samples stored in a file. If you want to generate the sound of a guitar, you need to look into sound synthesis, such as the Karplus-Strong method.

• actually i want to know how it actually reads audio samples or what does it reads from the audio file. What do you mean by samples? – Jordan Feb 18 '16 at 14:55
• would you please elaborate a little more? @Matt – Jordan Feb 20 '16 at 10:55
• @Jordan: Samples are values taken from the signal (such as a microphone signal). These samples are taken at regular intervals, such that the originally analog signal is represented is sufficient detail. These sampled signal values can be stored in a file and they are read and copied to a data matrix by the function audioread If you don't know about sampling, start by reading this article. – Matt L. Feb 20 '16 at 11:01
• Ok i will read it. Thanks i really appreciate your help! – Jordan Feb 20 '16 at 11:02

Yes, it is definitely possible to produce the specific sound like guitar. but the point is do we know the values(matrix values) which will produce that specific sound.

Regarding " how is each value of that matrix generated" , those are generated by the transducer's(microphone) action on sound waves.When you read a file using audioread, you are just able to see those values in matrix form.

• Actually the first point you raised is my question! How to calculate the values(matrix values) which will produce a specific sound. Secondly I know that when I read a file using audioread, I am able to see those values in matrix form but i need to know how is this function calculating these values. – Jordan Feb 11 '16 at 12:21
• @Jordan Oh ! thanks for your clarification.I think Matt L. answered it properly and clearly now. – Arpit Jain Feb 11 '16 at 12:42