Archive for July, 2011
I recently had the need to parse 780MB XML files, and quickly. My preferred language for PC development is C# because I can work quickly and efficiently with it, however I was a bit wary of the speed of XML file processing. Thankfully Mike Taulty has worked out a solution using LINQ and XmlReader, providing the user friendliness of LINQ with the speed of XmlReader.
An initial test showed that a 39MB XML file is processed in 4.9 seconds using Mono on a quad core server running Ubuntu. This is about 8MB/second which means that my 780MB file should be processed in around 98 seconds. Nice!
Here is my method that I know works. If you have a better one feel free to post it in the comments section. It may not produce the best quality audio but I’m sure it can be improved.
Obtain a 3.5mm to 3.5mm audio cable, for example this one. Connect one end to the audio source (for example a PC) and the other end to the microphone in on your linux box (I tried line in but that didn’t work for some reason).
Make sure ALSA utilities and ffmpeg are installed (at a console prompt):
$ sudo apt-get install alsa-utils ffpmeg
Start recording with:
$ arecord -f cd -t wav test.wav
Start the audio source and once complete press Ctrl-C to stop recording. Convert to MP3 with:
$ ffmpeg -b 128k -i test.wav test.mp3
I then run the file through MP3Gain as the recordings tend to be a bit quiet and add tags in iTunes.