Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Sound Card Event Counting
To do this, you must first determine some feature of the event that sets it apart from the rest of the signal. The idea is to detect only desired events, but exclude any unwanted "false" events.
Let's say you want to count the number of cars that pass by a particular location, using only the sound gathered by a suitably-placed microphone. If the noise of a passing car is always louder than the background noise, you may be able use the Total function with a suitable Trigger settings. This may require a certain amount of experimentation. For example, if you set the trigger Level too high, you may not detect quiet cars, while if you set it too low you may trigger on noisy trucks from another street.
You can tell when you have the trigger level adjusted properly by watching the waveform display: You should see it update once whenever a desired event occurs, but not for an unwanted event.
In most cases, selection and placement of the microphone or other transducer will be important for maximizing the wanted signals and minimizing unwanted signals.
There may be situations where you can't find reliable trigger settings, if the desired and unwanted signals are of the same general magnitude. However, if they are in different frequency ranges, it may be possible to discriminate between them based upon the energy in the target range. Traditionally, this would be done by applying a band-limiting filter to the signal, which would reduce the unwanted signals enough so that only the desired signal reached the trigger level.
Daqarta provides the SpecTot function to accomplish a similar result, reducing or eliminating the need for external filtering. SpecTot uses the Trigger Level setting, but in an unusual way: It counts an event only if the spectral content between the Spectrum cursors exceeds the Level setting.
Suppose you want to count only passing cars that are using studded snow tires, which have a distinctive whine in a particular frequency range, dependent upon speed. You must set the cursors such that the whine frequency is above the lower cursor frequency at the slowest speeds, but below the upper at the highest speeds.
This might encompass a large frequency range, perhaps more than double, from low speed to high. You can use the Delta cursor mode to count an event if any spectral component between the cursors exceeds the Level; that might be a good choice if most cars have little energy in the range, so a peak would stand out.
Conversely, you can use the Sigma cursor mode to count an event only if the total energy exceeds the Level, even if no individual frequency does.
SpecTot would be a good choice to count things like animal calls in the wild, where you know the frequency range of the desired calls, but the background noise may be unpredictable. Because most noises are spread over a broad band of energies, the noise energy in the region of interest may be relatively low even if the overall noise is rather loud.
You can use Trigger Holdoff in either Total or SpecTot mode. You'll need this to prevent erroneously counting multiple events if a single event is longer than one screen (1024 samples). Just set Holdoff longer than any single event.
Here is a simple macro that logs the current count each minute for 24 hours, and also records the time of each count:
UT=0 WHILE.UT=<24 * 60 ;24 * 60 minutes WaitSecs=60 ;Wait 1 minute LogTxt=n + Freq + p20 + t ;Newline, total, time UT=UT+1 ;Count the minute WEND.
Note that the LogTxt line records Freq, not Total. Freq is the current reading of the Frequency Counter, regardless of mode, so this will work with either Total or SpecTot modes. (Or any other mode, if you want to log, say frequency instead of event counts.)
Note that you can use these event counting methods with previously-recorded file data. This has the particular advantage that you can run through the same file again and again while you are adjusting the Trigger controls, until the Total or SpecTot counts match the results of a manual count (obtained by slowly scrolling through the file, perhaps).
Just open the file and start the counter as for live data. You will see the file position readout advance as the file is scanned, and the count will update for each event. When you get to the end of the file, the count and trace updates will stop and the Pause button will be activated.
Make a note of the total events counted, before you do anything else. (If you use the Notes section, you can optionally re-save the file with the new Notes when you close it.) Then you can hit the Home key to return to the start of the file, hit the Frequency Counter Reset button, and try readjusting the trigger settings before you unPause to run the file through the counter again.
You can use the Arduino_Counter macro mini-app to count digital events such as pulses or switch closures. The pulses must be at least a few 10s of microseconds wide to insure they are detected, and the time between pulses must be at least 30 milliseconds to insure that no pulses are missed during display updates or other background activity.
By setting parameters at the start of the macro code, you can count high pulses (where the line is normally low), or low pulses (where the line is normally high). You can count very infrequent pulses by using a large timeout Wait.
You can also count bursts by setting a holdoff value. After counting the first pulse of the burst, the macro waits for the specified holdoff before it goes back to waiting for the next pulse.
The simple AC-to-DC Input Level Shifter and Limiter circuit allows you to count many types of AC events such as tone bursts, which can be created by the Daqarta Generator on a normal AC-coupled sound card, or by external equipment.
You can use the Auto_Recorder macro mini-app to count events and simultaneously provide a data recording and a text log file of each event. This mini-app was created as a "sound activated" recorder that does nothing until an event is detected, then records only the event before stopping to wait for the next event. This simplifies later analysis since you don't have to scan through empty sections.
Auto-Recorder includes an Event Threshold control to start the recording, and a Quiet Threshold to stop it after a Minimum Quiet duration. The latter prevents stuttering from multiple rapid events, or missing critical tail-end features of a slow-decaying event.
There are separate RMS and Peak detection modes, as well as the ability to select either Right, Left, or Both input channels for event detection.
An Event Logging option saves each event number, date, time, and file time. The latter is the time relative to the start of the data file, to aid in later locating the event in the data.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2021 by Interstellar Research
All rights reserved