up next…

13/12/2012 § Leave a comment

Hit list for next update.

Mixxx:

  • Add/remove Effect Chains
  • Save/Load presets

realliZation:

  • Scale the freq domain analysis to proper units ūüėõ
  • Use keyboard arrow keys to change pos of (conjugate) poles/zeros
  • The amount by which location shifts must be customizable
  • There must be a way to enter a locus (equation) on which (conjugate) poles/zeros
  • Will move by (customizable) distance on keyboard key press

All this by the eve of 25th Dec.

And if I could spare some more time maybe I’ll play with realliZation and have a sneak peek into¬†world of DSP.

Till then, keep converting coffee into code. ūüėõ

“Programmers are machines that convert coffee into code”

update: Mixxx and realliZation

13/12/2012 § Leave a comment

Its been long since my last post. I have been busy with trying to bring up a GUI for Effects Framework for Mixxx.

This is how GUI looks like this with effects editor open:

Effects editor open.

Effects editor open.

This when editor closed:

Effects editor close

Effects editor close

And realliZation can now show magnitude and phase response of interactively as user adds/edits location of¬†(conjugate) poles/zeros. Take a look. In this image I have placed pole/zero according to Mitra and Regalia’s ¬†research paper. They have also explored ways to design a 2nd order IIR filter without using analog prototypes.

realliZation displaying magnitude and phase response

realliZation displaying magnitude and phase response

Here are the updates.

Mixxx updates:

  • DSP related – added parametric eq. and a BPF which doesn’t reduce volume no matter which part of spectrum you are filtering.¬†I’ll write more about it in coming posts. This feature was demanded by Andrey (one of the Mixxx users and developers)
  • ¬†This is what enables you to do:
    • ¬†Add new effects (any number) to chain
    • Show/hide effects editor
    • Apply effects chain to channel 1, 2, Master or Headphone.

 

realliZation updates:

  • See magnitude and freq response while:
    • ¬†add/edit a pair of comlex conjugate (poles/zeros)
    • ¬†add any number of real poles/zeros
  • See transfer function for any config.

Hang on! More coming up!!

1558 karma on Launchpad !!

13/12/2012 § Leave a comment

Launchpad is online repository, using Bazaar distributed revision control system, on which Mixxx is hosted.

Launchpad has concept of Karma which is kind of activity measure of its users.

Due to my activity on Mixxx and realliZation my karma on Launchpad has hit its all time high of 1558.

Stats:
My last highest: 500
RJ’s (lead developer of Mixxx) current (as of posting this post): 2417

Link to my Launchpad profile.

basic LPF – part 2 of 2

19/11/2012 § Leave a comment

In part 1¬†¬†something was going wrong so I decided to shout for help. And it came ūüôā

Bjorn told that what I am thinking is ‘scaling’ is actually clipping. And he was correct.. I decide to remove from my testbed:

  // scaling the output
     if (out > 17000)
         out = 17000;
     if (out < -15000)
         out = -15000;

And it worked like a charm !!

here is the o/p:

The i/p was:

And the spectrum after (several) run of my filter is:

Thanks¬†Bjorn¬†ūüôā

Moreover Ross Bencina¬†(in same post) pointed me to some links for filter design. I went through the paper of RBJ. Then I realized that my definition of bandwidth (3dB BW) is not suitable for studio (as opposed to lab). And he also pointed me to RBJ’s cookbook… I implemented a basic static notch filter from there and¬†implemented¬†it on Mixxx, here is the source code.

Btw, again thanks to all you amazing people out there. ūüôā

basic LPF – part 1 of 2

07/11/2012 § 1 Comment

LPF, as you may know, stands for Low Pass Filter, i.e., attenuating higher frequencies
and letting lower frequencies pass. Boosting Bass is an example of applying LPF

Lets design LPF by intuition. This is something very basic and easy to visualise

  • In z plane we know that freq 0 to fs/2 are mapped from 0 to pi
  • We also know that poles boost frequencies and zeros¬†attenuate them
  • Lower freq are near (1,0) on z plane.
  • So lets attenuate higher freq. and place a zero on z =-1. Our channel response comes out to:
H(z) = 1 + z^-1
  • Generally sampling freq is 44100 Hz, so z = -1 corresponds to fs/2 i.e., highest present frequency.
  • Lets quickly test it on fiview. Fire up a terminal,¬†navigate to fiview folder and type ./fiview -i x 1 1 ¬†we get this:
fiview analysis of lpf

basic lpf

  • Hmm.. that looks like a low pass filter.
  • Before we proceed scholastic matlab/octave¬†test. Following are the commands to see how well-behaved is your (my?) filter (refer to docs if you are not sure how they work).
