Step-by-step / gradual change in the tone of the signal in time using the octave / matlab code

I can shift the whole signal using resample, and I tried the phase vocoder code here .

I also tried repmat and interpolation , and I looked through fft and interp1

How can I gradually or gradually change the height of a signal over time? I included the Original Signal example and what I'm trying to get the Processed signal to sound like (I created the processed signal using Audacity and using their effect Sliding time scale / pitch shift) But I would like to create this signal in Octave 4.0. If you listen to the Processed signal , you can hear that the file height is gradually increasing, but the file has the same length in seconds, since the File is the original signal .

I am using Octave 4.0 which is similar to Matlab

Here is a code that can change the height of the entire signal and keep the same length of the original signal in seconds, but I'm not sure how to gradually change the signal pitch over time. Thank you Rayrayeng for taking me this far.

clear, clc
[ya, fs, nbitsraw] = wavread('/tmp/original_signal.wav');

num_per_sec=2.4; %// Define total number of times we see the signal

%// Get total number of integer times we see the signal
num_whole = floor(num_per_sec);

%// Replicate signal
yb=repmat(ya,num_whole,1);

%// Determine how many samples the partial signal consists of
portion = floor((num_per_sec - num_whole)*length(ya));

%// Sample from the original signal and stack this on top of replicated signal
yb = [yb; ya(1:portion)];

%interpolation
xxo=linspace(0,1,length(yb))'; 
xxi=linspace(0,1,length(ya))'; 
yi_t=interp1(xxo,yb,xxi,'linear');

wavwrite([yi_t'] ,fs,16,strcat('/tmp/processed_signal.wav'));  % export file
+6
source share
1 answer

My answer does not give exactly the same result as the one you published, but I think it is interesting and simple enough to give you important concepts of stretching a step. I did not find the method that I propose elsewhere on the Internet, but I cannot imagine that no one had thought of this before, so it may have a name.

, , , , , , (, ), , (, ).

, , , , ( (1/2Pi) * dPhi/ dt rad/s).

, , " " " ". , . :

function y = add_linear_pitch( x, fs, df )
%
% y = add_linear_pitch( x, fs, df )
%
% x, fs: audio signal (1-dimensional)
% df: the amplitude of frequency offset, in Hz
%
% See also: hilbert
%

    x = x(:);
    n = numel(x); % number of timepoints
    m = mean(x); % average of the signal
    k = transpose(0:n-1); 

    h = hilbert( x - m ); % analytic signal
    e = abs(h); % envelope
    p = angle(h) + df*pi*k.^2/fs/n; % phase + linearly increasing offset
    y = m - imag(hilbert( e .* sin(p) )); % inverse-transform

end

, " " ( ) 2Pi ( ). , :)

+6

All Articles