You are viewing [info]jmspeex's journal

jmspeex

As of today, it's really important that I don't forget to tell people not to do illegal stuff. That's because today, a new special law states (among other things) that (rough translation):

"Whoever causes, by an act, omission, help, encouragement, advice, consent, authorization, or order, someone to do something which is an offense under that law, then that person is deemed to have committed the same offence".

For those who can read French, here's the French text for that quote. What is still unclear is whether that clause applies recursively and if so, down how many levels. For example, if I don't tell you to tell Joe to tell Bob to tell George not to commit an offence under that law, have I committed an offence?

No, I do not live in China or North Korea, but in the Canadian province of Quebec. The reason why this law is apparently really necessary is that the government had to stop university students from savagely attacking police batons with their heads. I mean, there's a few minor issues, like the fact that the Quebec Bar association considers this new law to be unconstitutional, but hey who really cares about those sorts of details anymore.

Tags: ,
 
 
jmspeex
04 March 2012 @ 12:20 am
During LCA 2012, I got to meet face-to-face (for only the second time) with David Rowe and discuss Codec2. This led to a hacking session where we figured out how to save about 10 bits on LSP quantization by using vector quantization (VQ). This may not sound like a lot, but for a 2 kb/s codec, 10 bits every 20 ms is 500 b/s, so one quarter of the bit-rate. That new code is now in David's hands and he's been doing a good job of tweaking it to get optimal quality/bitrate. This led me to look at the rest of the bits, which are taken mostly by the pitch frequency (between 50 Hz and 400 Hz) and the excitation energy (between -10 dB and 40 dB). The pitch is currently coded linearly (constant spacing in Hz) with 7 bits, while the energy is coded linearly in dB using 5 bits. That's a total of 12 bits for pitch and energy. Now, how can we improve that?

The first assumption I make here is that David already checked that both gain and energy are encoded at the "optimal" resolution that balances bitrate and coding artefacts. To reduce the rate, we need a smarter quantizer. Below is the distribution of the pitch and energy for my training database.



So what if we were to use vector quantization to reduce the bit-rate. In theory, we could reduce the rate (for equal error) by having more codevectors in areas where the figure above shows more data. Same error, lower rate, but still a bad idea. It would be bad because it would mean that for some people, whose pitch falls into the range that is less likely, codec2 wouldn't work well. It would also mean that just changing the audio gain could make codec2 do worse. That is clearly not acceptable. We need to not just care about the mean square error (MSE), but also about the outliers. We need to be able to encode any amplitude with increments of 1-2 dB and any pitch with an increment around 0.04-0.08 (between half a semitone and a semitone). So it looks like we're stuck and the best we could do is to have uniform VQ, which wouldn't save much compared to scalar quantization.

The key here is to relax our resolution constraint above. In practice, we only need such good resolution when the signal is stationnary. For example, when the pitch in unvoiced frames jumps around randomly, it's not really important to encode it accurately. Similarly, energy error are much more perceivable when the energy is stable than when it's fluctuating. So this is where prediction becomes very useful, because stationary signals are exactly the ones that are easily predicted. By using a simple first-order recursive predictor (prediction = alpha*previous_value), we can reduce the range for which we need good resolution by a factor (1-alpha). For example, if we have a signal that ranges from 0 to 100 and we want a resolution of 1, then using alpha=0.1, the prediction error (current_value-prediction) will have a range of 0 to 10 when the signal is stationary. We still need to have quantizer values outside that range to encode variations, but we don't need a good resolution.

Now that we have reduced the domain for which we need good resolution, we can actually start using vector quantization too. By combining prediction and vector quantization, it's possible to have a good enough quantizer using only 8 bits for both the energy and the pitch, saving 4 bits, so 200 b/s. The figure below illustrates how the quantizer is trained, with the distribution of the prediction residual (actual value minus prediction) in blue, and the distribution of the code vectors in red. The prediction coefficients are 0.8 for pitch and 0.9 for energy.



First thing we notice from the residual distribution is that it's much less uniform and there's two higher-density areas that stand out. The first is around (0.3,0), which corresponds to the case where the pitch and energy are stationary and is about one fifth of the range for pitch (which has a prediction coefficient of 4/5) and one tenth of the range for energy (which has a prediction coefficient of 9/10). The second higher-density area is a line around residual energy of -2.5, and it corresponds to silence. Now looking at the codebook in red, we can see a very high density of vectors in the area of stationary speech, enough for a resolution of 1-2 dB energy and 1/2 to 1 semitone for pitch. The difference is that this time the high resolution is only needed for much smaller range. Now, the reason we see such a high density of code vectors around stationary speech and not so much around the "silence line" is that the last detail of this quantizer: weighting. The whole codebook training procedure uses weighting based on how important the quantization error is. The weight given to pitch and energy error on stationary voiced speech is much higher than it is for non-stationary speech or silence. This is why this quantizer is able to give good enough quality with 8 bits instead of 12.
 
 
jmspeex
22 January 2012 @ 05:25 pm

