### Author Topic: DSP theory and basics  (Read 27409 times)

#### markphaser

##### DSP theory and basics
« on: October 10, 2006, 02:59:24 PM »
What are the basics of DSP and the theory please?

How would writing Algorithms really easy software would matlab be easy to write LFO waveforms and phase shifters,flangers algorthms?

What is a block diagram of a DSP LFO or phase shifter,flangers please?

I heard u buy the DSP chip and read its instruction data sheet codes and then buy a templete that is made in matlab and u can modify it adding code or manipulating the values and code does this sound right?

#### markphaser

##### Re: DSP theory and basics
« Reply #1 on: October 10, 2006, 11:54:33 PM »
what software is easy to write DSP algorithms for phase shifting and short time delays ?

What is the basics and fundamentals of DSP? what kind of software can do all the math algorithms for u and has sample templetes already done like a library? what else is the basics and fundamentals of DSP in a block diagram the terms of DSP?

How can i make different waveforms using DSP what would i need to know to do this please?

#### Sir H C

##### Re: DSP theory and basics
« Reply #2 on: October 12, 2006, 08:07:04 AM »
You ask what amounts to a 4 year college degree.  Go to the Analog Devices or Texas Instruments web site, get a DSP kit they sell pretty cheap with instructions and go to town.

#### Transmogrifox

##### Re: DSP theory and basics
« Reply #3 on: October 13, 2006, 02:27:58 AM »
Read up on FIR and IIR filters.  FIR means "Finite Impulse Response", while, you guessed it, IIR stands for "Infinite Impulse Response".

If you feed a single-sample pulse to an FIR filter, it will output a sequence of bits that defines the time domain response of the filter.  The bit sequence for an FIR filter is finite, meaning after some prescribed number of bits it comes to an end.

If you feed a single-sample pulse to an IIR filter, the output will in theory be infinite in duration.  Typically this is done via feedback where the filter's output is added to the input.  By nature, such a filter's impulse response decreases in magnitude each time through, so practically speaking, the impulse response doesn't actually last forever because it fades to a level below the resolution of the digital processor similarly to how an analog filter's impulse response fades below the noise floor and becomes indistinguishable as part of an impulse response in relatively short order.

A flanger would normally be some form of an FIR all-pass delay filter summed with the input before being dropped into the D/A converter transmit buffer., though you may want to add a feedback function that would turn it into an IIR filter.

A phaser would normally be an IIR all-pass filter summed with the input before being dropped into the D/A converter transmit buffer.

The cut-off frequencies on these filters are modulated by changing filter coefficients in real time.  The flanger can be done by brute-force:   Just establish a circular delay buffer and modulate the pointer to the sample for output in this buffer.

The phaser is most easily done using digital filter theory more directly.

Either way, the LFO used to modify the filter coefficients is generated separately from the filter.  You could even build an analog LFO and input it to an A/D converter and use the result from the A/D converter to modulate the filter.  This is similar to how a digital wah wah or volume/expression pedal works (though the "A/D" conversion is generally a digital rotary encoder instead of reading a voltage off a pot)

Those are questions that cannot be answered in a single post.  For the questions you have had, mark phaser, I recommend you enroll in an electrical engineering program at a nearby university.  There's a lot of background you need before you can even fully comprehend the relationship between an impulse response and a filter's frequency response--let alone what an impulse response is and why we characterize filters in this way.  Actually building some filters and playing through them with your guitar will then help you answer the questions of "what does one of these 8th order elliptical filter things sound like on a guitar?"
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

#### markphaser

##### Re: DSP theory and basics
« Reply #4 on: October 13, 2006, 07:37:29 PM »

What DSP books do u have or how did u learn about DSP?

Would getting a DSP kit help me out to make a flanger and phaser and LFO programming it in DSP? and which DSP kit would be able to do this please?

On amazon.com i see DSP books but which ones should i buy so i can understand about using DSP like how roland,korg,zoom,digitech,line 6 uses DSP to get tremolos,delays,reverbs,phasers,flangers,etc how do i learn about DSP programming like how these DSP guru's ?

