Shifting audio signal into different frequency band (shiftPitch)

조회 수: 8 (최근 30일)
Anke Kügler
Anke Kügler 2023년 4월 21일
댓글: jibrahim 2023년 4월 28일
I have a section of a very long audio signal (from a .FLAC file) that I read in with audioread(). Because my signal of interest is very low-frequency, I need to shift it into a higher frequency band for some of the planned subsequent processing (https://www.mathworks.com/help/audio/ref/shiftpitch.html). However, shiftPitch() is throwing an error. I've tried to get it to work both with my multi-channel .FLAC file as well as a single-channel .wav file, but keep getting the same error.
%sample rate
afs = 2000;
%start and end time in s of selection
BeginTime=10;
EndTime=14;
%read in selection from file
x=audioread(file, round([BeginTime*afs, EndTime*afs]));
%this is a multi-channel recording, but we're only interested in channel 1
x=x(:,1);
%attempt pitch shift
audioOut = shiftPitch(x,3)
Error using stft
Too many input arguments.
Error in audio.internal.stft (line 13)
X = stft(x,'Window',win,'OverlapLength',overlapLength,'Centered',false);
Error in audio.internal.stretchAudioVocoder (line 16)
X = audio.internal.stft(x,windowCast,overlapLength,numExtraSegments);
Error in shiftPitch (line 82)
[out,X] = audio.internal.stretchAudioVocoder(audioIn,params.SpeedupFactor,params.Window, ...
  댓글 수: 1
jibrahim
jibrahim 2023년 4월 28일
Hi Anke,
It seems you are hitting an error in the function stft. Does this work for you?
x = randn(1e5,1);
win = hann(256);
overlapLength = 256;
X = stft(x,'Window',win,'OverlapLength',overlapLength,'Centered',false);
Execute which stft -all to make sure you don't have local versions of the function shadowing the product function.
What release of MATLAB are you working from?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by