
While we are waiting for iTunes (Apple) to teach the new iPod Shuffle to speak Russian, why not try it yourself?
Before you startAll that is described here is not intended to replace iTunes, but rather serves as an addition, which is needed only until iTunes learns how to voice the names in Russian (I really hope that they will learn).
')
The technical side of the issue 
The voiceover function, which appeared in the new iPods (pronounces the name of the song / playlist), is realized, of course, not by the iPod itself, but by iTunes (which is why you need iTunes not lower than 8.1 to work with the new iPod), which synchronizes the sound files and uploads them to the iPod. The iPod, in turn, reads them (on the "convenient" occasion).

Sound files that are used for pronunciation are located in the Speakable directory. In addition to everything else (system voice messages about battery charge, etc.) there are two subdirectories in it - Tracks and Playlists. In which there are voiced names of playlists and tracks, in wav format (raw PCM, 22050 Hz), with rather strange names. As it turned out, these names are identifiers of songs and playlists in a database that is stored on the iPod.
Looking for a way to read iPod - libgpod 
In search of a place from where iPod takes the names of files with voice acting, stumbled upon files in the iPod_Control / iTunes directory, in which there are file names, more precisely, if some numerical sequences from the files are represented as a hexadecimal string, then the names of the files were obtained. There was no time or desire to deal with the iTunes database format, so we decided to look for ready-made solutions. The choice fell on the libgpod library (we learned about it from the dependencies of the gtkpod application - a very good replacement for iTunes for Linux - for which, judging from everything, this library was developed).
Here a difficulty arose - the library returned an error, something in the spirit of “not the correct record size (11 <18)”. I had to watch the library source.
(By the way, here we are talking about the library version 7.0, there was, at the time of the start of development, version 7.2, which also could not read the third-generation shafles.)
The figure on the right shows the corresponding section of the code. The first underlined is the offset, which in the version of the database, which is in the new iPod, has changed and became 8 (this can be seen if you open the file with a hex editor, in our case it was GHex). The second underlined is that the changes were made (while we were looking for information on the network, we found that the numbers became 32-bit in the new iPods, they didn’t check it, but they did it just in case :).
It is worth paying attention that since the number that was corrected (offset) is set rigidly, regardless of the version of the database, then the libgpod patched in this way will not work with older versions of the iPod. In order to do it in a normal way, I would have to change the library quite a lot, which was not the goal.
So, having managed to read the iPod database, we saw that the names of the files with dubbing are identifiers of playlists and tracks. In the same database, fortunately, there is all the information about the names of playlists, tracks, names of albums and artists. The next question is how to voice, i.e. how to synthesize sound files from the Russian text.
We voice in Russian, festivalI managed to find only one free solution for dubbing, - festival, the distribution kit is probably in all Linux distributions, if not, you can download the source code from the developers site (
http://www.cstr.ed.ac.uk/projects/ festival / ). The official distribution does not support the Russian language, but there is a solution that allows you to voice the Russian text. Description can be found here (
http://festlang.berlios.de/docu/doku.php?id=russianru )
In order to be able to use the Russian language immediately in festival, you need to add the command (set! Voice_default 'voice_msu_ru_nsh_clunits) to the /etc/festival/siteinit.scm file.
The Festival allows you to get a pretty good quality of the Russian text, but it has one problem - the English text is not very good ... probably not very good at all (this is if the Russian voice is chosen).
Examples of sound (wav, about 100k each):
Actually, the programWe got this program (C, GTK +):

We press to read iPod, we select iPod, we receive the list of playlists and tracks. The right column is a file, - the name of the file with “voice acting”, for the corresponding position
Double click on the line, - play the file that currently corresponds to the track / playlist.
We choose what exactly needs to be voiced, click to voice and wait for quite a long time, at the bottom of the progress.
The program still has a console (non-interactive) interface (see - help and README).
InstallationSo, we need:
- Actually program ( here )
- Patched libgpod ( here )
- versions of GTK +, GStreamer and libgpod for developers (in Gent these are the same packages, in Debian, it seems, they are with the -dev postfix). Put your favorite means.
We unpack libgpod, inside we execute
./configure
make
(only if you are not going to use gtkpod with older iPod models) make install
Let's unpack the program, inside we execute
./configure
make
(you do not need to make install, because there is still no desktop file, i.e. nothing will be added to the menu)
If in the previous paragraph (about libgpod) you didn’t make install, then you need to do the following (otherwise, you can skip to the last paragraph of this part):
Copy the file libgpod / src / .libs / libgpod.a to the directory shuffle-vo / src, libgpod is the directory in which the unpacked library libgpod, shuffle-vo is the directory with the unpacked program.
Go to the shuffle-vo / src directory, run make clean, then make, copy a line like this (it will be the last):
gcc -Wall -g -g -O2 -Wl, - export-dynamic -o shuffle_vo main.o -pthread -L / usr / lib /usr/lib64/libgtk-x11-2.0.so / usr / lib64 / libgdk- x11-2.0.so /usr/lib64/libatk-1.0.so /usr/lib64/libpangocairo-1.0.so /usr/lib64/libpangoft2-1.0.so /usr/lib64/libcairo.so / usr / lib64 / libpixman- 1.so /usr/lib64/libpng12.so /usr/lib64/libXrender.so /usr/lib64/libX11.so /usr/lib64/libXau.so /usr/lib64/libXdmcp.so / usr / lib64 / libpango- 1.0.so /usr/lib64/libfontconfig.so /usr/lib64/libfreetype.so /usr/lib64/libexpat.so /usr/lib/libgpod.so /usr/lib64/libgdk_pixbuf-2.0.so / usr / lib64 / libgio-2.0.so /usr/lib64/libgstreamer-0.10.so /usr/lib64/libgobject-2.0.so /usr/lib64/libgmodule-2.0.so /usr/lib64/libgthread-2.0.so -lpthread -lrt / usr / lib64 / libxml2.so -ldl -lz -lm /usr/lib64/libglib-2.0.so -pthread
and replace /usr/lib/libgpod.so in this line with libgpod.a, and then execute the resulting line
Thus, our program will be statically linked to the desired libgpod library, while the system will have the libgpod library that can work with previous versions of the iPod.
To check that the static binding can be done the following - ldd shuffle_vo, there should not be a line in the list
libgpod.so.4 => /usr/lib/libgpod.so.4 (0x00007fe6537f1000)
We read the README, which with the program, set up the festival accordingly.
What's next
The quality of sounding English words in Russian texts leaves much to be desired, so it would be great if someone, for example, uBot organizes a voice service, for
uBot , by the way, the quality of sounding Russian texts is higher than that of festival. Well, we are waiting for the apple to release an update for iTunes, which will allow the Russian names to be voiced, we are waiting very much, because iTunes speaks English lyrics very well, if it also speaks Russian will be very cool.
This is the first public release of the program, so, for sure, it is full of glitches and errors.
Regarding the further development of the program - feel free to download, modify and share. I probably will not have time for its development. Is that if there will be integration with uBot.
This article and the program are written by the user and one of the creators of the it-portal
thinkit.ru (it_3.0), but he does not have registration on the habr, for this I publish it at his request.