Need help converting matrix of i2s values to sound

2 views (last 30 days)
Raúl Iglesias Fernández
Raúl Iglesias Fernández on 13 Mar 2018
Commented: Walter Roberson on 10 Sep 2019
Hi, I have a 32768x1 matrix in matlab, ( 32768 samples of a i2s microphone that i captured from an FPGA, values are currently in decimal but they represent a 18 bit vector of the i2s PCM sample from the microphone). I need to convert this matrix to sound to test the microphone, but i need help to get it done.
Thanks to everybody.
Walter Roberson
Walter Roberson on 10 Sep 2019
By the way, does the fi hint that the data is stored as FixedPoint instead of as int32 or uint32 ?

Sign in to comment.

Answers (1)

Ted Shultz
Ted Shultz on 10 Sep 2019
You could try to use the audioplayer function. You would need to scale your data, and know the sample frequency.
You code may look something like this:
Fs = 48000; % Hz (use your value here)
Y =2*( fi-min(fi)) / (max(fi)-min(fi))-1; % scale data
player = audioplayer(Y,Fs); %make audio player

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!