How to prevent high frequency (overtone) generation

enter image description here

Fs =44100;    
toneFreq1 = 8000; 
nSeconds = 25;  
f1 = sin(linspace(0, nSeconds*toneFreq1*2*pi, round(nSeconds*Fs)));
toneFreq2 = 8100; 
nSeconds = 25;  
f2 = sin(linspace(0, nSeconds*toneFreq2*2*pi, round(nSeconds*Fs)));
....

toneFreq80 = 15900; 
nSeconds = 25;  
f80 = sin(linspace(0, nSeconds*toneFreq80*2*pi, round(nSeconds*Fs)));
toneFreq81 = 16000; 
nSeconds = 25;  
f81 = sin(linspace(0, nSeconds*toneFreq81*2*pi, round(nSeconds*Fs)));


f_12345678910...= [f1+f2+f3+f4+f5+f6+f7+f8+f9+f10...f81]/81;


f_z=[f_12345678910...];
sound(f_z,Fs) 
wavwrite(f_z, Fs, 24, '8_16zKHz.wav');

      

I am creating a wave file (from 8kHz to 16kHz using Matlab). Then I play the wave and use an M50 microphone (6cm above the speaker) and a recorder to record the sound (from the speaker). Finally, I am using the matlab program to convert the audio to shape. In this picture, you can see the 8-16khz platform (which is what I need), but you can also see the high frequency component (arrow). I don't know why the high frequency (> 16khz) is generated. Is the high frequency signal generated in the speaker or is it noise generated by the microphone? Thank.

+3


source to share


1 answer


I think your problem is with the use linspace

. At first glance it looks like it should work, but there is something awkward about the way you call it. I think your method doesn't end up with a completely correct sample rate.

Also, I have little experience with Matlab's ability to export 24-bit WAV in a format that is universally recognizable. I think you should try 16 bit first, as it was extremely reliable for me.



So, to try it somehow, I would rewrite your code like this:

%define my parameters
toneFreqs = [8000:100:16000];
fs = 44100;
nSeconds = 25;

%create my data
t_sec = ([1:(nSeconds*fs)]-1)/fs; %here is the time for each sample
t_sec = t_sec(:);                 %make a column instead of a row
myWav = zeros(size(t_sec));       %pre-allocate the output
for Ifreq = 1:length(toneFreqs)   %loop over each frequency
    myWav = myWav + sin(2*pi*toneFreqs(Ifreq)*t_sec);
end

%save to WAV file
myWav = myWav./max(abs(myWav));    %normalize amplitude to 1.0
wavwrite(myWav,fs,16,'myWav.wav'); %save as 16 bit

      

+1


source







All Articles