Feature complete custom ringtones

I finally released a version of “Custom ringtones for your contacts” that implements every basic feature I wanted to have for a first stable version, so I think it deserves being called 1.0 :).
Apart from some bug fixes, this new version is translatable and allow you to set a ringtone for callers with a hidden phone number and for contacts not in your address book. The new settings are available from the address book settings dialog.

The settings dialog with the extra ringtone buttons
The settings dialog with the extra ringtone buttons

For now there is only an Italian translation, but any help to get more is appreciated. Don’t worry, there are just 8 strings to translate!
To propose a new translation just go to the Transifex component page, download the .pot source file, add the translations to it, login to Transifex, and upload the file by pressing “Add a new translation” and setting as target file “po/XX.po” (where “XX” it the language code, for instance “fi” for Finnish, “de” for German, etc.). If you don’t know how to use gettext translation files I suggest using Poedit or gtranslator.

The custom ringtones application is now available both from extras-testing and from my personal repository:

Install per-contact-ringtones
Install from my personal repository
(follow the link on the N900 browser)

Update: I released version 1.0.1 containing some new translations: German (by NightShift79), French (by Alban Crequy), Brazilian Portuguese (by Humberto Sgrott Reis) and Swedish (by Andreas Henriksson). I will add more when I receive more.

Update 2: I released version 1.0.2 containing a crasher fix and some new translations: Albanian (by Ilir Gjika), Dutch (by Daniel Holsboer) and Spanish (by Fernando Borrego Polo).

Update 3: I released version 1.0.3 containing some new translations: Russian (by Misha Ketslah), Norwegian (by Stian Husemoen), Korean (by KwangHee Cho), Czech (by Pavel Fric), Hungrarian (by Balázs Bárány) and Romanian (by Bogdan Vernescu).

Ringtoned 0.2.4 (now with vibration!)

I just released ringtoned 0.2.4 with a fix to make the N900 able to vibrate again when a call is received.
Ringtoned (displayed in the application manager as “Custom ringtones for your contacts”) is available from extras-devel (that contains a lot of other unstable software!) or from my personal repository:

Install per-contact-ringtones
Install from my personal repository
(follow the link on the N900 browser)

This release fixes the last major reproducible bugs, but I’m sure there are more. If you find any please report them in the bugzilla explaining clearly what you are doing, what you would expect to happen and what happens instead. A log attached to the bugzilla entry is very useful to understand what is going on, and can be easily created by opening a terminal and giving this command:

ringtonedctl -d stop startwait > /home/user/MyDocs/ringtoned.log 2>&1

Then attach the ringtoned.log file that is in your documents directory to the bug report.

Ringtoned 0.2.1

The Fremantle daemon that decodes ringtones seems to have a bug that, in some cases, makes it produce wave files with an invalid size in them. These files cannot be played by libcanberra, so it meant that some ringtones couldn’t be played when you receive a phone call. I just released ringtoned 0.2.1 with a work around for the bug, please let me know if this version works better for you.

Anyway, I got a new component in the Meamo Bugzilla for ringtoned, so please report bugs there.

Update 2: I released ringtoned 0.2.2 that just adds some more debugging info to make my life easier.

Faster custom ringtones

Several people complained that my custom ringtones application is too slow when receiving calls, so I started analysing what ringtoned does when a new call is received. The three main operations in this case are creating the object that represents a call after retrieving all the needed information (caller ID, etc.) from Telepathy, looking up the contact that matches the caller and playing the ringtone.
The Telepathy bit just needed to be slightly smarter, but was already quite fast. The contact look up was already very fast, unless you have so many contacts to make your address book unusable.
The code that needed more optimisation was the one that plays ringtones. It turned out that using GStreamer with playbin2 (the element able to detect and play all the supported file types) is not fast enough for this use case. I tried different approaches and in the end I decided to always use uncompressed wave files and stream them directly to PulseAudio.[1]
Note that GStreamer is not the best solution just in this very specific case, for all the other use cases GStreamer is still the best solution.

After these changes I was really expecting to get very good performances, but it was still quite slow. My analysis was showing that, since when ringtoned gets notified from Telepathy of the existence of a new call to when it starts streaming to PulseAudio, less than 0.1 seconds passes, so why was it still slow?
At this point I tried using bustle to generate graphs of the D-Bus activity when a call is received. The graphs showed that the delay was not ringtoned’s fault, but a bug in Maemo causing a freeze that made the dispatching of new calls about 4 seconds slower when ringtoned was running. Somebody is now working on the bug and trying to figure out why it’s happening, in the meantime I’m working around it watching for new calls in a different way.[2]

Ringtoned and the related packages are available in Maemo extras-devel under the name “Custom ringtones for your contacts”. If you don’t want to add the extras-devel repository (as it contains a lot of unstable software, you have been warned!), you can download ringtoned directly from my personal repository:

Install per-contact-ringtones
Install from my personal repository
(follow the link on the N900 browser)

The only known big problem left is that ringtoned breaks vibration, I will fix it in the next days/week.

Update: It looks like MyContacts is incompatible with ringtoned, so you cannot use these two programs together.

[1] The file is uncompressed in background, so you can still use any type of file for ringtones. Just notice that, when you update from a previous version, the first time you receive a call from a contact that already had a custom ringtone you will get the default ringtone and not the custom one as previous versions were not generating the uncompressed file.
[2] For people interested in Telepathy: the freeze happens if there is an observer running, even if at that point the dispatching to observers didn’t start yet! The (ugly, but effective) solution was to just listens to the NewChannels signal directly. When the Maemo bug will be fixed I will revert my code to use an observer.

Disappearing plugins

If you have any application that adds buttons to the address book (like the contacts merger), you could have noticed that the buttons recently disappeared. This happened because of a bug in Monorail, the IM file transfer application.
Alban already fixed this bug and uploaded a new version to extras-devel. This new version also fixes other bugs, including a crash caused by the sharing plugin in Conboy.

Update: Note that you need to reboot or kill osso-addressbook after updating monorail to see the plugins again.