sounds_in_labview

advertisement
Analysis of recorded sounds using Labview
W. Rose 2013-09-01
Department of Kinesiology and Applied Physiology
Sound Recorder
•
•
•
•
•
Simple program supplied with Windows
Uses built-in or external microphone(s)
Records two audio channels at 44.1 kHz
Saves the sound in a .wma file
Channels have same amplitudes if there is only one
microphone
Department of Kinesiology and Applied Physiology
Sound Files
Sound (or audio) files contain
• Header information (number of channels, sampling rate,
bits per channel, etc.)
• Signal amplitudes
Audio file formats
•
•
•
•
Uncompressed: *.wav, *.aiff, …
Lossless compression: *.wv, *.m4a, …
Lossy compression: *.mp3, *.wma, …
“Codec”=software to compress/decompress
Labview’s built-in sound VIs work on .wav files
• Convert other formats (including sound track from video
file) to .wav with a converter program or at media.io.
Department of Kinesiology and Applied Physiology
Labview Built-in VIs for Sound
Go to: Programming > Graphics and Sound > Sound
Sound File Info.vi
Sound File Read.vi
Sound File Read Simple.vi
Sound File Write.vi
Sound File Write Simple.vi
Acquire Sound.vi
Play Sound File.vi
Play Waveform.vi
and many more
Department of Kinesiology and Applied Physiology
Labview sound VIs
Go to: [course homepage]\examples\sound
soundfileinfo.vi
plot_sound_file_amplitude.vi
plot_sound_file_spectrum.vi
more to come
Department of Kinesiology and Applied Physiology
Department of Kinesiology and Applied Physiology
Department of Kinesiology and Applied Physiology
Example: Determining frequency of vibration
Goal
Estimate vibration frequency of external tendon stimulator.
Exploratory Analysis
Record an electric razor under different conditions with Sound
Recorder. Files were converted from *.wma to *.wav at media.io
and clipped to obtain steady at segments at cut-mp3.com.
Listen to audio files at [course homepage]\examples\sound:
• elec_razor1clip.wav (normal)
• elec_razor2clip2to10.wav (loose screen)
• elec_razor3clip4to10.wav (trimmer)
Department of Kinesiology and Applied Physiology
Example: Determining frequency of vibration
Methods
• Frequency was estimated with a musical tuner and with
Labview.
• Electronic musical tuner (Korg) was used during each condition
to estimate pitch. Pitch was converted to frequency using A440
equal temperament tuning. Korg tuner does not specify octave,
so frequency estimate is indeterminate up to a factor of 2n.
• Pitch of razor was compared by ear to a well-tuned piano.
• Frequency was estimated in Labview using
plot_sound_file_spectrum.vi, which calls Sound File Read
Simple.vi, Extract Single Tone Information.vi, Extract Multiple
Tone Information.vi, and Auto Power Spectrum.vi.
Department of Kinesiology and Applied Physiology
Example: Determining frequency of vibration
Results for elec_razor1clip.wav (normal):
Tuner: Frequency=131.6-132.4 Hz (or x0.5, x2, x4). Ear agrees.
Labview: f(peak power)=120.0, also 1062, 929 Hz
Spectrum has spike at 120 Hz; broad peaks at 398, 531, 663, 797,
929, 1062, 1195, 1327, 1460, 1593, 1727, 1860, 1992 i.e.
harmonics 3-15 of 132.8 Hz, plus other peaks below 400 Hz.
Department of Kinesiology and Applied Physiology
Example: Determining frequency of vibration
Results for elec_razor2clip2to10.wav (loose cover):
Tuner: Frequency= 134.3-135.1 Hz (or x0.5, x2, x4). Ear agrees.
Labview: f(peak power)=120.0, also 819, 682, 956 Hz
Spectrum has spike at 120 Hz; broad peaks at 294, 348, 682, 819,
955, 1092, 1228, 1365, 1502, 1638, 1774, 1910 i.e. at harmonics 514 of 136.4 Hz, plus other peaks below 400 Hz.
Department of Kinesiology and Applied Physiology
Example: Determining frequency of vibration
Results for elec_razor3clip4to10.wav (trimmer):
Tuner: Frequency= 116.2-116.9 Hz (or x0.5, x2, x4). Ear agrees.
Labview: f(peak power)=120.0, also 819, 936, 1402 Hz
Spectrum has spike at 120 Hz; broad peaks at 351, 584, 702, 818,
935, 1052, 1168, 1286, 1403, 1519, 1637, 1754, 1870, 1988 Hz i.e.
harmonics 3 and 5-17 of 116.9 Hz, plus other peaks below 400 Hz.
Department of Kinesiology and Applied Physiology
Example: Determining frequency of vibration
Discussion
• Pitch estimated by musical toner and pitch estimated by ear
were in agreement.
• Frequency estimated with Extract Single Tone Information.vi was
120 Hz in all cases, which did not match tuner and ear
estimates.
• 120 Hz electromagnetic pickup by computer microphone?
• 120 Hz audio buzz due to lighting?
Department of Kinesiology and Applied Physiology
Example: Determining frequency of vibration
Discussion
• Frequencies obtained by Extract Multiple Tone Information.vi
were consistent with a signal with a missing fundamental whose
frequency was that found by the tuner.
• Power spectrum plot was also consistent with a “missing
fundamental” at the tuner frequency.
• Razor probably generates sound at twice the frequency of the
mechanical oscillation. Therefore we should probably divide the
sound fundamental frequency by 2 to get mechanical vibration
frequency.
Department of Kinesiology and Applied Physiology
Example: Determining frequency of vibration
Next Steps
• Collect audio file from tendon vibration device under different
conditions: on a desk and attached with different degrees of
tension to a supporting device or a subject. Turn off lights,
unplug computer to reduce possible power line interference.
Use plot_sound_file_spectrum.vi to estimate vibration
frequency.
• Record audio file in razor trial location, with computer plugged
in, lights on, without razor. Is there power at 60 or 120 Hz?
• Record audio file of razor in dark room, computer unplugged, far
from devices that might radiate 60 or 120 Hz. Is 120 Hz
component reduced?
Department of Kinesiology and Applied Physiology
Download