%% Increase Fidelity Using Phase Locking
% Read in an audio file and listen to it.

[audioIn,fs] = audioread('FemaleSpeech-16-8-mono-3secs.wav');
sound(audioIn,fs)

%
% Increase the pitch by 6 semitones and listen to the result.

nsemitones = 6;
lockPhase = false;
audioOut = shiftPitch(audioIn,nsemitones, ...
                     'LockPhase',lockPhase);
sound(audioOut,fs)

%
% To increase fidelity, set LockPhase to true. Apply pitch shifting, and listen to the results.

lockPhase = true;
audioOut = shiftPitch(audioIn,nsemitones, ...
                     'LockPhase',lockPhase);
sound(audioOut,fs)

% Copyright 2019 The MathWorks, Inc.