Real life
August 28th, 2008I graduated with score 110/110 (now you can call me doctor) and got some job offers.
2008’s summer was the worst ever.
The GSoC thing went good.
I’m waiting for my new PC and notebook to be delivered.
I graduated with score 110/110 (now you can call me doctor) and got some job offers.
2008’s summer was the worst ever.
The GSoC thing went good.
I’m waiting for my new PC and notebook to be delivered.
My laptop seems to be about to die!
Current status: broken whitespace, return and backspace keys, dead LCD monitor (took it away last year), zombie CD/DVD drive, IR port never really worked, too much heat produced (you know that “keyboard burns” feeling) and sometimes it does even refuse to power on.
I’m the kind of person who doesn’t easily get pissed off. I might seem harsh or offensive some (many) times, but it’s very rare for me to take offense.
This time, instead, I really got pissed off!
The 20th of May, after more than a year of part part time work, I released NASPRO 0.1.0 with support for LADSPA and the EffectPlugin API of Audacious.
The second one is quite crappy in many places (private API, GTK+ 2-only for GUIs, informal definition, etc.), but still has some advantages over most “serious” DSP APIs out there (yes nenolod, ccr and you all Audacious devs, there are some), like for example native time stretching and support for many kinds of encodings.
I noticed that most media player authors out there just do as the Audacious devs did: they prefer to write their own effect API instead of using one of the “serious” ones. Overall result? Community fragmentation to the nth power and crappy and useless effects. Amen.
Since the guys behind Audacious have fully realized how much their API is broken and are or will be going to break binary compatibility and possibly write a new API, I thought it could be a good opportunity to both give them a hand with the new API and try to set out an open standardized API for media player effects.
In doing so I outlined some problems the current DSP APIs have if a media player author has to implement support for them (high amount of unneded complexity - don’t say it’s not true, because it is -, many silly limitations, etc.).
When I was done the result was a preview version of EPAMP, a little API whose features were modelled after the common needs of media players and actually was not that bad (more on this later).
I took the hassle of subscribing to ~30 mailing lists regarding development of open source media players and invited everyone to comment on EPAMP. Almost noone answered, except…
… except on the LAD mailing list, where people started crying and whining and denigrating me without any founded reason (enjoy, read the threads here and here).
Some people were concerned about me trying to push a new API, thus doing harm to the adoption of LV2. Who, me??? The author of NASPRO???
I tried to explain them peacefully (even when I should have just ignored them) that there would have been no real competition beetween the two APIs, since no media player author was using LV2 or was going to use it. And the reason was quite clear: too complex to do in programs where DSP stuff is a marginal thing.
Others tried to put discredit on me saying that the (conscious and well-thought IMO) limitations I put on the API (effects to have equal number of input and output channels) did make my API unuseful (read this - I honestly had no idea of how spatialization worked but now at least I know, these people instead are still happy of their own mistakes), but later someone came to my same conclusion and noone let him notice.
Others yet said that host development would have been too difficult with that many PCM sample formats and support for interleaved channels around. How could I take them seriously when, to load an LV2 plugin, you have to parse at least one RDF file? Is that any easier? (Not to mention that the same problem exists also with APIs accepting data in only one format - you always have to convert when needed.)
The best ones, however, were those confusing NASPRO with EPAMP just because the EPAMP preview spec was on the NASPRO webiste; here we come one of my favourite ones: this and the following answer.
The best one ever, the one who really did piss me off, however, is a puppet who didn’t even step in on the LAD ml, but who tries to ridicule me on some forum: read this and enjoy.
Dear Alex Stone, please, fuck off!
Uh? You didn’t expect that, eh?
Well, they were not all morons, and some of them were actually right on some points; LV2 is actually a very nice API, its only limit is its complexity IMO, but that can be hidden to those not willing to deal with it.
Furthermore its extendability makes it perfect for NASPRO’s core wrapper and future higher level libraries making part of NASPRO will just work on LV2, and thus will probably have a much wider audience.
I’m already writing some extensions for LV2 to support wrappers (the first one will be out in days) and I do seriously hope that the SLV2 author, Dave Robillard, will add support for it inside its library, otherwise I will be pissed off even more.
Now… I’ve got an hard assault of real life lately, but I’ll be back working on NASPRO ASAP.
When a programmer has some problem with hardware, he calls an electronic engineer.
When an electronic engineer doesn’t remember how a device works, he calls a physicist.
When a physicist can’t solve a complex differential equation, he calls a mathematician.
When a mathematician doesn’t understand a problem, he calls a linguist.
When a linguist encounters an old text he can’t read, he calls an historian.
When an historian can’t get the reasons behind an event, he calls a philosopher.
When a philosopher is uncertain about the meaning of life he can get high (alcohol or drugs), suicide himself or abandon to spiritualism (possibly exotic and/or esoteric).
Moral lesson: if you have a bug, jump the intermediaries: get high, suicide yourself or abandon yourself to exotic esoteric spiritualism!
Saccio nu niro re terra terrosa,
mammata ‘a tene tutta pelosa,
soreta ‘a tene fatta a cangedda
e indo ‘nge canda na mala aucedda.
cchiù cchiù, cchiù cchiù, cchiù cchiù…
“Tengo a forza re te vatte,
ma nu re te cumbatte.”
E mò ca ve siti fenùti re fà ienghe a panza e a capo re strunzate,
e cercati re capisce pecché ccà se sta accussì buono…
V’ù fazzo veré io!
Venìti, venitì… e stateme a sente:
fino a mò ng’è bastato stà luntano ra vui!
Professore: Lo sperma contiene glucosio e…
Studentessa: Scusi professore, ma se contiene glucosio perché non è dolce?
Imbarazzo generale…
Professore: Vede, il sapore dolce si percepisce sulla punta della lingua, non all’inizio della gola.
Here’s the test code and the results:
#include <stdio.h>
#include <time.h>
#include <string.h>
int
shift_getbitpos(int val)
{
int i;
for (i = 0; val; i++)
val >>= 1;
return i - 1;
}
int
ccr_getbitpos(int val)
{
static const int bitpostab[17] =
{
-1,
0,
1,
-1, 2,
-1, -1, -1, 3,
-1, -1, -1, -1, -1, -1, -1, -1
};
int n, i = val;
for (n = 0; n < 8; n++)
{
if (i & 0xf)
return bitpostab[i & 0xf] + n * 4;
else
i >>= 4;
}
return -1;
}
int
naobj_getbitpos(int val)
{
int ret;
for (ret = 0; !(val & 0xf); ret += 4, val >>= 4) ;
return ret + ((val != 1) ? ((val != 2) ? ((val != 4) ? 3 : 2) : 1) : 0);
}
int
enc_getbitpos(int val)
{
int ret = 0;
if (val & 0×2aaaaa)
ret |= 0×01;
if (val & 0×0ccccc)
ret |= 0×02;
if (val & 0×30f0f0)
ret |= 0×04;
if (val & 0×00ff00)
ret |= 0×08;
if (val & 0×3f0000)
ret |= 0×10;
return ret;
}
int
enc2_getbitpos(int val)
{
return ((val & 0×2aaaaa) ? 0×01 : 0) |
((val & 0×0ccccc) ? 0×02 : 0) |
((val & 0×30f0f0) ? 0×04 : 0) |
((val & 0×00ff00) ? 0×08 : 0) |
((val & 0×3f0000) ? 0×10 : 0);
}
int
main()
{
int i, j;
clock_t a, b;
float f;
a = clock();
for (j = 0; j < 1000000; j++)
for (i = 0; i < 22; i++)
shift_getbitpos(1 << i);
b = clock();
f = b - a;
f /= CLOCKS_PER_SEC;
printf(”shift_getbitpos: %f\n”, f);
a = clock();
for (j = 0; j < 1000000; j++)
for (i = 0; i < 22; i++)
ccr_getbitpos(1 << i);
b = clock();
f = b - a;
f /= CLOCKS_PER_SEC;
printf(”ccr_getbitpos: %f\n”, f);
a = clock();
for (j = 0; j < 1000000; j++)
for (i = 0; i < 22; i++)
naobj_getbitpos(1 << i);
b = clock();
f = b - a;
f /= CLOCKS_PER_SEC;
printf(”naobj_getbitpos: %f\n”, f);
a = clock();
for (j = 0; j < 1000000; j++)
for (i = 0; i < 22; i++)
enc_getbitpos(1 << i);
b = clock();
f = b - a;
f /= CLOCKS_PER_SEC;
printf(”enc_getbitpos: %f\n”, f);
a = clock();
for (j = 0; j < 1000000; j++)
for (i = 0; i < 22; i++)
enc2_getbitpos(1 << i);
b = clock();
f = b - a;
f /= CLOCKS_PER_SEC;
printf(”enc2_getbitpos: %f\n”, f);
a = clock();
for (j = 0; j < 1000000; j++)
for (i = 0; i < 22; i++)
ffs(1 << i) - 1;
b = clock();
f = b - a;
f /= CLOCKS_PER_SEC;
printf(”ffs: %f\n”, f);
return 0;
}
On Arch Linux 2008.04-rc, Linux 2.6.24 SMP PREEMPT, AMD Athlon 64 3000+, glibc 2.7, gcc 4.3.0, with -O0:
shift_getbitpos: 1.220000 ccr_getbitpos: 0.670000 naobj_getbitpos: 0.740000 enc_getbitpos: 0.270000 enc2_getbitpos: 0.460000 ffs: 0.220000
with -02:
shift_getbitpos: 0.430000 ccr_getbitpos: 0.270000 naobj_getbitpos: 0.160000 enc_getbitpos: 0.000000 enc2_getbitpos: 0.000000 ffs: 0.000000
(doesn’t get better with -O3)
shift_getbitpos() is just the dumbest possible implementation and has very low performance, naobj_getbitpos() is also quite slow and doesn’t deserve much attention too, ccr_getbitpos() was suggested to me by ccr and is a little faster but not much.
Now we have enc_getbipos(), enc2_getbitpos() and GNU’s ffs() which show nice performance. While the first two are written in C, are CPU- and OS-independent, ffs() is a POSIX extension and is implemented in glibc in pure ASM. ffs() does calculate the lowest set bit position in all cases, while enc*_getbitpos() do work when only one bit is set.
For those who want to know, enc*_getbitpos(), as the name suggests, are modeled after electronic encoders… if you want to know more about this solution just ask ![]()
Ve l’avevo detto e finalmente ho le prove per dimostrarvelo! Vivere secondo l’orario comunemente accettato (O.C.A™) (si ci alza la mattina e si va a dormire di sera) è un’idiozia.
Ma non solo… ho scoperto anche che è in corso un enorme complotto internazionale che affonda le sue radici nella notte dei tempi affinchè l’umanità segua questi assurdi ritmi di vita, estremamente dannosi.
Non ci credete? Come ve lo spiegate che certe persone, spesso famose, si vedano in tanti posti diversi e in ore della giornata tali che non sembrano dormire mai? Ancora credete alla favoletta della controfigura?
Ho deciso che è il momento giusto per far sì che questo segreto venga svelato, anche se in questo modo metto in pericolo la mia vita. Leggete quello che segue, e fate girare la notizia. Il mistero di Peppo di Rutino (video 1) è finalmente svelato!
Video 1: L’inquietante Peppo di Rutino, “madonnaro” di Rutino Scalo. Molte persone dicono di averlo visto in posti diversi molto distanti in momenti di tempo estremamente vicini. Il noto fisico Antonino Zichichi ha studiato il fenomeno e, durante uno dei suoi discorsi senza capo né coda, ha supposto che Peppo di Rutino è l’unico corpo nell’universo in grado viaggiare a velocità superiore a quella della luce… insomma, le solite stronzate della meccanica quantistica.
Dunque… la prima cosa da sapere è che in Italia esiste un’organizzazione che si occupa dell’accettazione e preservazione delle convenzioni di orario vigenti. Questa organizzazione è l’O.C.A.™ (figura 1).

