Need help converting matrix of i2s values to sound

조회 수: 9 (최근 30일)
Raúl Iglesias Fernández
Raúl Iglesias Fernández 2018년 3월 13일
댓글: Walter Roberson 2019년 9월 10일
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.
  댓글 수: 3
Walter Roberson
Walter Roberson 2019년 8월 8일
Is it linear PCM, LPCM ? If so then divide by 2^18, then multiply by 2 and then subtract 1 to get data suitable for playing.
(or just divide by 2^17 and subtract 1)
Walter Roberson
Walter Roberson 2019년 9월 10일
By the way, does the fi hint that the data is stored as FixedPoint instead of as int32 or uint32 ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Ted Shultz
Ted Shultz 2019년 9월 10일
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

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by