Interpretation Sin(2*pi*f*t) in matlab for producing sound

6 visualizzazioni (ultimi 30 giorni)
Hello everyone, I am required to produce wave sound files for a given data which contains information about the sound pressure and frequency. I use the equation y = A sin(2*pi*f*t) to produce sound. I am using sound pressure as amplitude. What's strange is that when I produce the sound using this method, I am getting frequency components which are exactly double the original frequency value. When I remove the 2 from the Sin(2*pi*f*t), its working! I get the exact frequency when I perform a fft transform on the wave file. Do any of you have an explanantion for this??
  2 Commenti
Star Strider
Star Strider il 9 Mar 2016
‘Do any of you have an explanantion for this??’
Not without seeing the rest of your code.
Karthik Brs
Karthik Brs il 21 Apr 2016
Here is the code..
fs = 44100; % Sampling frequency
Paco = 10^-12; % Reference sound power
Po = 2*10^-5; % Reference sound pressure of '20µPa' (at 1000 Hz.)
r = 1; % Distance to the sound source from the listener
Q = 4; % Directivity factor for a point source
filename_audiowrite = sprintf('SSD_audiowrite_%d.wav',ii);
t_ramp = 20; %[secs]
t = 0:1/fs:t_ramp-1/fs;
RPM_max = max(cell2mat(RPM));
Frq = cell2mat(frq);
Wav_sum = 0;
for tv = 1:ordn
t_v{tv} = RPM(tv)/RPM_max*t_ramp; %Creation of individual Time Vectors
TLw_intrp{tv} = interp1(cell2mat(t_v(tv)),ord(tv).total_lw,t,'linear','extrap'); % Interpolating the values of sound power at different times for linear ramp
f_intrp{tv} = interp1(cell2mat(t_v(tv)),ord(tv).freq,t,'linear','extrap');
SPrL{tv} = cell2mat(TLw_intrp(tv))+10*log10(Q/(4*pi*r*r)); % Conversion of Sound power(TLw dB) to Sound Pressure Level(SprLdB)
Spr{tv} = sqrt(2)*(Po*(power(10,cell2mat(SPrL(tv))/20))); % Conversion of Sound Pressure Level(SprLdB)to Sound Pressure(Spr Pa) and
% from effective values into "normal" values
Wav{tv} = cell2mat(Spr(tv)).*sin(pi*cell2mat(f_intrp(tv)).*t); % Data for the Wave file
Wav_sum = Wav_sum + cell2mat(Wav((tv))); % Summation of wav data for all time orders
end
audiowrite(filename_audiowrite,Wav_sum,fs,'BitsPerSample',32)
end

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Audio I/O and Waveform Generation in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by