octave:1> [h,w]=freqz([1 1], [1], 512, 44100); 
octave:2> frwqz_plot(w,h)
  • As you may see it boosts lower freq by 6 dB. For now lets bring magnitude down to 0 dB. To do that, our filter will look like:
H(z) = .5 + (.5)*z^-1
  • You may perform test with fiview again, output will be the same.
  • There’s a point to note here: fiview might give you ‘quick peek’ into filter’s freq response, but it’s not detailed enough to see everything.

Lets do an audio test as well:

  • With reference to Z plane and testbed, edit your FIL¬†ladspa plugin’s filters.h so that:
a0 = .5; a1 = .5; a2 = 0; b1 = 0; b2 = 0;
  • load the plugin (step 4 to 6 in testbed)
  • Fire up audacity, load a track, and apply your modified¬†plugin (refer to testbed)

I am uploading my samples on sound cloud:
original: 
edited:

Not quite worth listening to, right ?

Lets analyze what screwed up.

  • Scholastic tests are not that bad… then what happened to my audio ? Lets¬†analyze¬†with Audacity’s spectrum viewer
        • Original spectrum:

        • And the spectrum of edited track:

  • So, LPF is working but looks like we have ‘aliasing’ issues.

Action plan:

  • Mixxx uses SoundTouch and SoundTouch has implemented Anti aliasing filter in an independent class.
  • Audacity has many effects built in… I’ll just hack the code and see how these ‘Masters of DSP’ manipulate maths.. till then hang on!

Meanwhile if you can’t find anything worth doing, try making a simple HPF, it’s just opposite of LPF.¬†Never mind¬†if it works only in theory not in audio… it’s just a matter of time before we master this. ūüôā

the Tools

06/11/2012 § Leave a comment

Apart from ‘the Testbed‘ setup, folowing might¬†prove useful for basic filter designing:

  1. Basic knowledge of Linux based dev envoirnment, because, all my hacks will be on a linux.
  2. Octave Рopen source Matlab substitute. Will help in visualing/designing effects
  3. Fiview Рopen source, simple straight forward tool to test your filters in single line command

the Testbed

06/11/2012 § 3 Comments

Before I move on to show some real filters and their theory, lets prepare our¬†testbed. My initial plan was to hack Mixxx’s sound¬†engine and patch it¬†with my audio filters. I defered due to following reasons:

  • Mixxx lacks ‘analysis’ tools. Not lack actually, Mixxx is not supposed to do track analysis, that’s by design.
  • Every time I want to see effect of changes I do, I have to re compile¬†complete project which is a time taking procedure
  • The visual of waveform displayed is not designed to see small¬†changes in audio when¬†effects¬†are applied
  • Saving the¬†changes¬†a part of audio/editing only a part of audio is¬†still on wishlist

So, I decided to use a LADSPA host (Audacity) and a LADSPA plugin (FIL-4pand parametic eq). Here are steps to see your effects in action (for a Linux box)

    • Install Audacity (that’s quite obvious, isn’t it ?)
    • Download FILs plugin from here.
    • For FILs plugin your effects will be in ParamSect::proc(…) inside file ‘filters.h’ file, like so,
void proc (int k, float *sig, float f, float b, float g)
{
 int i, count = 10;
 float out=0.0f;

 // filter coeff. (refer to Z domain)
 float a0=.55, a1=-1.055, a2=.55, b1=-1.055, b2=.1;
 for (i=0; i<k; i++)
 {
     // convolution
     out = a0*sig[i] + a1*hz1 + a2*hz2 - b1*hp1 - b2*hp2;

     // store the current state of filter
     hz2 = hz1;
     hz1 = sig[i];
     hp2 = hp1;
     hp1 = out;

     // scaling the output
     if (out > 17000)
         out = 17000;
     if (out < -15000)
         out = -15000;

    // storing the output
    sig[i] = out;
 }

 }


Steps 1 to 3, below, will be followd recursively to see the changes in audio done by your filter.

  1. Compile plugin and get LADSPA library. (use simple Ladspa loader to poke around this library)
  2. Copy LADSPA library into /usr/share/audacity/plug-ins folder (you may need root’s passwd)
  3. Restart Audacity, load your Guinea pig (audio sample; no offence to animals intended), apply you filter, which will be listed in effects -> effects 1 to 15 This will apply your effects onto the loaded track.

Saving/clipping an audio file in Audacity is pretty straight forward, so I won’t describe that. For pointers see, documentation. For loading LADSPA plugin in Audacity, see plugin installation.

Filter design is independent of host and plugin, so you may choose some other LADSPA host and any plugin. The point is to use a platform which you can hack and can understand.