#### Transmogrifox

##### Re: DSP theory and basics
« Reply #5 on: October 13, 2006, 09:24:45 PM »
I'll have to check the author and name at home on my text.  I have a bachelor's in electrical engineering and took a DSP class as an elective during that time.  I think it would have been very difficult for me to understand the theory without previous classes covering signal processing theory and feedback control systems.  I wouldn't have had an easy time with signal processing and controls if I hadn't first completed differential and integral calculus, and differential equations.

That's why I think a college education in this field is one of the fastest ways to learn this stuff.  There are so many fundamentals that need to be second nature to you before you can understand the answers to your questions.

All the same, programming an LFO doesn't take much technical knowlege in terms of math and signal processing theory.  A tremolo does not require advance signal processing theory, nor does a delay.  Reverbs may take some understanding of acoustics to program a good sounding reverb, but not much signal processing theory.  Filters, such as phasers and envelope filters, vocoders, and FFT-based applications are much easier with a background in DSP theory.  Amp modeling is a place you could really apply a lot of DSP theory.

Getting a DSP kit could help you if you are willing to invest the time in figuring it out.  The datasheets are scary for a first timer, but you would eventually start to get the idea.  You just need to really understand what it is you want to do, and how it can be done before you go trying to make a DSP do it.  It'll do exactly what you tell it to do, and if you don't know exactly what you want it to do, then it doesn't either.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

#### markphaser

##### Re: DSP theory and basics
« Reply #6 on: October 13, 2006, 11:25:16 PM »

programming an LFO doesn't take much technical knowlege in terms of math and signal processing theory.

Can u please explain how u or a DSP programmer would do this i just want to get the concepts down and block diagrams

A tremolo does not require advance signal processing theory, nor does a delay.  Reverbs may take some understanding of acoustics to program a good sounding reverb, but not much signal processing theory.

Filters, such as phasers and envelope filters, vocoders, and FFT-based applications are much easier with a background in DSP theory.

Digital oscilloscope have FFT functions to look at how many harmonics are in a waveform how does DSP use FFT?

Amp modeling is a place you could really apply a lot of DSP theory.

Can u please explain more detail about DSP tremolos,LFO's,vibratos,reverbs,delays,amp modeling,phasers,flangers, for DSP concepts and block diagrams

where is there samples of DSP guitar effects? does the DSP kits have examples and samples so u can data entry the algorithms ?

#### Sir H C

##### Re: DSP theory and basics
« Reply #7 on: October 14, 2006, 02:12:14 PM »
Go to the TI and Analog Devices web sites.  That is where you will find information about their kits.  I could tell you they do everything you ask and more.  I could be lying, I might be telling the truth but if you go to their websites and see for yourself then boom you know authoritatively what they have and what they can do.

You say that it doesn't take much signal processing theory to do this stuff, I say it does.  If you don't know the S and Z transforms, then you are not going to have the foundation to build on.

Oppenheim and Schafer's "Discrete Signal Processing" is often used by universities to teach this stuff.

#### markphaser

##### Re: DSP theory and basics
« Reply #8 on: October 15, 2006, 12:18:12 AM »
What kind of math formulas or math subject is good for programming DSP and algorthims for phasers,flangers? What do i need to know on how to program a phasers filters is it FFT? differential and integral calculus, and differential equations? vector phase equations? Time domain and frequency domain equations?

If i know C++ programming language what am i missing as for as DSP programming?

DSP chips have FFT math calculators built in to do the FFT formulas. There is 4 FFT cores processors so more clock cycles,multiplexing buss lines,pipelining

C++ is IF THEN statements,Loops,structures,unions,expressions,variables,floating point,intergal programming,pointers variable moveable,local or global memory,For Next loop,branches,link list, array,memory data basing registers

What does DSP have for functions and code instructions that C++ doesn't have or do please?

#### Peter Snowberg

##### Re: DSP theory and basics
« Reply #9 on: October 15, 2006, 11:57:21 AM »
Markphaser,

If you want to know the answers to these questions, you need to follow the advice above and start studying.

