News:

SMF for DIYStompboxes.com!

Main Menu

DSP theory and basics

Started by markphaser, October 10, 2006, 02:59:24 PM

Previous topic - Next topic

SeanCostello

The explanation from Transformix is good. A LFO is an O that runs at LF.

One further note: In some cases, low frequency oscillators in digital systems run at a lower rate than the sampling rate. Many DSP systems work with blocks of samples at a time, as this can result in higher efficiency (VST and Audio Units, for example, work on blocks of samples at a time). If an oscillator is intended for low frequencies, it can run once per block, as opposed to once per sample, without much loss in audio quality. This may introduce some some quantization error for certain apps (where the "stairstep" waveform comes out as noise), so the low frequency oscillator may be interpolated at the sample rate. As long as the interpolation is cheaper than the LFO generation, this is a good idea.

Sean Costello

R.G.

Gentlemen - you are trying to shovel sand against the tide.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Rob Strand

> Gentlemen - you are trying to shovel sand against the tide.

Forums tend to have a strong tide at the best of times, but you can only hope a few grains stick.   I don't know what sticks when you try to do something into the wind.



Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Arno van der Heijden

> Gentlemen - you are trying to shovel sand against the tide.

I have to disagree.

Apart from Markphaser, this kind of posts can really help other people to get a better understanding of DSP.
I, for myself, find them very interesting at least. It helps me to get a better understanding of the whole picture.

So, thanks for the effort and keep 'm coming!

markphaser

Thanks alot Transmogrifox for your information and time

An analog oscillator is a circuit that produces a voltage that changes with time and repeats itself in a periodic and predictable manner (usually).

When programming a LFO in DSP or in C++ what instruction code do u use to make voltage changes with time?

LIke how do i put in the instantaneous values for voltages/amplitude,phase degree,time interval of the waveform and its waveshape?

Do i just put in instantaneous values inside a loop? but in my C++ book i can't find where u can set a voltage instantaneous value and then sets its phase degree,time duration there must be a instrunction code i just don't know the names to sets these C++

When i put my oscilloscope probe on the output of a DSP chip i should see the voltage/amplitude,phase degree value,time duration
sweeping up and down so the instructions codes has to be linked to the D/A converters output

repeats itself in a periodic:
This is a Loop function to repeat a LFO waveform periodic?

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

But thats not sweeping up and down its just a fixed manual LFO not a oscillating LFO it would have to have a start Frequency and a stop frequency points and sweep in the range of like 8hz-12hz or 10hz-15hz its sweeping the start frequency and stop frequency

If u put in a square waveform into a filter network with a LFO set a 10hz its going to output a squarewave with a fixed duty cycle duration. If u sweep the frequency to 8hz-12hz or 10hz-15hz the squarewaves on time/off time durations changes the duty cycle percetages

A LFO is not a oscillator its a sweeping oscillator in my electronics books all they talk about is just fixed oscillators at one frequency. A LFO modulates the frequency up and down, in a analog LFO circuit what component or network makes the oscillator SWEEP up and down?

A univibe uses a Phase shifter oscillator which is different than a regular oscillator so the instantaneous values for voltages/amplitude,phase degree,time interval of the waveform and its waveshape are way different. If u put your oscilloscope probe down on the output of the univibes LFO the waveshape is different than a regular oscillator like in a MXR phase90 i think its the
instantaneous values for voltages/amplitude,phase degree,time interval. I'm trying to stress that the instantaneous values make the LFO's waveshape because in a univibes LFO its very Hyperbolic waveform close to a sine waveform. Hyperbolic means a sinewaveform but with rounded top and bottom "EXCURSIONS"

LED blink on every positive half cycle of the periodic fluctuation:

Most Lamps,LDR's,LED's have sag time would this be setting the LED duration time in C++ to get a "sag time" because most LDR's have a Sag time internally built in? set a Delay value so the resistances changes the filters coefficient values.

The LFO is sweeping faster than the LDR's slew rate resistance changes from a resistance start point to a resistance stop point and these range its sweeps the resistance. But a LDR's has a internal built in slew rate called sag time so in DSP u have to program the LFO to be faster than the LDR resistance changing the IIR or FIR filters coefficient values so there is a lead and lag timing

How can a IIR or FIR function like a phase spiltter filter to have a inphase output and a out of phase output?

DSP Phaser "MXR phase90"
   1.)   notches that are non periodical
   2.)  IIR comb filters only 1 output in phase mostly
   3.) regular sweeping oscillator triangle waveform output
   4.) LFO interfaces with FETs get harmonic distortion

