Author 
Message 
Kenneth
Joined: Apr 16, 2009 Posts: 43 Location: Stockholm, Sweden

Posted: Thu Apr 16, 2009 6:40 am Post subject:
Easy filter (software) 


I have used computers to create "samples" for like 20 years. ATARI ST and ST Replay (8 bit mono sampler/player) was the first hardware I used, later Amiga and then PC's.
I don't have a clue what others use but I got a number of nice things I can share, first it will be my filter.
sample = Function_sinus(phase) .... returns the phase of a sinus, a float in the range 1 to 1, the ocillator I use in this example.
Then do this to the sample:
x = sample ... the absolute value (01)
s = SGN(sample) ... returns the sign of the sample (1 or 1)
x = x^Q ... the actual filter where Q is the setting of the filter, 01 lowpass, 1whatever higpass (values between 0.25 and 100 are useful, 1 is = no filter effect)
Then last
sample = x*s ... restores the sign of the sample.
Is that useful for anyone? 

Back to top



DrJustice
Joined: Sep 13, 2004 Posts: 2110 Location: Morokulien
Audio files: 4

Posted: Thu Apr 16, 2009 8:36 am Post subject:
Re: Easy filter (software) 


Kenneth wrote:  Is that useful for anyone? 
Yes, this is a very useful technique
It isn't a filter tough, but rather a transfer function, or as we say in synth speak a 'waveshaper'.
This particular function, y = x^c, is often used as a soft clipper. When c = 1, the signal passes unaltered as you have observed, and as c approaches zero we get more (harder) clipping and the signal becomes more and more like a square wave. (I changed the Q to a c, so as not to confuse it with a filters Q factor, and instead c is our waveshaper 'coefficient' in the range 01).
In an actual filter, the output value depends on previous input values. A very simple first order lowpass filter looks like:
y(n) = x(n) + c * (y(n1)x(n))
where n is the sample number and c is the filter coefficient which determines the cutoff frequency. For each sample you calculate this filter and save y, then use y again it for the next sample. To find c use:
exp(2.0*PI*(fc/fs))
where fc is the desired cutoff frequency and fs is the samplerate.
DJ
 

Back to top



Kenneth
Joined: Apr 16, 2009 Posts: 43 Location: Stockholm, Sweden

Posted: Thu Apr 16, 2009 9:11 am Post subject:



Thanks for the reply.
Waveshaper, yes, that makes sence. But if you use it like I do, directly after the ocillator and after that you do envelop, then it sounds wery much like a filter, that's why I always thought of it as a filter
As I said, I always used my own stuff and have no clue of how to do it the "proper" way, but of course, I can learn if I need to. If I understood what you wrote a real filter is iterative. I have worked a lot with fractals so I understand iteriation well. Your filter function looks a lot like a fractal function... Hmm, maybe it is possible to create a fractal from it? 

Back to top



DrJustice
Joined: Sep 13, 2004 Posts: 2110 Location: Morokulien
Audio files: 4

Posted: Thu Apr 16, 2009 10:41 am Post subject:



Kenneth wrote:  Waveshaper, yes, that makes sence. But if you use it like I do, directly after the ocillator and after that you do envelop, then it sounds wery much like a filter, that's why I always thought of it as a filter 
The sound can sometimes remind of filtering, but the major difference is that a transfer function will introduce different harmonics in the signal, whereas a filter can only amplify or attenuate the harmonics that are already in the signal. This distinction is very important. E.g. in practise a filter can not introduce aliasing, but (non bandwidth limited) waveshaping will do so.
Quote:  As I said, I always used my own stuff and have no clue of how to do it the "proper" way, but of course, I can learn if I need to. If I understood what you wrote a real filter is iterative. I have worked a lot with fractals so I understand iteriation well.

You've got that right!
Quote:  Your filter function looks a lot like a fractal function... Hmm, maybe it is possible to create a fractal from it? 
Not quite, but fractals are very useful in musical applications, both for waveform generation and composition. Armed with the stuff you now know, waveshaping, fractals and filtering, you can do a lot of interesting synthesis and processing.
DJ
 

Back to top



Kenneth
Joined: Apr 16, 2009 Posts: 43 Location: Stockholm, Sweden

Posted: Thu Apr 16, 2009 12:34 pm Post subject:



DrJustice wrote:  Quote:  Your filter function looks a lot like a fractal function... Hmm, maybe it is possible to create a fractal from it? 
Not quite, but.. 
lol
Change it to this:
Iteriation loop
{
x(n) = 2 * y(n1) * x(n1) + a
y(n) = x(n1) + b * (y(n1)x(n1))
}
Now I'm sure it will make a fractal, maybe not any good stuff but fractal
If my HD's did not break one after the other I would have got a number of tools for creating sounds... but they are all lost by now I think (and I do not know where to look if there are any still alive, it was some years ago now).
Here I got some of my fractal works:
http://commons.wikimedia.org/wiki/User:Solkoll
http://commons.wikimedia.org/wiki/Template:Solkoll_2D
http://commons.wikimedia.org/wiki/Template:Solkoll_3D 

Back to top



