Monday, 9 May 2011

Hello, Vala!

A while ago I've been playing with Vala. The cool thing about Vala is that it's a cutting edge language which is able to produce programs with similar performance to those written directly in C. Obviously, it may prove to be a perfect language for fast audio-processing tasks, and there already are bindings for JACK, liboil (now removed from PySoy), an ongoing effort to create bindings for libsndfile and probably other libraries, which I overlooked.

For the exercise, I tried to create Vala bindings for liblo, the lightweight OSC protocol library. They're still unpolished, but already usable in a straightforward, almost C-like way:
static void main(string[] args)
    Lo.Address t = new Lo.Address(null, "8080");
    Lo.send(t, "/box/grid/led/all", "i", 1);
Right now, I'm working on Vala bindings for LV2 and the accompanying Lilv library. For this purpose and for further experiments with LV2 plugins I've created uSynth capsula - a project, which currently provides little more than a functional port of lv2jack host from Lilv source distribution. It does not have any support for plugin GUIs yet, but it's a planned feature. Loading GUIs with SLV2 (a Lilv predecessor) worked to some extent:

Capsula is still in the earliest planning stages and doesn't have a roadmap yet. For now, I'm thinking about a full featured LV2 plugin host, completely controllable by OSC. I don't have any further ideas, but perhaps you have? Then, by all means, feel free to join the fun!

Saturday, 30 April 2011

Natty Release Party: success!

The release party in Gorno-Altaisk turned out to be the best release party we ever had, a really joyful evening. I have no idea how many people came, but the place was certainly full of people, who continued to arrive.

We had the usual bulk of DVDs to give out, a talk about free software and Ubuntu, a talk about the local media environment, and lots of interaction and conversations about Ubuntu and open source. For the entertainment part, there was a Mafia game with a geek theme and some live music, performed under Linux with the monome (actually an arduinome) controller and rove.

Several pictures from the event are below, and the full set is available here (courtesy of the Shum webzine).

Во время лекции о свободном софте Игра в "гик-мафию" Вечеринка Гости интересуются мономом

Thursday, 24 February 2011

Writing PolicyKit applications in Python without D-Bus

I'm always happy when more libraries get Python bindings, and today I've been especially excited by the fact that GObject introspection support for PolicyKit has finally appeared in Natty repositories. Basically it means, that PolicyKit is now accessible from Python through a native API without direct D-Bus communication. I've tried to port the querying example from PolicyKit manual and it did work!

The Python example below is an almost line-by-line port of the original, but it should give you a basic idea on how to use the API for your own scripts.

#! /usr/bin/env python

import sys, os
from gi.repository import GObject, Gio, Polkit

def on_tensec_timeout(loop):
  print("Ten seconds have passed. Now exiting.")
  return False

def check_authorization_cb(authority, res, loop):
        result = authority.check_authorization_finish(res)
        if result.get_is_authorized():
        elif result.get_is_challenge():
            print("Not authorized")
    except GObject.GError as error:
         print("Error checking authorization: %s" % error.message)
    print("Authorization check has been cancelled "
          "and the dialog should now be hidden.\n"
          "This process will exit in ten seconds.")
    GObject.timeout_add(10000, on_tensec_timeout, loop)

def do_cancel(cancellable):
    print("Timer has expired; cancelling authorization check")
    return False

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("usage: %s <action_id>" % sys.argv[0])
    action_id = sys.argv[1]

    mainloop = GObject.MainLoop()
    authority = Polkit.Authority.get()
    subject =

    cancellable = Gio.Cancellable()
    GObject.timeout_add(10 * 1000, do_cancel, cancellable)

        action_id, #"org.freedesktop.policykit.exec",

In order to run this example, make sure you have the gir1.2-polkit-1.0 package installed and provide an action in the command line, for example:

./polkit-test org.freedesktop.policykit.exec

I suppose, the API is still a little rough on the edges, but it's already usable and I'm going to try it for an upcoming D-Bus service in indicator-cpufreq. Looks like it's perfect time to start moving things to GObject introspection already.

Friday, 18 February 2011

Hello Planet Ubuntu!

Greetings to all the Planet readers! I've become an Ubuntu member today (or was it yesterday in Americas?), and this is my first post on Planet Ubuntu.

My name's Artem Popov and I am an active member of the Russian Ubuntu Translators team. Sometimes, I also help with packaging / bugs and I intend to become a MOTU in the future.

Ubuntu is my favourite distribution for a long time now, because I believe it has many things done right from the very start. Contributing to Ubuntu is a great opportunity to gain new experience and it's always a pleasure to work with such a rocking community.

For now, I am going to continue my work on translations and packages with the MOTU team, but maybe I shall try some other ways of helping out. Fortunately, there are plenty of them!

Friday, 17 December 2010

CPU frequency indicator and DIY merchandise

I have been using Natty since Alpha 1 and I'm very happy with the new Unity desktop. It has surely got its bugs, but I almost love it. The drawbacks are that Unity doesn't support GNOME applets and doesn't seem to have a native application launcher yet. The latter problem is easily fixed by installing either GNOME Do or Synapse. The applets, well... are not a big problem either, because I can't remember using any, except for the clock (replaced by an indicator) and the CPU frequency scaling applet, which had always saved me from all the JACK audio timing issues (with a single click).