DSP is COMPLEX and you need years of study to understand the questions as well as the answers. If you truly want to know, you need to stop asking questions here and to start studying.

#### toneman

##### Re: DSP theory and basics
« Reply #10 on: October 15, 2006, 02:31:11 PM »
Here's a semester's worth of reading......

http://www.dspguide.com/pdfbook.htm

T
TONE to the BONE says:  If youTHINK you got a GOOD deal:  you DID!

#### SeanCostello

##### Re: DSP theory and basics
« Reply #11 on: October 15, 2006, 11:34:55 PM »
Go to Julius Smith's website at CCRMA. It should have answers to a lot of your questions, as well as giving you some idea of the math involved.

Sean Costello

#### David

##### Re: DSP theory and basics
« Reply #12 on: October 15, 2006, 11:36:14 PM »
Markphaser,

If you want to know the answers to these questions, you need to follow the advice above and start studying.

DSP is COMPLEX and you need years of study to understand the questions as well as the answers. If you truly want to know, you need to stop asking questions here and to start studying.

#### markphaser

##### Re: DSP theory and basics
« Reply #13 on: October 16, 2006, 02:02:29 AM »
Thanks guys for the help

What DSP books are good that apply DSP for guitar effects like zoom,digitech,roland,line 6 etc.

Is digital filters the main thing to know about DSP? for chorus,phases,flangers

How do u do DSP feedbacking positive or negative feedback loop like in a phaser,flangers?
I was thinking Nesting loops like subrountes inside a loop would make a feedback loop in a body of a algorithm right?

I know operators are like summing amps in software and if then statements are like comparators circuits

For the preamp and output stage circuit i guess a algorithms for gain structure or amplifing the digital signal in DSP and then
the DSP digital filters with DSP LFO would be the main core of DSP programming im guessing here

#### markphaser

##### Re: DSP theory and basics
« Reply #14 on: October 16, 2006, 03:17:54 AM »
DSP Phase shifter
1.)   notches that are non periodical
2.)  IIR comb filters

DSP Flanging
1.)  notches of the comb filter which are periodical in frequency
2.) FIR comb filters

DSP vibrato
1.) IIR comb filter

Reverbs
1.) IIR comb filter
2.) Acoustical Cylinder
3.) frequency dependant feedback coefficient

DSP filters
1.) sequence of multiplication's and additions
2.) utterworth, Chebyshev, Inverse Chebyshev, Elliptic, Kaiser Window, Dolph-Chebyshev, and Equi-Ripple
4.) "Windowed" filters
5.) filter complexity number of taps
6.) vector of polynomial coefficients
7.) Recursive and non-recursive filters
8.) transfer function of a digital filter this sets the frequency response
9.) output sequence for the filter
10.) Coefficients of recursive (IIR) digital filters
11.) filter coefficients-values of these coefficients determine the characteristics of a particular filter

FIR (Finite Impulse Response) filters
1.) can create transfers functions
2.) Calculation coefficients
3.) symmetric FIR filters
4.) NON-Recursive filters
5.) Fixed point math processing
6.) FIR comb filter feedback

IIR (or Infinite Impulse Response) filter
1.) Recursive filters
2.) Floating-Point math processing
3.) IIR comb filter feedback

Software programs to make DSP IIR or FIR digital filters:
1.) Matlab graphical user interface (GUI)
2.) LabVIEW Digital Filter
A recursive filter is one which in addition to input values also uses previous output values. These, like the previous input values, are stored in the processor's memory.recursive literally means "running back", and refers to the fact that previously-calculated output values go back into the calculation of the latest output. The expression for a recursive filter therefore contains not only terms involving the input values
non-recursive filter is known as an FIR (or Finite Impulse Response) filter, and a recursive filter as an IIR (or Infinite Impulse Response) filter. These terms refer to the differing "impulse responses" of the two types of filter
The impulse response of a digital filter is the output sequence from the filter when a unit impulse is applied at its input. (A unit impulse is a very simple input sequence consisting of a single value of 1 at time t = 0, followed by zeros at all subsequent sampling instants). An FIR filter is one whose impulse response is of finite duration. An IIR filter is one whose impulse response (theoretically) continues for ever, because the recursive (previous output) terms feed back energy into the filter input and keep it going. The term IIR is not very accurate, because the actual impulse responses of nearly all IIR filters reduce virtually to zero in a finite time. Nevertheless, these two terms are widely used