DSP univibe phase shifter is different
   1.) notches are non-periodical depending on the Phaseshift LFO oscillator wa
   2.) IIR comb filter is set to phase splitter mode having a inphase and a out of phase , 2 outputs
   3.) LFO is a phase shifter oscillator 360 degrees hyperbolic waveform
   4.) LDR/lamps sag time


phaser:notches that are non periodical:
    1.) When a MXR phase 90's LFO sweeps the notches they are moving "One set" of non-periodical
         each stage notches out the "same" non periodical frequencys in the spectrum so u get deeper notches but
          only at the fixed non-periodical frequencys set fixed by the phase filters time constances R/C networks 
    2.) A univibe has "4 different sets" of non-periodical notches up and down
         each stage in the univibe is notching "different" non periodical frequencys in the spectrum
         having 4 different time constants R/C networks

Differential op-amp phasers VS transitor univibe phase spiltter 2 output
     1.) If u look at a schematic at most phaser pedals than use op-amps for the phase filters. They mostly use 2 inputs which is
          using the inverting and non-inverting pins which is a differential function. Their is only ONE output which the op-amp internally
          combines the frequency non-periodical notches,frequencys,suming,reinforcing in a differential inverting , non inverting INPUTs
          not outputs

     2.) Each stage in the univibe is a phase spiltter which is different than a differential operation. A phase spiltter has one input
         and 2 outputs which is inphase and a out of phase output so u get 2 different outputs.

     3.) The way the LFO sweeps/modulates the non-periodical notches in a differential filter operations having 2 inputs
           is different VS how the LFO sweeps/modulates the non-periodical notches in a phase spiltter filter because it has
           2 lead/lad outputs u get more swooshing slushy with the phase spiltter.

     4.) The way to think about differential filters Vs Phase spiltter filters is they are like frequency dependant summing mixers
          and amplitude dependant also.

     5.) Differential filter LFO sweep/modulation VS phase spiltter filter LFO sweep/modulation

     6.) Differential filters sums two different inputs inphase and out of phase signal degrees into a summed MONO signal
     7.) Phase spiltter filters takes one input and mirrors two different phase angle/degrees,lead,lag timing so its more like
          a stereo output than a summed mono output

Differentation- the rate of change of variable quantities
                     measured differences between successive values
Integal- inverse of differenations, rate of change of instantaneous quantities
            Integal is the sum or added sucessive values

DSP programming
1.) Waveform symmetry
2.) Time Constants: intergation time constants or differentation time constants
3.) rounded Top and Bottom "excursions"
4.) Tangential slope
5.) waveform Tilt: positive squarewave top tilted/slanted, or negative squarewave bottom tilted/slanted
6.) Linearity
7.) Duty cycle time durations ratios and percentages
8.) rise time and fall time, leading or falling edges
9.) crossover distortion points can be symmetrical or asymmetrical or offsets at different amplitude instantaneous values
     What i mean is that the crossover distortion points for the rise cycle is at a different amplitude instantaneous value than
     the fall cycle of a waveform
     Aymmetrical waveforms is when the positive cycle has a waveform shape different than the negative cycles waveshape
     Symmetrical waveforms is when both positive cycle and negative cycles have the same waveform shapes

DSP LFO waveform trigonometrys
1.) Sine value
2.) Cosine value
3.) Tangent value
4.) Contangent value
5.) Secant value
6.) Cosecant value



markphaser

A LFO is not a oscillator its a sweeping oscillator in my electronics books all they talk about is just fixed oscillators at one frequency. A LFO modulates the frequency up and down, in a analog LFO circuit what component or network makes the oscillator SWEEP up and down?

YOu have to have a oscillator and a intergator circuit/network after the oscillator or in the feedback loop. The intergator is what sweeps up and down the oscillators frequency. The Answer is a intergator circuit

The univibes LFO has a hyperbolic sinewave output so its a oscillator with not a intergator circuit because when a intergator network u will get a triangle waveform output i think even if u put in a hyperbolic or sinewaveform into a intergator network/circuit the output is not going to change the waveshape but it does ""intergate"" the output sweeping it


Transmogrifox

QuoteA LFO is not a oscillator its a sweeping oscillator in my electronics books all they talk about is just fixed oscillators at one frequency. A LFO modulates the frequency up and down, in a analog LFO circuit what component or network makes the oscillator SWEEP up and down?

Ummm...You really really badly misunderstand the LFO's function in a guitar FX circuit.  It's that knob on the function generator that allows you to change the rate on the LFO, just like the rate knob on your phaser.  Exactly the same thing.  The wave shape is irrelevant in understanding a voltage that varies periodically with time.   That's ALL an LFO is.

