[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

Music

Filed under: Dave/Dina,Elisa,Hacking,Music — Thomas @ 19:29

2009-04-14
19:29

Six years ago, before I moved to Barcelona, my digital music collection was well-organized and simple.

I had my CD's. And I had a copy of all of them, in Ogg, on my Dave/Dina box. I had very few downloaded tracks, and I didn't really listen to those much. All my music on Dave/Dina was tracked in DAD, a project I did with my former housemate Kristof.

Life was great. Every new CD was ripped directly in Dave/Dina, imported in DAD, and from there it could be rated. So each track was immediately available for the dynamic playlists DAD generated. Those playlists were then played directly on the Dave/Dina box attached to the living room stereo, my desktop, or the kitchen or bathroom computers (small Compaq IA1 machines from the Golden Bubble days).

Today, it's all a mess.

I have music (ripped, bought online, downloaded, or copied) on the following devices:

  • My elisa machine (which holds all the old Dave/Dina content)
  • My home desktop
  • My laptop
  • My work desktop
  • My Nokia N800
  • My Cowon A3 media player
  • Kristien's iPod

I haven't ripped a single CD in the last 4 years since I stopped working on Dave/Dina, so these days I also listen to CD's on either our small portable stereo or the PS3. I have 200+ CD's still waiting to be ripped.

So my music listening has become erratic, listening to either the old 'good' playlist from Dave/Dina that hasn't changed for the last 6 years, and, while good, is getting stale; or whatever I recently ended up downloading, for a specific album, but random play is terrible when going through those directories, and of course each album is on some different machine or device.

The last two years, I've grown more and more annoyed at this situation. So one of my goals for 2009 was to finally *do* something about it. I realize that music is one of the things I love most in life, and my life would be better with the music I buy and find in it as soon as I have it. So what little hacking time I have left before real life begins (you know, kids and stuff) is going to go in code that is going to make my music experience better.

Having goals is a good way to direct your hacking. I've come up with five major projects I need to work on to get my music where I want it to be. All of these are projects I've had thoughts on in the past, but never really gotten to. Over the last few years a lot of new ideas and technologies have arrived that would help a lot now however.

  1. Re-rip all my CD's in a lossless format, with perfect quality, according to a certain website's standard
  2. Find a replacement for DAD, or make one. It should be able to track rips, tracks, different encodings of the same recording, different versions of tracks, parts of tracks (hidden tracks for example), and different collections across devices that it should be able to synchronize. Think 'put 10 GB of the best songs on my N800', and each time I'd connect my N800 it would automatically add new ones and remove old ones.
  3. Improve on the rating system DAD used to have, reusing ideas from a project at the radio stations all those years ago. Have a bunch of fuzzy parameters on each track which would allow much richer controls for song selection. Possibly turn it into a collaborative website if it makes sense. This hinges on uniquely identifying each track, for which acoustic fingerprinting would be a good solution. Basically, I want to use the power of the web and the music lovers to improve song selection. last.fm and pandora are going in the right direction, but don't really satisfy me.
  4. Write a player that does the automatic mixing the way Dave/Dina used to, or better.
  5. Make a LEGO Mindstorms robot to automatically rip all my CD's again

I've been tackling each of these separately, which turned out to actually be a good thing. Each time I'm stuck on one of them, I can work on any of the others. For example, I've been stuck on (4) for a long time, waiting for Edward to fix some bugs in gnonlin, so I switched to (1), writing code to parse .CUE files, implement CDDB disc id calculation, and AccurateRip verification of ripped images.
I also waited on a friend who I worked with at said radio station to confirm that he doesn't have any backups either of the database for (3).

Since this is what I'll be hacking on in my spare time in the forseeable future, I'll probably blog about the different pieces as well. I'll start with some more technical information on (1), the ripping part, which I've been working on the last month, in a separate post.

But man, I look forward to ripping my CD's from the last four years and actually listening to those songs regularly, rather than once in a while.

Isn't it amazing how our parents actually had to get up from their desk, go over to the turntable, and actually flip an LP over if they wanted to hear something else for 20 minutes ?

SAlsa

Filed under: Elisa,Hacking — Thomas @ 10:35

2008-08-02
10:35

I'm sure the ALSA guys aren't doing this deliberately, but boy, is it ever not a painful exercise to set your mixer levels and controls correctly ?

Ok, arguably I have a quite complex onboard soundcard, but it's still an onboard soundcard. When you open up alsamixer and see all those labels that don't give you much information, you just get lost. Would it have been that hard for the ALSA guys to make it easier for driver developers to document their stuff ?

My particular onboard card is a VIA 8237 Realtek ALC850, and has coax and SPDIF output. It has controls like Center/LFE (but do they control analog or digital output ? who knows), IEC958 (how many people know that this is SPDIF ?) and IEC958 Output (though it is the former that controls SPDIF output, not the latter, go figure), there's Duplicate Front (I enabled it but strangely enough my computer did not pop out another computer front plate as I expected), and then there is VIA DXS, VIA DXS1, VIA DXS2, and VIA DXS3. And I left out at least two times more controls.

Today I finally figured out how to get my digital output to directly take the PCM data (the actual digital samples) instead of having the digital output take in the Analog Output. But it probably was the most non-obvious ALSA thing I've ever had the non-pleasure of having to do.

There is one control labeled IEC958 Playback AC97-SPSA, which is a level control with only 4 steps (0, 33, 66, 100%). Much like the Mic Input on some webcams I have. Strangely enough, that setting didn't ever seem to affect any volume in my experimentation, but hey, so don't most of the other level controls anyway, so I never looked into it further.

Today, upgrading my media machine from F8 to F9, my obtained-through-careful-random-experimentation asound.state didn't work on F9. So I set out to experiment again and this time, document my settings. Which is when I, completely by accident, tweaked this level control.

And, apparently, setting it to 0% makes the PCM setting on the following switch (IEC958 Playback Source) work and give me completely digital PCM output. Completely puzzled, I started Googling for this card and this setting, and found a close-enough wiki page documenting a previous model and saying this about the setting I tweaked:

f the playback device indicates a link is present, but makes no sound, check the mixer 'IEC958 Playback AC97-SPSA'. The S/PDIF always outputs at full volume - even muting the master or PCM mixers does not affect the S/PDIF volume. The meanings of the settings for 'IEC958 Playback AC97-SPSA' are

0. PCM1
1. PCM2,PCM1 (rear)
2. Centre and LFE
3. PCM3,Modem,Dedicated S/PDIF

Most users will want it set to 0 (PCM1). Some of the 82xx chips have a dedicated S/PDIF port, which is (I assume) accessed by setting it to 3 (Dedicated S/PDIF). The default appears to be 3.

I don't claim to understand much of that explanation, apart from the fact that this is obviously a switch between inputs or outputs and thus affects internal routing.

If I lost you by now, here's the one-line summary: this driver implements a four-state switch with a slider control. And it's not because he wasn't able to figure out switches either - the driver has 6 or more switches for other settings.

This is a control that is labeled such that you can't understand it, with a control that hides what it actually does and suggest it does something else, and controls whether your card works at all. Well done, driver developer guy.

I wish it were me, but hey, I'm an audio engineer, and I set up technical infrastructure for two actual radio stations. That complex 75k euro mixing desk was easier to figure out and program than this simple onboard sound card - and the mixing desk was only programmable in assembler!

I filed this bug - yet another notch on my totem of bugtracker accounts.

picture