필터 지우기
필터 지우기

Change Sample Rate Audio

조회 수: 26 (최근 30일)
Ibnu Darajat
Ibnu Darajat 2022년 11월 14일
댓글: Star Strider 2022년 11월 14일
Here's Matlab Audioread I try:
filename = "test.wav";
[y,fs] = audioread(filename);
%Play the audio.
sound(y,fs);
info = audioinfo("test.wav")
And here is the info from that audio:
CompressionMethod: 'Uncompressed'
NumChannels: 2
SampleRate: 44100
TotalSamples: 487424
Duration: 11.0527
Title: []
Comment: []
Artist: []
BitsPerSample: 16
My question is, How do I play the audio at a sample rate of 8000?

채택된 답변

Star Strider
Star Strider 2022년 11월 14일
I would do something like this, using the Signal Processing Toolbox resample funciton —
filename = "test.wav";
[y,fs] = audioread(filename);
L = size(y,1);
t = linspace(0, L-1, L)/fs; % Time Vector
fs_new = 8000;
[yr,tr] = resample(y, t(:), fs_new); % Resample To New Sampling Frequency
There are several compatible resample syntaxes that will do what you want. I prefer the one I posted here.
Alternatively, the interp1 funciton can be uesd, however resample includes an anti-aliasing filter, so it is best for any sort of signal processing.
.
  댓글 수: 6
Ibnu Darajat
Ibnu Darajat 2022년 11월 14일
thanks
Star Strider
Star Strider 2022년 11월 14일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by