How it relates to Tremolo:
The LFO voltage modulates an LED/LDR set-up configured like a volume knob.  It's like turning the volume up and down at a periodic interval.  We make mechanical pots to modulate it manually with our hands.  We make voltage dependent resistors or voltage controlled variable gain amplifiers to modulate the volume automatically with a voltage level.  The LFO is an electrical analogy to the motion of twisting your hand left and right.  Your hand does not effect the signal in any way.  The resistor divider created by the pot changes the amplitude.  Your hand just modifies the properties of the resistor divider.

How it relates to a phaser:
A phaser is just a comb filter that can be tuned to a certain center frequency.  You could put pots in it and control it with a knob, or VCA's to control it with a voltage.  All the LFO does is provide this control voltage in the pattern you want to hear the filter sweep. 
!

QuoteDo i just put in instantaneous values inside a loop? but in my C++ book i can't find where u can set a voltage instantaneous value and then sets its phase degree,time duration there must be a instrunction code i just don't know the names to sets these C++

You need to be smarter than a C++ book to program DSP.  C++ is not a programming language that holds your hand.  It offers you the ability to tell the hardware in the computer to do whatever you want.  Only libraries that other people have written in C++ can give you a sine function where you can pass frequency, phase, blah blah blah parameters...or you can write your own.


There is no C++ command called "Tremolo LFO", or "Phaser LFO".  or "Flanger LFO".  An LFO is an LFO is an LFO and the computer doesn't give a damn what you use it for.   You can use it to modulate a phaser, or you could write it directly to the DAC and use it as a function generator.  You have to understand simple signal processing theory better before you can program DSP.  C++ has nothing to do with DSP.  It's just one language that you can use to program a computer to do DSP.  DSP from a computer's point of view is just addition, subtraction, multiplication and sometimes division....millions of times a second.  Can you write C++ code to add, subtract, multiply and divide?  You can do DSP as long as you know what it is that you want to add, subtract, multiply and divide.  The compiler won't think for you, you have to know what you want the computer to do before you can tell it to do it.

Can you write C++ code that will add 1 to a register (memory location) every time through a loop?  Can you make it exit the loop when the register equals a certain number, then enter another loop that subtracts 1 from the register?  When it goes back to 0 can you make it go to the first loop?

If you can do that, then congratulations! You have written your first triangle wave oscillator.  Now, can you write your code to set the time in between adding 1 (or subtracting 1)?  Make it long enough and you have made your first triangle LFO.

C++ is not Wal-Mart.  You don't just go down to the C++ store and find your handy "Tremolo in a box" kit.  C++ is more like a hardware store selling lumber, nails, hammer, saws, etc.  The hardware store owners don't know or care what their customers are making with the stuff they sell.  You come up with a plan of first what you want to make, then what you need to use to make it, and how it needs to go together to make it work.  You are in control of the outcome.  If you want to make a sine wave generator, you don't just go "y=sin(x)" like you do in MATLAB.  You have to either write the sine function yourself, or find a library that contains a sine function that somebody else has written, but C++ doesn't do it on it's own.   Forget about trying to find a chapter in a C++ book about making an LFO for a phaser.    If you want to model a Phase 90's LFO waveform, then you need to figure out the mathematical function that describes that waveform, then define the sequence of addition, subtraction, multiplication and division for the DSP to do in order to generate that outcome.  You can't just look in your C++ book for a "model phase 90" command.

So...You can probably find in a book somewhere about a C++ library that contains the sine/cosine function, and find info about how to include the file, and how to use it (such as what variables are passed to it and how).

You can go to a DSP theory book and find out how to make an FIR or IIR all-pass filter.

You can probably go to a National Semi or Analog Devices tech resource site and even find source code for such a filter.  You may also find info about how to get samples from the ADC, and also how to write them to the DAC.

You call the sine function, generating a sine at a low frequency.  You take the most recent value in its output buffer and calculate filter coefficients with it.

Then you pass the coefficients to your filter and direct it to the signal to be processed.

Store the signal current sample in a filter output buffer.

Add input to output.

Move number to DAC Tx buffer.

Digital phaser.
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.

David

Quote from: R.G. on October 18, 2006, 11:54:18 PM
Gentlemen - you are trying to shovel sand against the tide.

...with a sugar spoon.

Transmogrifox

#28
Quote from: David on October 24, 2006, 10:31:16 AM
Quote from: R.G. on October 18, 2006, 11:54:18 PM
Gentlemen - you are trying to shovel sand against the tide.