Figura 1: Logo dell’O.C.A.™.
Perché mai ci sarebbe bisogno dell’O.C.A.™? A questo risponderò dopo. Per adesso basti sapere che in verità l’O.C.A.™ non è un’organizzazione autonoma, bensì risulta essere una sussidiaria dell’anglosassone C.A.T.™ (Commonly Accepted Time) (figura 2), che opera in tutti i paesi di lingua inglese.

Figura 2: Logo del C.A.T.™.
Già il fatto di avere due animali come simboli è una strana coincidenza (in realtà non esistono coincidenze), ma dovrebbe iniziare a far storcere il naso a chi è pratico di simbolismo ed esoterismo, in quanto la congiura degli animali è un tema alquanto ricorrente e ha un senso molto particolare.
A questo punto l’indagine si fermerebbe qui, se non nascesse un particolare dubbio: come mai nei paesi di lingua spagnola non esiste niente del genere? Come noi tutti sappiamo, grazie al cosmopolitismo del dott. DSD, per tradurre una parola italiana in spagnolo bisogna aggiungere la s finale. Quindi abbiamo OCAS, anagramma di CAOS.
Ma non è ancora questo il risultato concreto che volevamo trovare. La sigla CAOS, però, è molto importante per gli appassionati di informatica, in quanto è l’acronimo del nome di un vecchio sistema operativo (CAOS sta per CAOS Autoflunking Operating System - Sistema Operativo Autobocciante CAOS) creato dal mostro Peter TheFace intorno al 10 a.C. (notare la data).
La nostra storia ora si intreccia con quella di questo schifoso personaggio che ha creato il CAOS (anche in terza facoltà, ndr.).
La leggenda racconta che la prima versione del CAOS (CAOS 1) fu scritta da altre tre persone, tutte al servizio del padre padrone TheFace. Questi erano: Helium Little, George Brown e Paul Henry Hereyougiveittome (idioti: Here you give it to me = ‘cca m’u rati).
Due anni prima, però, vide la nascita una setta segreta di esaltati, i CATS (pron. cazz), i cui membri bramavano per ottenere il controllo del tempo. Questi idioti, venendo a sapere dell’invenzione di TheFace, lo contattarono e gli proposero di sviluppare un sistema operativo in time-sharing. Fu così che vide la luce il CATSOS 1 (CAOS Autoflunking Time-Sharing Operating System 1 - pron. cazzos, come lo spagnolo di cazzo).
Gli elaboratori dell’epoca, però, non erano in grado di far eseguire questo sistema operativo in maniera soddisfacente, così TheFace si imbarcò in un’altra avventura: creare un calcolatore adatto allo scopo.
Dopo anni di dure ricerche vide finalmente la luce il CATS-1 (pron. cazz-one, foto 1), a cui il suo creatore TheFace dedicò la celebre frase, ripresa poi da Flaubert in difesa del suo scritto Madame Bovary, “Il CATS-1 sono io!”, proprio a sottolineare l’immenso sforzo per mettere su un sistema simile.

