Audio processing: Writing a pitch shifting echo effect
5 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I'm extremely new to programming but I'm trying to write an echo audio effect that pitch-shifts each repeat by a specified amount (e.g. 1 semitone). This would mean it preserves the original signal and only shifts the repeats. So far I've sourced some code for a reliable echo effect, but I'm lost on how to implement the pitch shift within the feedback loop. Here is the code for the echo as it is now.
function [delayed] = delay(sound, feedback, delaytime, fs)
if nargin == 4
delay_samples = floor(delaytime./1000.*fs);
else
delay_samples = floor(delaytime);
end
delayed = sound;
for sample = delay_samples + 1: length(sound)
if(sample - delay_samples > 0)
delayed(sample) = sound(sample) + feedback*(delayed(sample-delay_samples));
end
end
Any help would be appreciated,
Thanks
0 个评论
采纳的回答
Jonas
2021-5-18
have a look into the shiftPitch() function, you can find it here https://de.mathworks.com/help/audio/ref/shiftpitch.html
2 个评论
Jonas
2021-5-20
编辑:Jonas
2021-5-20
if i see that correctly your echo is just a delayed copy of the original with a factor for smaller amplitude. for that you dont need a for loop but i think it is something like that (here everything is a column vector):
withEcho=original+someFactor*[zeros(nrOfDelayDamples,1); original(nrOfDelaySamples+1:end,1)]
in this form you can apply the mentioned function directly to the echo part
if you want to add more than one repetition of the pite original you can solve that by a for loop like
withEcho=original;
for echoNr=1:4
withEcho=withEcho+someFactor/echoNr*[zeros(nrOfDelayDamples*echoNr,1); original(nrOfDelaySamples*echoNr+1:end,1)];
end
of course it is a question of style how you let decrease the echo for further repetitions, if you include the echoed signal in the higher order echoes and in this case the signal will be exactly as long as the original which is rough at the ending ;)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio Processing Algorithm Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!