Close

Restructuring the project

A project log for SonoMKR Noise Monitoring

An Open Source / Open Hardware Sound Level Monitoring Device

valentinValentin 01/02/2018 at 10:120 Comments

Sometimes it is good to take a few steps back in order to move forward !

I started this project a long time ago (a few years) and at the time I had no real vision about how the project should be structured.

I just started coding … and features stacked on top of each other, and most of the time, if not always, I was learning how to do it while coding it.

I ended up with a monolithic program, written entirely with Qt that was responsible of :

capturing the audio, filtering the audio in third octave bands, writing spectrum data to files, sending data over the network, displaying the data, etc…

Then I started playing with the notion of IPC with DBus. Data can be sent in “almost” real-time between programs !! Did you know ? Well I didn’t.

I realized that instead of a big program that did everything I could make several programs that did their own thing independently. That would also bring us closer to the Unix philosophy (programs that do one thing and do it well, or something like that).

After playing a bit with DBus interfaces, I thought I’d rearrange the project structure like so :

That “distributed” structure would let any “block” subscribe to the flow of generated spectrums and do whatever they need to without interfering with the publisher or any of the other subscribers.

I also decided to get rid of Qt and to write everything with the C++ STL only. Qt was here for historical reasons and ease of coding. But I feel comfortable enough with plain C++ now, and Qt is a BIG dependency for a console daemon application. I first thought I would keep it around in case I wanted to add a touch screen and a neat UI at some point. But the new “distributed” structure would allow for such thing easily without Qt in the “core” block.

Here we are. I started coding the thing and *almost* everything went well so far.

I will write another log on a few issues I ran into with dbus (spoiler: I am now using zeromq instead of dbus) and maybe another about designing the IIR filters and the difference between base 10 and base 2 ⅓ octave bands...

Cheers !

Discussions