#### Rob Strand

##### Re: DSP theory and basics
« Reply #15 on: October 16, 2006, 05:22:56 AM »

> DSP chips have FFT math calculators built in to do the FFT formulas. There is 4 FFT cores processors so more clock cycles,multiplexing buss lines,pipelining

>  How do u do DSP feedbacking positive or negative feedback loop like in a phaser,flangers?

I can see when you make comments like this you are missing something!

DSP isn't a programming language it's a way of processing signals digitally.  DSP is largely mathematical.  You have input variables/signals/numbers and it produces output variables/signals/numbers.    You can do DSP with C++.

On the other side there are processors which are optimized for DSP.  That doesn't make other processors incapable of DSP processing it just means they might not be as fast, or as neat", doing the same job.   Like all processor they have a low level programming in assembler - this is very efficient in terms of processor time.  However you can also get C compilers for these processors so you can write DSP in C - this very efficient in terms of getting programs running quicker.

Feedback is simply a matter of taking one of the output variables and adding it or subtracting it from an input variable before feeding it back into a "digital system".  If you can draw a block diagram you basically follow that diagram.  At each functional unit you will have some a related equation for example,

input_with_feedback  =  input  + k * feedback

where k would be the  amount of feedback.

This equation can be treated as a mathematic statement, or as a statement in a programming language.

The thing is you have to convert every thing into a digital representation with some sort of calculation.

Digital filters for example is one whole world of doing filtering in using digital processing.  The filters are generally *discrete time* in that your signal are  at equally spaced intervals in time eg. CD is 44.1kHz.

An LFO is simply an equation, table, or whatever, that generates another waveform eg Sine, Triangle.  IF you can write a program to generate such a waveform in C or C++ that that's all there is to it.  When it comes to a phaser you have to modulate the filters charactersitic with the LFO waveform.  So you would take the number produced by the LFO code and then calculate the filter coefficients to correspond to the sweeping of the filter.  This behaviour is going on in an analogue circuit - it's up to you how to bend things around and calculate the digital version of this - there's more than one way to do this.

I'm not trying to teach you DSP here you have to study that in your own time.  What I trying to do is bridge what I see as the gap between what you want to do and the DSP world.

The answers are out there for those who want to find them.

#### Sir H C

##### Re: DSP theory and basics
« Reply #16 on: October 16, 2006, 09:52:52 AM »
What kind of math formulas or math subject is good for programming DSP and algorthims for phasers,flangers? What do i need to know on how to program a phasers filters is it FFT? differential and integral calculus, and differential equations? vector phase equations? Time domain and frequency domain equations?

#### markphaser

##### Re: DSP theory and basics
« Reply #17 on: October 16, 2006, 01:05:29 PM »
Thanks for the help

What I trying to do is bridge what I see as the gap between what you want to do and the DSP world

Yes i just want the concepts not the actuall detail really instruction code just knowing about DSP and how the mechanics of how it works

So the LFO is sweeping the filters coefficients values?

An LFO is simply an equation, table? This is my problem of understand how to do or make LFO waveforms in C++ i still don't see and understand how they do them are they operations,expressions, math calculations i don't get it i have my C++ book out and i don't have any chapter on how to make a LFO , LFO's waveforms are not digital filters so what are they in DSP please? are they link lists,arrays,structures like a data base and then u loop function them in cycles or something? because a array is a table or rows and columns like excel or access is this what u mean?

Feedback is simply a matter of taking one of the output variables and adding it or subtracting it from an input variable before feeding it back into a "digital system".

LIke Passing values,passing pointers,passing arrays,passing arguments,passing to functions,passing to subrounties? to manipulate the variable right?

#### Rob Strand