...with a sugar spoon.

I'm more in agreement with Arno van der Heijden on this.  I'm personally pretty well convinced markphaser is not going to understand until he takes the time to read and study on his own.  However, others who read through the replies can learn a few things.  I am personally learning just from having to break it down to present it.  I think we're digging up treasures in the process of shoveling sand into the tide, making it well worth the trouble.
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.

Peter Snowberg

Thank you Transmogrifox.

I concur.
Eschew paradigm obfuscation

bwanasonic

Quote from: Transmogrifox on October 24, 2006, 03:01:24 PM
I think we're digging up treasures in the process of shoveling sand into the tide, making it well worth the trouble.

Next to "F*ck 'em if they can't take a joke", this may become my favorite saying! Sure beats "Same shit, different day".

Kerry M

markphaser

Thanks alot Transmogrifox for your information and time on DSP

LFO is a voltage that varies periodically with time
LFO is a oscillator network + intergator network which varys up and down the voltage periodically
in time without the intergator circuit op-amp the oscillator will not vary/sweep up and down
the voltage periodically it would be a "steady voltage" like a battery with a frequency
from the oscillator oscillation freq.

A manual switch LFO shuts off the intergator which sweeps the oscillation frequency
so it just puts a "steady voltage" like a battery not varying or sweeping the filter

LFO voltage modulates an LED/LDR

Rotation turns VS voltage or resistance values

