DSPBOX v 1.0 by Alberto di Bene, I2PHD dibene@usa.net and Vittorio De Tomasi, IK2CZL ik2czl@amsat.org What is DSPBOX ? ---------------- DSPBOX is an attempt to code the Texas Instruments DSK 'C50 in such a way to make it behave like a commercial DSP noise reduction unit, like the NIR-12, the TimeWave 599+ and others. Not only the noise reduction function has been implemented, but automatic notch, AGC and Band Pass have as well. System requirements ------------------- You need of course the TI DSK 'C50, and a PC running DOS (a measly '386 will suffice) with one serial port (COM1 or COM2). The program has not been tested with a fast Pentium yet. There should be no problems, but I cannot guarantee it. I developed it with a 50 MHz '486, as this is the computer I use for my Ham station. I have also a 200 MHz Pentium, but in another room. If need be, I can arrange to test DSPBOX with this PC. The audio from the radio receiver is taken either from the headphone plug on the front panel (preferred), or from the aux speaker connector on the back. In this latter case, depending on the radio, there is the possibility that the level is a bit too high. With some experiment it will be possible to decide whether to insert an attenuator or not. The DSK has only a line-level output, so a small power amp is needed, 1 Watt will suffice. Windows users, read here ------------------------ DSPBOX runs OK in a DOS full screen session of Windows 3.1 Unfortunately the same cannot be said of Windows 95. As far as I know, it *should* work, but it doesn't. The program hangs during the initial DSP code loading. It has somehow to do with the virtualization that Win95 does of the comm ports. If any W95 guru has suggestions, please contact me at dibene@usa.net So, if you have Win95 on your PC, before launching DSPBOX please reboot in DOS mode. How to use it ------------- Connect all the cables (serial and audio), power on the DSK and the PC, and change directory to that where you decompressed the ZIP file. Then issue the following command : DSPBOX /Cx where x can be 1 or 2, meaning COM1 or COM2 The program defaults to COM2. DSPBOX initially sets the serial speed to 57,600 bps and downloads the DSK code, contained in the file DSPBOX.CDF Then it changes the serial speed to 3,200 bps, as this is the speed used by the DSK code, which is synchronized with the sampling rate (9600 s/sec). You should now see a panel with five green boxes, each one related to a specific function and to an F-key of the PC. Green means that the function is not active, red that it is. F1 toggles AGC on/off F2 toggles the denoiser function on/off F3 toggles the automatic notch function on/off F4 toggles the band pass function on/off F5 toggles the active/bypass function, i.e. when green, the incoming audio is simply rerouted to the output DAC, with no processing. By using the cursor up, down, left and right keys, it is possible to select (up and down) and to adjust (left and right) various parameters. You can select from : - Low Cut (ranges from 200 Hz to 4000 Hz or the value of High Cut minus 50 Hz, whichever is less. - High Cut (ranges from 4000 Hz to 200 Hz or the value of Low Cut plus 50 Hz, whichever is greater. - Denoiser value (ranges from 2 to 40, 2 being least effective) - Denoiser type (ranges from 1 to 4, 1 and 2 being most appropriate for voice signals, 3 and 4 for CW). Of course the Low Cut and the High Cut limits are effective only when the band pass function (F4) is activated. The AGC should be adjusted by receiving a medium signal, not too strong nor too weak, and adjusting the audio level of the receiver so that there is minimal difference between having AGC off or on. Then don't touch any more the radio volume, but use instead the volume control of the external power amplifier you inserted after the DSK unit. The effectiveness of the LMS noise reducing filter is strongly affected by the audio level, so my suggestion is to leave AGC always on, but of course you are free to experiment... If you want to test the notch function, go into some broadcasting band, and tune an AM station in SSB mode. Then insert the notch. You will be amazed by its sharpness and depth. If you want to use the PC after having set the DSK as you want, you can. Just press ESC, the DSPBOX program will exit, but leaving the DSK fully operational. Of course you cannot change anymore its state, until you re-execute DSPBOX. Some technical notes on the implementation ------------------------------------------ The DSP code is composed of a background and a foreground task. The backround task has two purposes : - To manage the serial communication with the PC, in synch with the sampling rate. - To calculate in real time the new h(n) coefficients for the band pass filter, according to the user input (more on this later). The foreground tasks is driven by the ADC interrupt (one every 104 microsec.) and does the following : - Perform AGC function via a precomputed look-up table - Perform LMS filtering with a 128-tap FIR filter, whose coefficients are updated at every cycle according to the LMS algorithm. Stealing an idea from W9GR, I decayed them with a decay factor optimized by trial and error. - Perform notch filtering, again with another 128-tap FIR filter, LMS-adjusted and decayed. - Perform the band-pass filtering with a 255-tap FIR filter, whose coefficients are computed in real time by the background task. - Send the output sample to the DAC converter. The 'C50 has enough power to compute all of the above simultaneously at 9600 samples/second. A simulation of the band pass filter done with Matlab shows a stop band rejection close to 80 db. The h(n) coeeficients of the band pass filter are computed using the method of frequency sampling, where you draw in the frequency domain the desired pass band, then do an IFFT to compute the h(n). Care has been exercized not to have abrupt transitions from the pass and the stop bands, as this would give unacceptable ripples in the stop band (the Gibbs phenomenon). By simu- lation with Matlab I found that two transition values between 1 and 0 per edge are an optimum compromise between ripple and steepness of the transition, at least for the purposes of this program. The time left from the foreground task at each cycle is enough for the background task to compute those coefficients in a few milliseconds. Disclaimers ----------- I hate disclaimers and all the legalese stuff, so that's why I put it at the end. Somebody told me I have to, so here is it. Feel free not to read it. Alberto, I2PHD ----------- The authors will not be liable for any direct, indirect, consequential or incidental damages to other pieces of software, equipment, goods, or persons, arising from the use of this software. The authors are not liable for any possible illegal use of this software, and for any other act arising from the results obtained from the software. Although the use of the software DSPBOX is free for the purposes described in the present document, it is *not* a public domain software. The authors retain the full copyright on the software binaries, the source code, and the user interface. DSPBOX is a Copyrighted property of: Alberto di Bene, I2PHD dibene@usa.net via Albignano 28 I-24040 Casirate d'Adda (BG) Italy Vittorio De Tomasi, IK2CZL ik2czl@amsat.org Via Melzi d'Eril 12 I-20154 Milano Italy (c) 1997 The use of this software is free for hobby and research purposes. If used for commercial or industrial purposes, you must obtain a licence agreement from the authors. The program can be freely distributed, provided that you don't charge money for this, except for the cost of the transfer media, and that this text document is distributed as well. The commercial distribution of the software without the permission of the authors is strictly forbidden.