Save and play pure 20kHz signals (sound)
7 views (last 30 days)
Show older comments
Hello,
I'm trying to save (as .WAV) and play 20kHz pure signals (short and long signals) but as I see at the visualizer, I didn't receive what I really need.
as you can see this is the WAV file inspection, I send 20kHz but there are more noises below.
Also, I use a 20kHz dedicated speaker and when I transmit the 20kHz I hear ticks that I don't want to hear (maybe because of the noises or because of the sin signal that i send wrong)

freq=20000;
time=3000;
Fs=48000;
timevec = (0:1/Fs:time-(1/Fs));
short = sin(2*pi*freq*timevec(1:7000));
long = sin(2*pi*freq*timevec(1:20000));
%%
%.
%.
%Here i put the signals in array to send them at the order that i want
%.
%.
%%
pp = audioplayer(array,Fs);
play(pp);
filename = 'sound.wav';
audiowrite(filename,array,Fs);
0 Comments
Answers (1)
Image Analyst
on 1 Mar 2022
Try a lower frequency, like 10 KHz. Then see if you can hear that. Keep bumping up the frequency and see what you hear. It could be either that your speaker system really can't play that high a frequency, or that your ears can't hear it. If you have an audio frequency spectrum analyzer (like one with a microphone) then you can actually test what's coming out of the speaker, which is better than trusting your ears.
1 Comment
See Also
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!