When the LED/lamp blinks/flashes , the LED is On/off a Lamp is more variable inbetween
the "dimming values" of the lamp light is a factor. The LDR sweep resistance curve characterists( linear or log,exponental, how fast does it change resistance characterists slew rate/sag time of the LDR

In DSP code what is the Lamp or LED?
(because i would like to enter in the "dimming values" or light values)

In DSP code what is the LDR?
(because i would like to enter in the resistance curve of the LDR)

The LDR has a lagging time because the Lamp is flashing light faster than the LDR can change so im trying to
also enter in the "Lag time of the LDR"
What would this Lag time of the LDR be in DSP please?

The LFO sweeps/modulates the filter coefficients in DSP
But where is the Lamp/LDR how do i enter in this in DSP so i can sweep/modulate the filters coefficient values
with the Lamp dimming values,LDR lag time,LDR resistance curve in DSP

DSP LFO is from a sine/cosine function

The Sine/cosine function needs to be linked to a DSP phaser lamp dimming values,LDR lag time,LDR resistance curve
in a subrountine in DSP code before it links to the filters coefficient value

Transmogrifox

QuoteThe LFO sweeps/modulates the filter coefficients in DSP
But where is the Lamp/LDR how do i enter in this in DSP so i can sweep/modulate the filters coefficient values
with the Lamp dimming values,LDR lag time,LDR resistance curve in DSP

You make a hard case, markphaser. 

In analog land, the LDR is a resistor that changes the filter coefficients in the equation that describes the analog filter.  Since we can't just type keys on a keyboard and say, "Analog filter, have these coefficients", we have to physically change the value of a resistor (or multiple) that are found in the characteristic equation for the filter.  Thus, we use an LDR, because its resistance varies with respect to light.  We are able to change the amount of light incident to the LDR by the magnitude of current through a lamp or LED.  If you apply a voltage to a lamp or LED, current will flow, light will be emitted, and the resistance of the LDR will change.  That's how we can change filter's coefficients with analog circuits.

The beauty of the DSP is we don't have to play "conversion tricks" to modify a filter's behavior.  We can directly define the filter's characteristics simply by changing numbers in the characteristic equation and then re-running the calculation.  A DSP can do millions of arithmetic operations in a second, so we can re-calculate the filter every sample period if we want.

I side-stepped you question about "what is the LED/LDR in DSP code" because it's not necessary to digitally model this to make a DSP phaser.  If you want to do analog modeling, where you digitally model an analog filter and every parameter in the physical circuit, then you're reaching far beyond the scope of simply getting started with DSP. 

Please try to understand the basic principles of what a signal is and what a signal processor can do before you try to do signal processing.  The nature of questions makes it look like you're trying to eat an entire pumpkin with one bite. 

Frequency is not a mystical word.  It's simply a unit of measurement.  If there's a pattern that repeats itself over and over, then frequency is a measurment of how often the patern repeats.  The frequency that I down a cup of coffee, begin to feel an urge, go to the bathroom and refill my coffee mug is about once an hour.  This pattern repeats itself all morning long.  This is 1 cycle per hour.  It is (1/60) cycles per second.  Thus my coffee-bathroom pattern can be said to repeat at a frequency of (1/60) Hertz (Hz). 

Another example of frequency:  Sampling.  You can sample a lower frequency pattern at a much much higher frequency.  For audio, a popular DSP sampling frequency is 48 kHz.  That means that the A/D converter takes a snapshot of the voltage on its input every (1/48,000) second interval, thus it collects 48 thousand samples per second.  Each of these samples is now a binary number and can be stored in a memory location.  It is no longer thought of as a literal voltage, but just as a number, typically normalized to between 0 and 1.

The signal it is sampling is just a voltage that varies with time at a much slower rate that you sample.  During a sampling interval, it more or less looks like a DC level to the ADC, since it samples it for a duration of a few nanoseconds.  An audio signal voltage will not change appreciably during the duration of 10 nanoseconds.  It WILL change appreciably over the duration of 100 microseconds.  It may repeat the same pattern multiple times (or approximately same pattern) over a duration of 10 milliseconds....

chew on that for a while.

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.

amz-fx

Quote from: Transmogrifox on October 24, 2006, 03:01:24 PM
I'm personally pretty well convinced markphaser is not going to understand until he takes the time to read and study on his own. 

What they are hinting at without saying is that markphaser is Walters, who some believe to be a bot program, but many others believe to be just a misguided person likes to gum up message boards with nonsense posts.  He has been banned from countless electronic forums for this type of intentional mumbo-jumbo bandwidth-stealing rubbish.

http://www.gearslutz.com/board/showthread.php3?t=33605&pp=20

http://www.firebottle.com/fireforum/ff.cgi?cmd=vt&fid=gt&tid=1136965521yhrGomF

http://www.electro-tech-online.com/general-electronics-chat/17094-analog-frequency-dividers.html

Carry on...


Sir H C

Quote from: amz-fx on October 31, 2006, 08:33:13 AM
Quote from: Transmogrifox on October 24, 2006, 03:01:24 PM
I'm personally pretty well convinced markphaser is not going to understand until he takes the time to read and study on his own. 

What they are hinting at without saying is that markphaser is Walters, who some believe to be a bot program, but many others believe to be just a misguided person likes to gum up message boards with nonsense posts.  He has been banned from countless electronic forums for this type of intentional mumbo-jumbo bandwidth-stealing rubbish.

http://www.gearslutz.com/board/showthread.php3?t=33605&pp=20

http://www.firebottle.com/fireforum/ff.cgi?cmd=vt&fid=gt&tid=1136965521yhrGomF

http://www.electro-tech-online.com/general-electronics-chat/17094-analog-frequency-dividers.html

Carry on...



He also goes by brent and brentwalters too.

R.G.

Real person or bot, there is no amount of explaining that will ever get any concept across to walters/brent/markphaser. There seems to be no reception of the information behind the words.

It's like shoveling sand against the tide. If you want to, do it - but do it because you enjoy it, not because you expect to make a difference in the distribution of sand.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Gabriel Simoes

Well, if the intentions are really good, here my thoughts go ...

What most people doesn't understand is that the MAJORITY of the DSP concepts are not direct related to Audio processing, computer music or anything else straight related to sound. They are applied to signals! (dahhhh obvious but somepeople's vision get's blurred sometimes).
If you really want to learn about dsp, start by reading some theorical concepts, and I can tell you to read Simon Haykin signals and sistems book, and efechor's digital signal processing a pratical approach as you get some of the theory behind continue and discret systems and signals.

After that, you may try to start relating the topics like periodic functions to generate oscilators, filters to generate eqs and effects, lms and rls to start trying to simulate/modelate equipment, etc.

And about equipment, since this is a damn hard to stay market and hobby, I think it's best to start developing plug-ins using vst or directx before spending cash on dsp kits .... it's easier, cleaner, cheaper and more clarifying.

I have already worked on automatic transcription of audio signals, some effects and I'm right now doing my mastery in digital signal processing focusing on audio processing, and damn ... it's just the beggining of the beginning ... dsp is such a wide area that you can study your whole life and still there will be some gaps ...

markphaser

periodic functions to generate oscilators, filters to generate eqs and effects, lms and rls to start trying to simulate/modelate equipment

Can u please give me some examples of periodic functions using DSP ?

Sir H C

sine wave -> table 0, .717, 1, .717, 0, -.717, -1, -.717

square wave -> table 1, -1, 1, -1

triangle wave -> table -1, -.5, 0, .5, 1, .5, 0, -.5