0

I'm writing a program which generates a pure tone from a frequency inputed from the user (and this part of the program works), and which is able to produce, given an another frequency, a sound based on a sampled clarinet sound (only that sample, using its fundamentals and its harmonics). I thought to use a table lookup, but i don't know how to apply it in MATLAB and i haven't found examples applied to the sound. I know there was a simular question here

changing the pitch of an audio wav file in matlab?

but it is not what exactly i want to do. Thank you for your help.

 %function 
 function y = analyse()
  prompt = 'Which frequency would you like to reproduce?';

 Freq = input(prompt)
 [audioIn,fs] = audioread('Si_lae.wav');
 [pitchValue,analyse] = pitch(audioIn,fs);


 amp=1;
 Fs=80000; % Fs=sampling frequency 
 duration=8;
 values=0:1/Fs:duration;
 a=amp*sin(2*pi*Freq*values);
 sound(a,Fs) 


  [Y,Fs]=audioread('Si_lae.wav'); 

 %Pitch shift
if pitchValue ~= 0
[N,D] = rat(8^(-0.4*pitchValue));
y = resample(y,N,D);    
 end

 end
Lory
  • 40
  • 9
  • `upfirdn` is good when you need to resample but have more control over antialiasing than with the `resample` function. – Ben Voigt Jul 04 '18 at 17:59
  • Yes, but i have to produce an another sound, not to simple change the sampling rate. – Lory Jul 04 '18 at 18:12

0 Answers0