Saturday, June 23, 2012

Software-based soundcard Oscilloscopes -- a preliminary note

One of the interesting finds I have been making is the existence and performance of free for download software soundcard oscilloscopes. These use audio inputs and the processing and plotting capabilities of modern PCs to give viable audio bandwidth instruments, though one has to be careful about input and output voltage ranges. 

For instance, they typically enfold a Fast Fourier Transform based audio spectrum analyser, here shown in "waterfall" or 3D mode that takes successive spectral snapshots, showing how the pattern of sound is unfolding as someone speaks amidst background noise:

A "waterfall" view of an audio spectrum, in Visual Analyser that shows how most of the signal energy in speech lies between 100 - 300 and 3,000 - 4,000 Hz. The pattern of resonant peaks -- formants -- is also visible, where the - 60 dB floor is set; actual signals can be seen 40 dB lower if desired but the "hash" will be confusing to the first-time viewer. Analysis of hearing will show how much of our ability to recognise and interpret speech is based on detecting such peaks and how they vary as we manipulate our vocal tracts. Notice, how the scales are logarithmic, not linear so that equal spacings correspond to equal ratios. (Cf discussions on the cepstrum here and here.)

Such packages as Visual Analyser, are interesting and informative. 

I also like Zeitnitz's scope (which seems to be based on the National Instruments LabView platform, but is standalone), and the Virtins RTA has a freebie tier that is upgradable to a full audio suite. You might also like their multi-Instrument, which is available as a 21-day free trial. (These last two put a definite processing load on my Netbook.)

These virtual instruments also point to how software capabilities of modern computers can potentially transform empirical investigations and industrial process control. For instance, typical slowly varying signals can be transformed by chopper stabilisation (cf. here), a form of amplitude modulation that alternately feeds the signal then signal ground into pre-processing amplifiers. That shifts the frequency to be processed out of the "flicker" or "pink" 1/f noise band to the much lower white noise zone, and it also can suppress drift effects. Similarly, video or wide band instrumentation operational amplifiers and associated processing circuitry could open up worlds of useful "roll your own" designs. (For op amps, cf. here, here, here, here and here.)

A basic chopper stabilised amplifier. The oscillator chops the input, acting as an amplitude modulator and moving its i/p from near DC to several hundred Hz, and so takes it into a zone where it is much easier to get a well-behaved amplifier.  The second stage "integrator" acts as a low pass filter, in effect demodulating the signal to recover the base-band, but now at a much higher and precisely determined amplified amplitude. (A chopper does not have to be done electronically, I recall a case of a specialist instrument, where an optical path was chopped with a rotating shutter that gave the pulsed signal.)  Auto zero designs are more advanced. (From Horowitz and Hill, 2nd edn, 1989)
This of course points to the significance of the hardware processing pods that are now marketed to work with PCs to make more capable instruments. Pico is a well known brand. at the low end the DAQ32 is worth looking at. Logger Pro looks interesting as a new way to do physics, chemistry and other scientific exercises in school.

However, something like the above also points to how such modules and libraries can be incorporated into programs used in an interfacing, control and data logging context. END

F/N 1: I suggest the Scientists' and Engineers' Guide to DSP, here. (There is a one file download here, notice how you will have to decrypt by using a provided password. Good enough that you may wish to look at the print version. )  

F/N 2: To try to figure out the Fast Fourier Transform, a first look could be here, noting that our hearing does this in a certain sense. That is, in the cochlea there is an array of hairs that resonate at different frequencies. Hearing is based on exciting these frequency resonances in an array, where the hairs are linked to nerves and are then processed in our brains: frequency comes from the hair excited, and amplitude from how fast the nerve cells are fired. The FFT algorithm is a quick computational way to do much the same, using mathematical tricks. Try also here, here and here. (The last is a book which uses a fair number of BASIC exercises to help build understanding -- a hint for how what we want may be do-able.) In effect:
  •  any pulse or wave can be analysed as a combination of sine waves of different frequency, phase and amplitude, 
  • a repetitive wave being a pattern of separate frequencies 
  • and, a transient pulse like a drumbeat being a continuous smear of sinusoids. 
  • A discrete time  digital version can be constructed. 
  • This, BTW, is why bandwidth is so important for telecommunications; 
  • you can see in the screenshot above that you can get away with 300 - 3,000 Hz for voice comms, 
  • which -- per Nyquist -- requires a sampling rate of at least 6,000 samples per second 
  • (the quick way to see why is to spot that you want to catch the upswing and the downswing of the sine, where also one will have to filter off at the 3 kHz to prevent a problem known as aliasing)
  •  it will work with 8-bit [256 level] uniformly spaced sampling, 
  • though it is more effective to use some form of ratio-based compression, to use fine steps for the likely to be low amplitude fine details. 
  • And so forth, and more, at length

. . . Sorry, a full-bore analysis and explanation is a serious mathematical exercise that starts from sinusoids, calculus and complex numbers, with series, then heads steeply north. The best I can do in a nutshell is to point to how the ear works. But, the point is, this sort of stuff is now very close to hand when we deal with technological equipment.

F/N 3: NC Lab cloud based numerical modelling is worth the look (and the wider site has other interesting packages).  So also are PSpice student, and LT Spice.