I just got back from linux.conf.au 2012 in Ballarat. The video for the talk I gave, Opus, the Swiss Army Knife of Audio Codecs, is now available on the Opus presentations page. For the Ogg-impaired, a lower-quality version is also available on YouTube.

For those who are into speech codecs, I also recommend watching David Rowe's presentation: Codec 2 - Open Source Speech Coding at 2400 bit/s and Below. His presentation was selected as one of the four best talks at LCA this year -- well worth watching.

 
 
jmspeex
10 January 2012 @ 04:40 am

Those who have been following the Opus git repository in the past few weeks probably haven't noticed much work going on. The reason is pretty simple, most of the work has been going on elsewhere in an experimental branch (exp_wip3 names for now) of my private repository. The reason it's in an experimental branch is that its not fully converted to fixed-point and hasn't been tested on any frame size other than 20 ms. Here's an (incomplete) list of changes for now:

  • Really unconstrained VBR (not trying to keep the same average rate)
  • Tonality detection to give highly tonal audio a boost in bit-rate
  • (yet another) rewrite of the transient detection code
  • New dynamic allocation code that boosts the rate of bands that have significant spectral leakage caused by short blocks

Thanks to these changes, the quality has (as far as we can tell) gone up compared to the current master branch. I invite you to judge for yourself by comparing the audio coded with the current master branch with the audio coded with the new exp_wip3 experimental branch. This is 64 kb/s, so fairly low rate for stereo music. The original is here. Let me know what you think.

 
 
jmspeex
25 October 2011 @ 10:17 pm

(voir série rénovations)

Nous avons décidé de faire affaires avec Armoires Créabec pour nos armoires de cuisine suite à une recommandation. Créabec s'affiche comme un fabriquant d'armoires haut de gamme. Nous aimons le look général de nos armoires de cuisine. Les composantes sont de qualité et la fabrication des armoires elles-mêmes est très bien. Par contre, c'est une toute autre histoire pour ce qui est du service, du transport et de l'installation des armoires! Nous avons été conseillés par Christian. Nous avions un échéancier très serré pour faire tous nos travaux avant d'enménager dans notre nouvelle maison. Nous avons donc fait des pieds et des mains pour choisir rapidement nos armoires de cuisine, avec la promesse du vendeur que la cuisine serait prête à temps. Une fois de contrat signé, la date estimée avait déjà glissé de 1 semaine. En cours de route, d'autres délais sont apparus. Bref, notre cuisine a été installée plus de 2 semaines plus tard que la date initialement promise. S'ajoute à cela passablement de difficultés à avoir des retours à nos appels téléphoniques. D'autre part, une fois tout installé, nous avons constaté qu'un grand nombre de portes d'armoires et caissons étaient égratignés et endommagés, que les joints des o-gees et cache-néons étaient mal alignés, et que les murs étaient abimés (pas juste la peinture - nous devons refaire le plâte à certains endroits). Christian est alors venu constater par lui-même l'état de la cuisine. Il a admis que: "C'est la première fois que je vois une cuisine aussi cochée que ça". Plusieurs portes d'armoire ont donc été retouchées en usine. Il a ensuite été convenu que l'installateur reviendrait pour remettre les portes, remplacer un panneau endommagé, réparer d'autres égratignures de surface et refaire les joints de o-gees/cache-néons problématiques. L'installateur, Rodrigue, est donc revenu avec comme seul outil: un crayon de cire! Par la suite, Christian nous a assuré qu'il aller corriger ce qui restait et qu'il accompagnerait son installateur lors de sa prochaine visite.

Deux semaines plus tard, le discours était bien different. Christian annonce la position de la direction: "Il n'y aura plus rien qui va être fait sur votre cuisine". Essayant de comprendre le changement de cap, Christian me sert des insultes et des attaques sur le plan personnel: "Votre attitude n'est pas bonne"; "Vous ne dégagez pas une bonne énergie"; "De toute façon vous ne serez jamais satisfaits"; "Vous êtes pas facile comme personne". Bref, nous sommes extrêmement déçus du dénouement de cette histoire. Les propos qui ont été tenus à notre égard sont tout à fait inadmissibles, surtout considérant que nous y avons laissé une somme d'argent considérable pour un travail qui ne nous satisfait pas et qui ne rencontre pas les promesses qui nous ont été faites. Disons qu'on est loin du principe que "le client a toujours raison"!

Conclusion: Ne pas réparer une erreur est souvent pire que l'erreur elle-même et c'est exactement la position que Créabec a choisi de prendre dans notre cas. Nous ne referons certainement pas affaires avec Armoires Créabec dans le futur. Ce que nous retenons de cette expérience est de prendre plus de temps pour faire le choix de ses armoires, mais aussi du farbiquant d'armoires. Aussi, il faut mieux éviter autant que possible de payer le montant total "à la livraison" comme nous avons fait et plutôt payer "après l'installation".

 
 
