How can I increase/decrease (frequency/pitch) and phase using fft/ifft I think I have the basic code but I’m not sure what to do next
PS: It's done in Octave/matlab code
Example I have a signal that repeats 1 time every second and I want to have it repeat 3 times a second instead.
%Voiceprint raise lower freq phase conjugate signal
tic
clear all, clc,clf,tic
%% Sound /beep calculation complete
filerawbeepStr='calculations_complete.wav';
filerawbeeppathStr='/home/rat/Documents/octave/raw/';
filevoiceprepathStr='/home/rat/Documents/octave/eq_research/main/transform/voice/';
filewavpathStr='/home/rat/Documents/octave/eq_research/main/transform/wav/';
[ybeep, Fsbeep, nbitsbeep] = wavread(strcat(filerawbeeppathStr,filerawbeepStr));
%addpath(”/home/rat/Documents/octave/eq_research/main/transform/”); %add path to location of functions
%1a voice print import
[vp_sig_orig, fs_rate, nbitsraw] = wavread(strcat(filevoiceprepathStr,'voice8000fs.wav'));
%vp_sig_orig=vp_sig_orig’;
vp_sig_len=length(vp_sig_orig);
%2a create frequency domain
ya_fft = fft(vp_sig_orig);
vp_sig_phase_orig = unwrap(angle(ya_fft));
%get Magnitude
ya_fft_mag = abs(ya_fft);
%3a frequency back to time domain
ya_ifft=real(ifft(ya_fft));
%adjust frequency/phase here? How?
vp_sig_new=real(ifft(ya_fft_mag.*exp(i*vp_sig_phase_orig)));
subplot(3,1,1), plot(vp_sig_orig),title('1 original time domain')
subplot(3,1,2), plot(ya_ifft),title('2 rebuild time domain')
subplot(3,1,3), plot(vp_sig_new),title('3 adjusted time')
Greetings All
I went back and did what Sergei recommended and used resample and repmat, but I'm noticing that on some of the values the rows aren't the same as the sample rate, see image link below. notice the top image value for rows says 1000 and the bottom image says rows = 1008. This happens when I change the values of resample and repmat (freq_new) but only for certain values. How can I fix this correctly? I could just delete everything after 1000 but I'm not sure if this is a bug or just the way resample/repmat works.
here's the code in case someone may have use for it in the future PS it only works for increasing frequency.