Foto 1: Un modello di CATS-1 giunto funzionante fino ai nostri giorni. Nonostante l’incuria, le insidie del tempo e i segni di vandalismo, si può ancora riconoscere la mano del designer dell’involucro esterno: Sergio Pininfarina.
Quest’epica impresa (mettere su il CATS-1, che è TheFace stesso per ammissione sua) portò a risultati insperati: per la prima volta si potè creare un’interfaccia grafica (figura 3) per permettere l’interazione tra sistema e utente (figura 4).

Figura 3: Interfaccia grafica di CATSOS 1. Quelle che vedete non sono finestre aperte, ma è lo sfondo. Il puntatore del mouse invece è proprio all’incontrario e anche il funzionamento lo è, ma solo quando non inizia a spostarsi a cazzo.

Figura 4: Postura corretta per l’utilizzo del sistema CATS-1 con il sistema operativo CATSOS 1 e la sua interfaccia grafica. L’elaboratore CATS-1 è integrato nella sedia (notare l’espressione sul volto della signorina).
Ora si snocciola la questione: i CATS non erano così idioti come sembravano; non avrebbero mai affidato il loro destino nelle mani di un coglionazzo come TheFace, ma piuttosto l’avrebbero sfruttato per i loro loschi scopi. Questi, infatti, sapevano che il CATSOS sarebbe stata una perdita di tempo totale per gli utenti fin dall’inizio, che infatti, incazzandosi, finirono col distruggere gli elaboratori (figura 5), perdendo così tutto il lavoro presumibilmente fatto (presumibilmente perchè non potevano guardare lo schermo mentre lavoravano).

Figura 5: Un utente distrugge il suo “elaboratore” e poi preso dalla rabbia e dal dolore fa fuori anche tastiera e schermo.
Da quel punto in avanti, il resto è storia… i CATS ebbero ruolo di enorme influenza nell’adozione prima del calendario giuliano e poi di quello gregoriano. Nel XVIII secolo diedero origine alla società segreta degli Illuminati di Baviera e infine, nel secolo scorso, diedero vita a società come l’O.C.A.™ e il C.A.T.™ per proteggersi da un lato, e dall’altro per impedire che l’umantià torni all’unico vero standard di vita naturale che consenta di avere maggior benessere fisico e mentale: il giorno di 36 ore.
Il sospetto, infine, è che i pochi iniziati in giro per il mondo abbiano sviluppato un metodo per trarre ancora maggiori benefici dalla temporizzazione naturale, sviluppando capacità quale la bilocazione, il teletrasporto, riuscire a parlare con i morti, con Mosè e con Pachito, vedere attraverso i muri delle camere delle streghe delle Langhe.