##### Re: DSP theory and basics
« Reply #18 on: October 17, 2006, 12:03:47 AM »
>  LFO is sweeping the filters coefficients

Yes.

> problem of understand how to do or make LFO waveforms

It's some form of equation, for example for a sine wave LFO,

LFO_output  = sin(2 * pi * f_lfo * t)
t   = t + T_sample

where f_lfo is the  LFO Frequency and  T_sample is the sample time.

LFO_output is used to generate the filter coefficients

The above generates one LFO output at time, t.  Every time you get a new sample the time is updated and the LFO output changes with time.

That's basic the idea.

Another alternative is to fill out an array before you start, this results fairly large array but is faster to calculate (you only have to calculate it once).  As each sample goes by you step through the array.  Because the LFO is periodic you only need to store one period in the table.  I haven't tried to optimize anything as it will only confuse the point I'm making.

The answers are out there for those who want to find them.

#### Transmogrifox

##### Re: DSP theory and basics
« Reply #19 on: October 18, 2006, 02:51:46 AM »
mark phaser, I think you have not yet come to understand what an LFO is.  First let's start with the acronym:
LFO = Low Frequency Oscillator

That's all.  An analog oscillator is a circuit that produces a voltage that changes with time and repeats itself in a periodic and predictable manner (usually).  An LFO is a circuit that does this at a low enough frequency that we can watch the LED blink on every positive half cycle of the periodic fluctuation.  I don't know if you have ever watched an oil well pump in wyoming or North Dakota or Eastern Montana, but you could call the oil well pump an LFO.  It periodically modifies the position of the plunger at a visible rate.

A digital LFO is a program that generates a sequence of numbers that repeat periodically, and the period of repetition of the cycle is measured typically in units of seconds as opposed to milliseconds or microseconds such as would be considered an audio waveform generator.  In the case of the oil well pump, you could interpret the numbers as feet the end of the arm is to be elevated above the ground.

If you turn your function generator on the test bench down to 10 Hz, you have an LFO.

If you plug that into a speaker you won't hear anything.  You won't even hear a sweeping swooshing sound.  You'll probably hear a crackling sound from the electrical current burning up your speaker coil, if anything.

A filter on its own is not as exciting to hear on an audio signal as a filter that can move its center frequency up and down in the audio spectrum.

We can identify a filter's resonance, gain, and resonant frequency from the characteristic differential equation that describes its output with respect to time and input.  This is called a transfer function.  The coefficients on each term in the differential equation define the parameters mentioned above.  We typically perform a Fourier transform on this characteristic equation to express the filter in terms of frequency response as opposed to its time-domain response to inputs.

That last paragraph fits under the broad category of signal processing.  Notice, no circuits, no code, no electricity.  These concepts can apply to mechanical devices in terms of striking devices.  For example, a guitar string can be thought of as a highly resonant comb filter, where the peak frequencies of the filter are harmonically related.  The input to the filter is a pulse, which is the action of plucking the string.  Since a pulse is rich in frequency content, it is likely that there will be some content within the string's resonant bands.

Now for circuits.  Circuits can be configured to behave in similar manners.  And even further, a digital SIGNAL PROCESSOR can be programmed to do the filter thing.  In digital land, we don't have differential equations, we have difference equations.  We like to think frequency response, so we perform a z-transform on the difference equation to get frequency response information more directly than can be obtained from the time domain response.   The coefficients on the difference equation (and thus on the z-transformed equation as well) define filter properties in a like manner, such as resonance and cut-off frequency and gain and such.

Without an LFO, you simply have a filter that has a fixed resonance, center frequency, gain, and phase response.  Now if you can modify one of these coefficients over time, then the filter's nature will change with time.  If you do it gradually with time, it will typically result in a nice sweeping or swooshing sensation.  Ah!  Let's write a program that automatically changes a few coefficients in a certain pattern with respect to time.  That's what we would call an LFO.

The LFO itself doesn't do anything special on its own.  Each number it outputs is interpreted as either an amplitude for a signal (in the case of a tremolo), or a certain filter coefficient, or an amount of delay, etc.

Does that help?
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.