home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Club Elmshorn Atari PD
/
CCE_PD.iso
/
pc
/
0600
/
CCE_0682.ZIP
/
CCE_0682.PD
/
DSP_FILT.ER
/
DSP.DOC
next >
Wrap
Text File
|
1993-01-23
|
11KB
|
211 lines
DSP Version 1.0
--------------------------------------------------------------------------------
This program is FREE. You may distribute it at will, provided you
1) do not charge any money for it,
2) distribute it WITH the documentation, and
3) do not change the program or documentation in ANY WAY.
--------------------------------------------------------------------------------
1. Introduction
DSP is a Digital Signal Processing program which allows you to create
high pass and low pass digital filters, and use them to process digital
information. I wrote the program to try to get rid of that annoying
"warp drive rumble" that seems to be in the background of all Star Trek TNG
audio samples. I also needed an excuse to FINALLY learn GEM programming on
the ST. Although DSP was written to process audio samples, it's really a
general purpose digital filter program, so you can use it on any digital
information.
2. The "cover yer butt" section
This being my first program to be released into the public domain, I don't
know much about the legal remifications. But I've downloaded enough software
to have noticed that almost EVERYONE puts in a disclaimer of some kind.
I copped this one from a public domain program. It seems to have enough legal
mumbo jumbo to discourage any litigious griper.
This software is freeware. As such, it is provided on an as-is basis,
with absolutely no warantees, either express or implied, including, but not
limited to performance, usefulness, reliability, fitness for a particular
purpose or merchantability. The user assumes any and all risk involved in
the use of this software. In no event will the author be liable for
direct, indirect, incidental, or consequential damages resulting from the
use of, or inability to use, this software.
So there!
3. A few notes.
DSP runs in medium or high resolution. I don't have a TT to try it on, but
it should work in higher resolutions too. I couldn't get everything to fit
comfortably on a low rez screen, so the program will complain if you try to
use it that way.
My ST computer has 2.5 meg of memory, but I've used Jeremy Hughes's
520ST.TOS program to make it think it only has 512k, and DSP still works OK.
Audio samples can chew up a lot of memory and I didn't want to restrict DSP's
use by requiring that the entire sample fit in memory. Hence DSP breaks
the digital info into 4k blocks and processes it a little at a time. The
good news is that there should be no memory or sample size restrictions.
The bad news is that since the audio samples never reside completely in memory,
the program can't play them back.
This restriction means the program is not very interactive. You can't filter
an audio sample, listen to it, change the filter and refilter it, listen to it
again, etc. Well, you can, but you need another program to listen to the
sample, and keep switching between DSP and the other program. If you've
bought an audio digitizer (eg. STReplay) you already have software to replay
samples. There are also several public domain program which will do the trick.
(DMJ Software has a nice shareware program called Sound Lab and Dave Baggett
has written several nice audio programs (eg. PLAY.PRG). All are available
for downloading in GEnie).
4. So do something
To start things rolling put DSP.PRG and DSP.RSC in the same folder and
double click on the program file. You'll be presented with the one and
only dialog screen. (Originally I wanted to make DSP a desk accessory,
so there's no menu bar).
The dialog is divided into two parts. The top part is for specifying the
filter parameters and the bottom part is for processing data thru the filter.
The first thing you want to do is CREATE a filter.
To CREATE a filter select either LOPASS or HIPASS depending on what kind
of filter you want to create. You also need to know the sample frequency
of the digital data you'll be working with. Enter this infomation in the
"Sample freq: __.__ khz" field. Now enter the desired filter cutoff frequency
in the next field. NOTE: the program will complain if you enter a cutoff
frequency that is greater then 1/2 the sample frequency. This implies you're
trying to filter out frequencies that are greater then the nyquist frequency,
which doesn't make sense.
Next use the up/down arrow buttons to select the number of
coefficients to create. (Don't be alarmed when you only see odd
numbers. That's the way it's supposed to work.) The more coefficients you
use the better filter you'll create. Filters with less then 20
coefficients generally aren't very good, while 99 coefficients will give you
exceptionally sharp filter characteristics. On the down side, the more
coefficients you use the longer it takes the computer to calculate them, and
the longer it will take to process your digital info thru the filter. Such is
the give and take of life.
Now click on the CREATE button. The progress bar in the lower left hand
corner of the display will show the computers progress as it computes the
filter coefficients. NOTE: the process of calculating filter coefficients
is an iterative one, which requires the computer to converge on a solution.
As such, it's hard to determine when it will reach a solution. The progress
bar is only a rough estimate of how close the computer is to finishing its
task. It's really only there to provide that "warm fuzzy" feeling to the
user that everythings working OK. I've got a 16MHz accelerator in my ST and
it still takes about 45 seconds to create a filter with 99 coefficients.
Patience is definitely a virtue, if you want to create high caliber filters.
When the computer is done the progress bar and CREATE button will clear.
You might want to use the SAVE button to save the filter to disk. You can
use the LOAD button to load the filter at a later time, and not have to go
thru the create process all over again. There are a couple SAVE'd filters
in the download. DC.FLT filters out very low frequencies. There's a sample
on GEnie called HAL9000.SND (a sample of the voice of HAL from the movie
2010, I think) which has a DC offset in it and I used DC.FLT to clean it up.
NOISE.FLT is a general purpose low pass filter I've used to filter out
high frequency noise.
5. Processing data
Now that you've got a filter, you'll want to use it. You'll need to know
if your samples are created using signed or unsigned format (for all you Sound
Lab users, "signed" format is the same as setting the "High Bit" in Sound
Lab). All the samples I have use the unsigned format and that is the default.
However, I've heard that the STE's DMA playback requires samples in the signed
format. I guess the best thing to do is try filtering a sample using the
unsigned format and if the filtered sample sounds awful, try the signed
format. One of the two formats should work for you, and is selectable with
the two buttons underneath the "Input Sample" button. NOTE: I've also heard
some samples have "header" information at the beginning. DSP assumes the
entire input file is sample data and any header information will be lost in
the output file. If anyone has any information on file "headers", pass it on
to me and I'll account for it in the next version of DSP.
Click on the "Input sample" button and select a sample file to filter. Click
on the "Output sample" button and select a filename to store the filtered
sample. Then click "Process signal". The computer will crunch away at the
input file and produce the output file. NOTE: in this case the progress bar
is an accurate indicator of the computers progress.
That's about it. I usually create a few similar filters and process
the input sample with each of them. Then exit DSP and playback the results
and keep the one I like the most.
6. Techoid stuff
For the technically inclined:
DSP uses the remez exchange method to create the filter coefficients.
Although this method can create very complex multi-passband filters, it's
been restricted to only low pass and high pass filters for DSP's purposes.
Also, Remez exchange can create filters with varing degrees
of "ripple" in the pass and stop bands, as well as different filter
slopes. Much of this flexability has also been hardcoded into DSP to
make life easy. In general the filter characteristics have been chosen
to yield a filter with around 1db of ripple in the passband and -40db
attenuation in the stop band. The filter slope varies from 0.05Hz (normalized)
for filters with less then 35 coefficients to 0.015Hz (normalized) for
filters with greater then 85 coefficients.
If the paragraph above means nothing to you and you want to learn more about
digital filters, I highly recommend a book by Nicholas Loy titled,
"An Engineers Guide to FIR Digital Filters." It's a short book that cuts
thru all the math and presents digital filters in a practical light. There's
even some BASIC code to do digital filter design, which is the basis
behind DSP.
As an aside I'll mention that the digital filters performance depends
on the RATIO of the sampling and cutoff frequencies, NOT on their absolute
values. Therefore, a 51 coefficient lowpass filter created for a 20.00khz
sampling frequency with a 5.00khz cutoff frequency will behave EXACTLY
like a 51 coefficient lowpass filter created for a 10.00khz sampling
frequency with a 2.50khz cutoff frequency. (the ratio of sample frequency
to cutoff frequency is the same for the two filters). If you're going to
create a library of filters, you should keep this in mind. You don't need
two such filters, one will do.
6. Support
Although the end of my Christmas vacation will severely hamper work on
DSP, I'd like to hear from you. Good comments, bad comments, bug reports,
suggestions, whatever. If you come up with a nifty application for DSP,
I'd like to hear about it. I can be reached via GEnie as K.LORD.
Future enhancements will include:
1. Activate the menu bar, so people will have access to desk accessories.
2. Incorporate some kind of sample playback feature. I tried using Pexec()
and Dave Baggett's PLAY.PRG program, but it didn't work. If anyone has
some sample playback code they'd like to share, it would be
appreciated.
3. The "filter" box in the "Process Signal" box is currently blank. I was
going to put in a graphic showing the current filters frequency responce,
but never got around to it. Like I said, Christmas vacation is coming
to an end.
4. An option to create passband, notch and other more complex filters.
5. An option to create filter sweeps.
Keith Lord 12/29/92