I'm writing a program which, with a given value prompted from the user, changes the pitch of a whole track, for example if the user wants to double the fundamental the program should produce a track an upper octave (example, from A4 to A5). I have tried this
changing the pitch of an audio wav file in matlab?
and this
MATLAB - Pitch Shifting an Audio Signal
But nothing worked. The commented part is my test to use the second algorythm, but it doesn't compile.
Here is my code.
 [audioIn,fs] = audioread('Silae.wav');
 [f0,idx] = pitch(audioIn,fs);
 subplot(2,1,1)
 plot(audioIn)
 ylabel('Amplitude')
 subplot(2,1,2)
 plot(idx,f0)
 ylabel('Pitch (Hz)')
 xlabel('Sample Number')
 %audiowrite('Silae.wav',2*fs,'trasposed.wav')   2+fs is the given ratio
Thank you for your help.