[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

another notch on the bed post

Filed under: DAD,GStreamer,Python — Thomas @ 11:37

2009-05-23
11:37

While working on morituri I provided some patches to pycdio, the python bindings for libcdio, to handle CD-Text. I was assuming it was the only library or program capable of reading it (turns out I was wrong, cdrdao also extracts it). But those functions weren't wrapped, so I added them. Upstream was using git, so that was another opportunity to test my git workflow across my 3 computers.

Anyway, it was nice to get feedback that said:

Your code has been checked into pycdio. Looks very competently done and is very thorough. Thanks.

For various reasons I won't get into I don't always enjoy the results of coding contributions at work to Flumotion, the project I started. And just as much in the open source world, my contributions aren't necessarily always valued, or treated with the respect I would think they deserve :)

That usually isn't that big of a deal to me, because that's not why I do it, but getting this succint positive remark reminds me that being nice invites being nice. Something I need to remind myself of once in a while to make sure I try and act the same way.

Anyways, a roundabout way of saying I can add another project to my list of projects I've touched.

Meanwhile, on my last plane trip I took the time to autotool morituri. I've finally caved in and went with the familiar, adding a simple frontend command using my python Command class
Another tree is born. Here's the first command's output:
[morituri-trunk] [gst-git] [thomas@ana trunk]$ rip offset find
Trying read offset 0 ...
Trying read offset 6 ...
Trying read offset 12 ...
Trying read offset 48 ...
Offset of device is likely 48, confirming ...

Read offset of device is: 48.

Now, on to ripping and drive selection and TOC caching and such niceties. Someday soon I should be able to actually use this...

rip update

Filed under: DAD,Hacking,Python — Thomas @ 21:47

2009-05-15
21:47

Today was not a particularly good day - I woke up with a huge headache around 4, took a dafalgan, went back to bed, and woke up around 8:30, still with a headache. This sort of thing happens once in a while to me, though it happens a lot less since I reduced my disorganization stress a few years ago.

Anyways, that's not the point. On days like these, I can only do small incremental changes, which I guess is good for polishing. My brain doesn't let me do much more.

So, I finished some loose ends in my ripping code. Here's a file listing of a directory:

[gst-git] [thomas@ana trunk]$ ls -l Bloc\ Party\ -\ Silent\ Alarm
total 559364
-rw------- 1 thomas thomas 35797484 2009-05-15 16:25 00. Bloc Party - Hidden Track One Audio.wav
-rw------- 1 thomas thomas 46214492 2009-05-15 13:01 01. Bloc Party - Like Eating Glass.wav
-rw------- 1 thomas thomas 38838620 2009-05-15 13:02 02. Bloc Party - Helicopter.wav
-rw------- 1 thomas thomas 41531660 2009-05-15 13:03 03. Bloc Party - Positive Tension.wav
-rw------- 1 thomas thomas 35519948 2009-05-15 13:03 04. Bloc Party - Banquet.wav
-rw------- 1 thomas thomas 29480012 2009-05-15 13:04 05. Bloc Party - Blue Light.wav
-rw------- 1 thomas thomas 36928796 2009-05-15 13:05 06. Bloc Party - She's Hearing Voices.wav
-rw------- 1 thomas thomas 46854236 2009-05-15 13:06 07. Bloc Party - This Modern Love.wav
-rw------- 1 thomas thomas 37977788 2009-05-15 13:06 08. Bloc Party - The Pioneers.wav
-rw------- 1 thomas thomas 45809948 2009-05-15 13:07 09. Bloc Party - Price of Gasoline.wav
-rw------- 1 thomas thomas 41082428 2009-05-15 13:08 10. Bloc Party - So Here We Are.wav
-rw------- 1 thomas thomas 41846828 2009-05-15 13:08 11. Bloc Party - Luno.wav
-rw------- 1 thomas thomas 44151788 2009-05-15 13:09 12. Bloc Party - Plans.wav
-rw------- 1 thomas thomas 50010620 2009-05-15 13:10 13. Bloc Party - Compliments.wav
-rw-rw-r-- 1 thomas thomas 1769 2009-05-15 22:33 Bloc Party - Silent Alarm.cue
-rw-rw-r-- 1 thomas thomas 1002 2009-05-15 16:27 Bloc Party - Silent Alarm.m3u

Notice the first file - it's the hidden track one audio. The .cue file references it properly as well. The metadata is retrieved from MusicBrainz (that got added some night last week), and the files are named according to a template (I'm still not sure I like having the track number in my file names, but a certain site demands it). The files match the AccurateRip database, so this rip is basically as good as you can get with EAC. CDText and ISRC codes also get written to the .cue file (although this particular disc doesn't have CDText).

Things still left to be done, in no particular order:

  • write a command-line frontend
  • write a GUI
  • have the second step of the read-and-verify task encode directly to flac (or another lossless format)
  • write out a log file (involves interpreting cdparanoia's stderr-progress output, which looks a little tricky
  • add code to allow choosing a device
  • add some kind of config file so that, for each device (by name), an offset can be stored

That's quite enough for tonight. Hopefully I feel better tomorrow.

first complete accurate rip

Filed under: Hacking,Music,Python — Thomas @ 19:00

2009-05-05
19:00

After a weekend full of refactoring code, adding tasks, and putting pieces together, combined with last night's airplane session, I have my first AccurateRip-verified rip done:


[gst-git] [thomas@level trunk]$ PYTHONPATH=$PYTHONPATH:`pwd` python examples/readdisc.py --offset 6 --table-pickle=peel1.table.pickle --toc-pickle=peel1.toc.pickle
Ripping track 1
Checksums match for track 1
Ripping track 2
Checksums match for track 2
Ripping track 3
Checksums match for track 3
Ripping track 4
Checksums match for track 4
Ripping track 5
Checksums match for track 5
Ripping track 6
Checksums match for track 6
Ripping track 7
Checksums match for track 7
Ripping track 8
Checksums match for track 8
Ripping track 9
Checksums match for track 9
Ripping track 10
Checksums match for track 10
Ripping track 11
Checksums match for track 11
Ripping track 12
Checksums match for track 12
Ripping track 13
Checksums match for track 13
Ripping track 14
Checksums match for track 14
Ripping track 15
Checksums match for track 15
Ripping track 16
Checksums match for track 16
Ripping track 17
Checksums match for track 17
Ripping track 18
Checksums match for track 18
Ripping track 19
Checksums match for track 19
Ripping track 20
Checksums match for track 20

CDDB disc id 21115314
AccurateRip URL http://www.accuraterip.com/accuraterip/c/2/c/dBAR-020-00362c2c-031aaa3e-21115314.bin
2 AccurateRip reponses found
Track 1: rip accurate (confidence 11 of 17) [b29a0c41], AR [b29a0c41]
Track 2: rip accurate (confidence 11 of 17) [2ee8800e], AR [2ee8800e]
Track 3: rip accurate (confidence 11 of 17) [9f2dbab2], AR [9f2dbab2]
Track 4: rip accurate (confidence 11 of 17) [467010a7], AR [467010a7]
Track 5: rip accurate (confidence 11 of 16) [f5b0c850], AR [f5b0c850]
Track 6: rip accurate (confidence 11 of 16) [679dbc4c], AR [679dbc4c]
Track 7: rip accurate (confidence 11 of 14) [feddbbef], AR [feddbbef]
Track 8: rip accurate (confidence 11 of 16) [f46adb28], AR [f46adb28]
Track 9: rip accurate (confidence 11 of 16) [cac7a069], AR [cac7a069]
Track 10: rip accurate (confidence 11 of 16) [3f3a1521], AR [3f3a1521]
Track 11: rip accurate (confidence 11 of 16) [80fb00b4], AR [80fb00b4]
Track 12: rip accurate (confidence 11 of 16) [f1534ce2], AR [f1534ce2]
Track 13: rip accurate (confidence 11 of 16) [5953768f], AR [5953768f]
Track 14: rip accurate (confidence 11 of 16) [6e6c2a7e], AR [6e6c2a7e]
Track 15: rip accurate (confidence 11 of 16) [24d519a4], AR [24d519a4]
Track 16: rip accurate (confidence 11 of 16) [21509f9e], AR [21509f9e]
Track 17: rip accurate (confidence 11 of 16) [3e4be9f8], AR [3e4be9f8]
Track 18: rip accurate (confidence 11 of 16) [16ff964f], AR [16ff964f]
Track 19: rip accurate (confidence 11 of 16) [6db5f2b1], AR [6db5f2b1]
Track 20: rip accurate (confidence 10 of 16) [bb898cec], AR [bb898cec]

This version does full index scanning (gap detection) using cdrdao, read and verify using cdparanoia and an offset, .cue file writing (non-compliant .cue, which means gaps/index 00 are appended at end of previous track), and AccurateRip verification.

It doesn't do Hidden Track One Audio ripping yet (which will now be easy to add, but I forgot to bring a CD that actually has a HTOA to test with), doesn't do any kind of metadata lookup (so tracks are named track%02d.wav), no encoding to other formats, and no log file generation.

But those are the easy parts...

The Art of the Rip

Filed under: DAD,Hacking,Python — Thomas @ 10:40

2009-05-03
10:40

While I'm working on the ripping software, I find myself going back and forth between various references to figure out the small details and the pieces that subtly get interpreted differently between them. As is the case with other projects, I can easily see myself forgetting about these details soon, and cursing myself a year from now for not having written down my clear understanding of today.

So, in an effort to appease my future self, I've started writing down a condensed form of the important information I've come across.

On that page, I'm also comparing various ripping programs and how they handle the various details I consider important for correct ripping. I'll use that information and that chart as the basis for the features of my ripping program.

I'm trying to stay as objective as possible on that page, so feel free to tell me about mistakes, omissions, software I should be adding, ...

By now, I have a good set of goals for my ripping program:

  • lossless ripping
  • accuracy is the number one goal
  • speed is always second to accuracy
  • hands-off one-click/command ripping
  • separate ripping from metadata fixing
  • rip hidden track one audio automatically

With this in mind, I thought yesterday how I could figure out the drive's read offset the way EAC does it. I've come up with a simple program that:

  • checks if the current CD is in the AccurateRip database
  • if it is, rip the first track with various offsets
  • if any of the AccurateRip checksums match, that is most likely the offset for your drive

It took longer to test the program than to write it, since my AccurateRip checksum calculation is currently done purely in Python and thus rather slow.

In any case, using Bat For Lashes' "Fur and Gold":

[gst-git] [thomas@ana trunk]$ PYTHONPATH=$PYTHONPATH:`pwd` python examples/ARcalibrate.py
CDDB disc id 8a0aa10b
AccurateRip URL http://www.accuraterip.com/accuraterip/9/f/f/dBAR-011-00112ff9-00976269-8a0aa10b.bin
4 AccurateRip reponses found
ripping track 1 with offset 46
AR checksum calculated: b880421e
ripping track 1 with offset 47
AR checksum calculated: 4a29a173
ripping track 1 with offset 48
AR checksum calculated: 903b390e
MATCHED against response 3
offset of device is 48
ripping track 1 with offset 49
AR checksum calculated: e7c008f1
[gst-git] [thomas@ana trunk]$

I made the program scan from 46 to 49, knowing that my drive has a +48 read offset. Now I'm going to add an option to choose the range, an option to start with the most common offsets, and think about including using online databases of drive features to start with the one most likely to be correct for your drive.

Hidden Track One Audio: check

Filed under: Hacking,Music,Python — Thomas @ 21:01

2009-05-01
21:01

After another day of on-and-off hacking, wrapping cdrdao and cdparanoia binaries in my task interfaces I mentioned before, I inserted a CD by Bloc Party called 'Silent Alarm', ran a command, and saw the following output on my screen:

[gst-git] [thomas@ana trunk]$ PYTHONPATH=$PYTHONPATH:`pwd` python examples/readhtoa.py
Found Hidden Track One Audio from frame 0 to 15220
runner done
Checksums match
[gst-git] [thomas@ana trunk]$ ls -l track00.wav
-rw------- 1 thomas thomas 35797484 2009-05-01 21:56 track00.wav

I'm going to guess this is the first piece of Linux code that is able to automatically find and rip the hidden track at the start of a CD. (Feel free to correct me using your choice of alliterative insult if I am wrong!)

It's time to start collecting all my new-found wisdom in something more permanently written down, but that will be for tomorrow.

« Previous PageNext Page »
picture