Shifting audio signal into different frequency band (shiftPitch)

7 views (last 30 days)
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 Comment
jibrahim
jibrahim on 28 Apr 2023
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?

Sign in to comment.

Answers (0)

Categories

Find more on Audio Processing Algorithm Design in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!