Only thing that I want to control is speed. not pitch.
132 views (last 30 days)
[Q, S] = audioread("sample.mp3");
speed = 1.2;
S = S * speed;
This is what I do.
as you know, this code makes increase both pitch and speed.
but I want to make change only speed.
How can I control it?
**and How can I only control pitch?
Jan on 10 Dec 2018
Start with searching in the net, especially in this forum:
The problem is complex.
More Answers (2)
Bilal AKBANA on 3 Apr 2020
Edited: Bilal AKBANA on 3 Apr 2020
THIS IS THE CLEAR ANSWER I THINK COVERING BOTH VOLUME AND SPEED OF THE SOUND WITH CONDITION THAT YOU HAVE stretchAudio FUNCTION RELEASED AS OF R2019b. THIS ALGORITM CAN CHANGE THE SPEED AND VOLUME OF THE AUDIO WITHOUT MAKING IT SOUND FUNNY.
[y, fs] = audioread("sample.mp3"); % read audio file.
speed = 1.2; % increase speed of sound 1.2 times than the given speed.
volume = 2; % increase volume of sound 2 times than the given volume.
y = stretchAudio(volume*y,speed);
sound(y,fs); % my recommendation is to use sound instead of soundsc
% clear sound; % to stop sound
% OR INSTEAD OF sound you can use
player = audioplayer(y,fs);
% play(player); % comment this out it will play.
% stop(player); % comment this out it will stop.