There is no indicator for selecting CPU frequency scaling mode, so I decided to write my own. I started with Jono Bacon's tutorial here and used cpufreq-selector D-Bus service (bundled with the Gnome applet) to switch between governors. This functionality is also provided by HAL, but HAL is deprecated in favour of DeviceKit, which doesn't support frequency scaling right now. I think I'll have to add a dedicated D-Bus service in the future to get rid of gnome-applets dependency... And this is how it all currently looks:

Thanks to Quickly, an Ubuntu package was a piece of cake. You can install it from here or grab the source from project page in Launchpad. Please report any issues. Thanks!

Another thing that bothers me, is an almost critical bug with the Ubuntu Beanie Hat from Canonical store. It just cannot stand low temperatures in winter and is unsafe to wear outside. I wonder, if there is a Launchpad project to report bugs against Ubuntu merchandise :) Anyway, I came up with a simple workaround, which works if you're not afraid of DIY:
  1. Get an ushanka.
  2. Attach an Ubuntu button badge (I used a really old one).
  3. Have fun with the new Ubuntu ushanka!

Sunday, 30 May 2010

Better firewire audio support comes to Maverick

Maverick Meerkat development has started with some big changes on the professional audio front. Last week JACK2 (aka jackdmp) has finally replaced the original JACK in Ubuntu. And that's not all! There are FFADO packages, updated to work with the new firewire stack (alias Juju), which in turn is fully supported by the Maverick kernel. The news made me immediately upgrade to Maverick as soon as I've noticed a new libffado source upload in the Maverick changes feed... For now, I am very pleased with the result. But using JACK2 with a Juju-powered backend may require a little bit of work, that I am going to describe below.

First of all, the new FFADO packages currently fail to build on Maverick, because of a Python policy violation (bug 586821). A fix is underway, but I didn't want to wait and built a quick-and-dirty workaround package. If you like workarounds too, feel free to install libffado binaries from my PPA.

Second, to use the new firewire stack, FFADO needs at least libraw1394-2.0.5, which is also missing from Maverick. Hopefully the new version will be merged or synced from Debian soon (bug 586918), but if you don't want to wait again, you can install the package from my PPA as well. That will work.

Next, the old firewire stack has to be blacklisted. Simply edit /etc/modprobe.d/blacklist-firewire.conf to look like:

blacklist ohci1394
blacklist sbp2
blacklist dv1394
blacklist raw1394
blacklist video1394

#blacklist firewire-ohci
#blacklist firewire-sbp2

Finally, run "sudo update-initramfs -k all -u" and reboot. That's it... One thing to remember is that Juju creates device nodes with /dev/fw* paths without write access by default. This is easily fixed by a little udev tweak (example configuration may be found here).

Just to be safe, I also updated my rtirq settings to increase the priority of firewire_ohci IRQ service. It will not make things faster right now, because rtirq requires a realtime kernel, which has not been updated for Maverick (yet).

I like the fact, that all existing JACK applications work without any extra configuration or recompilation. This includes QJackCtl, Qtractor, SuperCollider, JAMin, energyXT... Only Renoise  started to hang and produce bad noises, until I switched the "Realtime audio CPUs" parameter to 1. Most likely it has something to do with JACK's own multicore support.

Some applications may also display strange port names (like firewire_pcm:0500000000000000_Unknown5_out). Luckily, JACK provides port aliases in the "system:playback_N" form. Aliases seem to work transparently for connecting/disconnecting ports, but QJackCtl will only display them if you set the appropriate option in the setup dialog.

Audio streaming is generally stable most of the time, but I've heard glitches with both the internal firewire controller (Ricoh R5C832 rev 05) and an ExpressCard controller (Texas Instruments XIO2200). So, I would not recommend performing live with Maverick right now. Nevertheless, it is great to see the progressing firewire audio support in Ubuntu. Juju migration is one of the Maverick development targets, and there is a blueprint to track the process.

Tuesday, 18 August 2009

Scan Tailor package

I didn't expect this to happen in the Karmic release cycle, and I'm very happy, that I actually managed to do it. Today is the day, when my first package has made its way into Ubuntu! Well, not exactly the first, since I have uploaded several sponsored bugfixes in the past, but this is my first real Ubuntu package made from scratch, that has passed all of the Ubuntu requirements. This would not be possible without people from #ubuntu-motu, who have been constantly helping out and correcting (sometimes really stupid) mistakes! Thank you, guys!

And now I'd like to introduce this little piece of software. It is quite a nice application, called Scan Tailor by Joseph Artsimovich et al. and it's purpose is to cleanup and arrange raw document scans into sets of pages, ready for OCR, assembling into a book or printing. For an idea of what it looks like, here's a couple of screenshots:

In short, if you've been looking for an application for cropping, deskewing and splitting your scans in Linux, well... There is one and a very good one! Also, besides being a very useful tool for anybody digitizing moderate to large amounts of text, Scan Tailor rocks, because it shows the essential signs of a true UNIX app:

  • It does one thing and does it well.
  • It is suitable for processing both tiny and massive amounts of data.
  • It does most of the work for you, yet still allows manual control over everything.
  • It is free and open source.
Last, but not least, it is very friendly and fun to use. And you can try out this amazing application by simply clicking an apturl link, if you have Karmic installed and there are builds for Jaunty in my Launchpad PPA as well. It's still got a picky FTBFS on armel, but I hope, that I shall be able to track it. This is where the things are starting to get really exciting!