Skip to content

Instantly share code, notes, and snippets.

@aptitudex
Created August 31, 2024 01:45
Show Gist options
  • Save aptitudex/a19a984965185409b090a02d2be0dd04 to your computer and use it in GitHub Desktop.
Save aptitudex/a19a984965185409b090a02d2be0dd04 to your computer and use it in GitHub Desktop.
t = (0:size(x,1)-1)/fs;
winLength = round(0.05*fs);
overlapLength = round(0.045*fs);
[f0,idx] = pitch(x,fs,Method="SRH",WindowLength=winLength,OverlapLength=overlapLength);
tf0 = idx/fs;
sound(x,fs)
figure
tiledlayout(2,1)
nexttile
plot(t,x)
ylabel("Amplitude")
title("Audio Signal")
axis tight
nexttile
pitch(x,fs,Method="SRH",WindowLength=winLength,OverlapLength=overlapLength)
title("Pitch Estimations")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment