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

6 次查看(过去 30 天)
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 个评论
Star Strider
Star Strider 2016-3-9
‘Do any of you have an explanantion for this??’
Not without seeing the rest of your code.
Karthik Brs
Karthik Brs 2016-4-21
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

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by