码迷,mamicode.com
首页 > 其他好文 > 详细

soundtouch change pitch matlab implementation

时间:2018-11-22 23:55:20      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:input   mat   enc   imp   exp   ndt   avr   matlab   res   

function output = changePitch(input, pitchInSemitones)

% one octave is 12 semitones

octave = pitchInSemitones / 12;

%0.69314718056 is In2. go up one octave corresponds to twice the freqency;

pitchChange = exp(0.69314718056  * octave);

rate = 1 * pitchChange;

tempo = 1 / pitchChange;

if rate < 1

  output = changeRate(input, rate, ‘cubic‘);

  output = changeTempo(output ,fs, tempo);

else

  output = changeTempo(input, fs, tempo);

  output = changeRate(output, fs, rate);

end

end

 

main.m:

clc;

clear all;

[input fs] = wavread(‘input.wav‘);

pitchInSemitones = 2;

output = changePitch(input, pitchInSemitones);

wavwrite(output, fs, ‘output.wav‘);

soundtouch change pitch matlab implementation

标签:input   mat   enc   imp   exp   ndt   avr   matlab   res   

原文地址:https://www.cnblogs.com/fellow1988/p/10004593.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!