jmspeex

(voir série rénovations)

Nous avons fait affaire avec Entreprise Jeannot Paquette Inc. pour faire installer un nouveau système de chauffage au gaz, installer une nouvelle salle de bain au sous-sol, ainsi que pour l'installation de plomberie de la nouvelle cuisine. Nous sommes très satisfaits de l'installation du système de chauffage. Les travaux ont été faits proprement, dans les délais, et sans surprise. Le seul pépin est venu de Gaz Métro (d'un sous-contracteur pour être plus précis) qui a dépassé la date limite de branchement d'une semaine (pas pratique avec une cuisinière au gaz).

Côte plomberie, les travaux de "rough" (passer les drains et les tuyaux pour la salle de bain du sous-sol) se sont bien déroulés et ils ont été faits dans les délais -- souvent avec très peu de pré-avis de notre part -- ce qui a été très apprécié. Pour ce qui est de la finition, il y a eu quelques pépins avec la pose de l'évier (fuite dans le drain) de la cuisine et l'assemblage de la douche. Le problème avec le drain de l'évier a été réglé rapidement. Pour ce qui est de la douche, nous avons acheté une douche OVÉ tout en verre qui semble difficile à assembler. Même après un 2e passage du plombier pour ajuster l'assemblage (les panneaux de verre n'arrivent pas à angle droit), il y a toujours des ajustements à faire. Nous attendons un retour du plombier à ce sujet (à suivre).

Tous les plombiers qui sont venus faire des travaux (3 en tout) étaient très sympatiques, minutieux et ponctuels, ce qui est toujours agréable et rassurant. Aussi, une (petite) partie des travaux a été faite "à l'heure" et le temps a été compté de façon tout à fait honnête. Nous avons été rapidement en confiance avec l'Entreprise Jeannot Paquette.

Conclusion: Entreprise Jeannot Paquette offre un excellent service. Nous avons grandement apprécié que les quelques problèmes d'installation de la plomberie aient été réglé rapidement et sans difficulté. Nous referons affaires avec Jeannot Paquette avec plaisir si l'occasion se représente.

 
 
jmspeex
21 September 2011 @ 12:18 am

(voir série rénovations)

Nous avons demandé à Toiture Alpine de remplacer notre vieille toiture en goudron par une membrane élastomère. Le représentant était très courtois et nous avons eu un estimé en peu de temps. L'installation s'est bien déroulée, quoique avec deux jours de retard sur l'horaire (dont une journée sans avertir du délai). L'installateur a pris le temps de nous expliquer le pour et le contre de certaines options lors de l'installation. Je n'ai pas encore pu inspecter les travaux (pas encore d'échelle), mais je peux au moins dire que le nouveau toit a déjà résisté à quelques orages.

Conclusion: Nous referons probablement affaire avec Toiture Alpine si l'occasion se represente (pas trop tôt j'espère).

 
 
jmspeex
07 September 2011 @ 09:45 pm
I just got the news today that LCA 2011 has accepted my talk proposal: "Opus, the Swiss Army Knife of Audio Codecs". I'll be presenting it in Ballarat, Australia in January. If there's any specific topic you'd like me to include in the talk, please let me know (by email or comment on this post).
 
 
jmspeex

(voir série rénovations)

Nous avons fait faire notre sous-sol, une chambre à coucher, et une galerie par Entreprises Spécialisées Enr. d'Acton Vale. Ils ont fait un travail de bonne qualité et très solide. Par contre, nous regrettons fortement les avoir payés à l'heure. Pour dix jours de travaux, nous avons été facturés 294.5 heures, soit près de 15 heures par jour par travailleur. De plus, les heures de transport (près de 6 hres par jour) nous ont été facturés au plein tarif. Nous n'avons jamais pu avoir le détail des heures travaillées (facture très vague, pas de réponse précise au téléphone), mais notre estimé est bien en-deça.

Conclusion: Ne jamais payer à l'heure pour des gros travaux, mais s'entendre sur un coût forfaitaire. Prendre entente sur la facturation des heures de transport. Nous sommes satisfaits du travail effectué par l'équipe des Entreprises Spécialisées Enr., mais à cause de la facturation que nous avons estimée excessive, nous ne referons probablement plus affaire avec eux.

 
 
jmspeex
01 September 2011 @ 12:35 pm
Since yesterday, the IETF audio codec requirements are now published as RFC 6366. While the requirements aren't by themselves interesting (why discuss abstract requirements when you can discuss actual running code?), it's an important milestone in that it's the first document published by the Working Group. It also means one less source of pointless arguments. The guidelines document is now next in line and should go to IETF last call soon.

Now the interesting part of the Opus codec itself. That's the only document that really matters. That one should go to Working Group Last Call (WGLC) pretty soon (possibly next week or two). In the mean time, we're working on improving the clarity of the draft, cleaning up the code and fixing all the last few issues that have been reported since the first WGLC. Stay tuned.