Best way for pitch shift in MATLAB












0















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.










share|improve this question


















  • 1





    Have you read the help for audiowrite?

    – nekomatic
    Jan 2 at 14:52






  • 1





    You say "it doesn't compile"? What does that mean exactly? It would be helpful if you posted the error message you're seeing.

    – Justin
    Jan 2 at 14:56











  • Yes, i have. ERROR CODE: Error in (line 13) audiowrite('Silae.wav',2*fs,'trasposto.wav'), and i don't know how to plot the result.

    – Lory97
    Jan 6 at 9:55













  • Can you explain what happen when you say "But nothing worked".

    – Bebs
    Jan 29 at 13:39











  • None of these solution compiled.

    – Lory97
    Jan 30 at 9:57
















0















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.










share|improve this question


















  • 1





    Have you read the help for audiowrite?

    – nekomatic
    Jan 2 at 14:52






  • 1





    You say "it doesn't compile"? What does that mean exactly? It would be helpful if you posted the error message you're seeing.

    – Justin
    Jan 2 at 14:56











  • Yes, i have. ERROR CODE: Error in (line 13) audiowrite('Silae.wav',2*fs,'trasposto.wav'), and i don't know how to plot the result.

    – Lory97
    Jan 6 at 9:55













  • Can you explain what happen when you say "But nothing worked".

    – Bebs
    Jan 29 at 13:39











  • None of these solution compiled.

    – Lory97
    Jan 30 at 9:57














0












0








0








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.










share|improve this question














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.







matlab signal-processing pitch pitch-shifting






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 13:17









Lory97Lory97

153




153








  • 1





    Have you read the help for audiowrite?

    – nekomatic
    Jan 2 at 14:52






  • 1





    You say "it doesn't compile"? What does that mean exactly? It would be helpful if you posted the error message you're seeing.

    – Justin
    Jan 2 at 14:56











  • Yes, i have. ERROR CODE: Error in (line 13) audiowrite('Silae.wav',2*fs,'trasposto.wav'), and i don't know how to plot the result.

    – Lory97
    Jan 6 at 9:55













  • Can you explain what happen when you say "But nothing worked".

    – Bebs
    Jan 29 at 13:39











  • None of these solution compiled.

    – Lory97
    Jan 30 at 9:57














  • 1





    Have you read the help for audiowrite?

    – nekomatic
    Jan 2 at 14:52






  • 1





    You say "it doesn't compile"? What does that mean exactly? It would be helpful if you posted the error message you're seeing.

    – Justin
    Jan 2 at 14:56











  • Yes, i have. ERROR CODE: Error in (line 13) audiowrite('Silae.wav',2*fs,'trasposto.wav'), and i don't know how to plot the result.

    – Lory97
    Jan 6 at 9:55













  • Can you explain what happen when you say "But nothing worked".

    – Bebs
    Jan 29 at 13:39











  • None of these solution compiled.

    – Lory97
    Jan 30 at 9:57








1




1





Have you read the help for audiowrite?

– nekomatic
Jan 2 at 14:52





Have you read the help for audiowrite?

– nekomatic
Jan 2 at 14:52




1




1





You say "it doesn't compile"? What does that mean exactly? It would be helpful if you posted the error message you're seeing.

– Justin
Jan 2 at 14:56





You say "it doesn't compile"? What does that mean exactly? It would be helpful if you posted the error message you're seeing.

– Justin
Jan 2 at 14:56













Yes, i have. ERROR CODE: Error in (line 13) audiowrite('Silae.wav',2*fs,'trasposto.wav'), and i don't know how to plot the result.

– Lory97
Jan 6 at 9:55







Yes, i have. ERROR CODE: Error in (line 13) audiowrite('Silae.wav',2*fs,'trasposto.wav'), and i don't know how to plot the result.

– Lory97
Jan 6 at 9:55















Can you explain what happen when you say "But nothing worked".

– Bebs
Jan 29 at 13:39





Can you explain what happen when you say "But nothing worked".

– Bebs
Jan 29 at 13:39













None of these solution compiled.

– Lory97
Jan 30 at 9:57





None of these solution compiled.

– Lory97
Jan 30 at 9:57












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007099%2fbest-way-for-pitch-shift-in-matlab%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007099%2fbest-way-for-pitch-shift-in-matlab%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

How to fix TextFormField cause rebuild widget in Flutter