This is my cyberhome!

October 15, 2010

How to fix gapless analysis problems in iTunes?

Filed under: Apple,Audio,Software — Manish Bansal @ 3:56 pm

The Problem:
If you use iTunes, on windows or mac, it is inevitable that you’d come across this dialog where iTunes says that it’s Determining Gapless Playback Information. It doesn’t matter whether you want your albums to play gapless or not. iTunes just goes ahead and does it. There is no way to turn it off. It would have been pretty harmless, except for one little thing – it often gets stuck and the only way out is to reboot your computer (and lose any unsaved data, not to mention the frustration caused). Though there is no way to turn this process off, there is a way to make it go smooth. The solution is to repair your corrupt MP3 files.

The Reason:
There are plenty of reasons for MP3 files being corrupt but the most common one is bad encoders. All the modern encoders are ok but those present during Napster era (late 90s and early 2000s) were really bad. So if you have any songs encoded during that period, chances are that they are not as per MP3 encoding standards. These songs would play just fine but otherwise cause a lot of problems in terms of tagging and gapless analysis etc. If you do a scan on your collection, you’d be surprised by the number of songs with potential problems. These kind of files are the reason iTunes gets stuck.

The Fix:
The fix is pretty simple, fortunately. All you need is foobar and a bit of time. Don’t worry. The songs will NOT be re-encoded or subject to anything else which might reduce their audio quality. These operations are completely harmless. You can take a backup in case you’d like to be really careful.

Ok, here we go:

  1. Download and install foobar. Make sure that you choose all the utilities and extras during the install.
  2. Launch foobar and go to ‘File -> Preferences -> Shell Integration’. In the right-hand side pane, enable the option ‘Folder context menus’. In the same pane, type ‘*.mp3’ for ‘Restrict incoming files to’. This will make sure that only MP3 files come into foobar as this fix is not applicable for AAC or WAV files etc.
  3. Go to your songs folder in Windows explorer, right-click and choose ‘Enqueue in foobar2000’. Or you and drag your songs folder to foobar.
  4. In foobar, Select all files, right-click and choose ‘Utilities -> Rebuild MP3 Stream’. This will recreate the MP3 file by removing all the non-standard data and other garbage. It will also fix the tags by rewriting them in a standard-compliant way. It took about 3 hours to fix 20k files on my aging PC. A nice side benefit of this fix is that a few more songs will now show up in your iTunes library because of standards-compliant tags.
  5. Once step 4 is over, select all files again, right-click and choose ‘Utilities -> Fix VBR MP3 Header’. This will add the missing VBR header data to the Variable Bit Rate files. The absence of this header causes problems in seeking and also in calculating the duration of song which impacts gapless analysis. This process also took about 3 hours on my somewhat old PC.
  6. This step is optional but I did it anyway. Clean up your iTunes library and add all the songs again. The only thing I care about is song ratings which I store in BPM field so I don’t lose them even if I clean up the iTunes library.
  7. Let iTunes go through ‘Determining Gapless Playback Information’. Typically it won’t get stuck now but there are chances that it still won’t like a few of the songs. The only fix for these songs is to remove them from iTunes library. In my case, I had about 1000 songs in a particular folder which were giving problems. These were the songs which I had converted from FLAC to MP3 a long time back, prehaps using a crappy non-standard encoder. I just removed these songs from iTunes, re-encoded them from FLAC using Lame and everything went fine.

Notes:
To validate your MP3 files, you can use a free program called MP3val. It can even fix some of the common problems.

November 21, 2006

A review of Westone UM1 IEMs.

Filed under: Audio — Manish Bansal @ 1:12 pm

I have been using Philips HP805 cans for over a year now and HP800 before that. The only thing I didn’t like about those phones was the lack of sound isolation. I had also heard lot of good things about IEMs in general (curse you head-fi) so I thought I would get a pair. These being my first IEMs, I didn’t want to spend too much. After spending countless hours pouring over reviews and sound quality analysis, Westone UM1s seemed to have the best balance of price and sound quality. I got them from earphonesolutions for $109.

Packaging and Box Contents:
They come packed in a very nice high quality plastic box. The included carry case could have been better though. It is made of strong clothlike material and is quite sturdy but gets squished when pressed hard. I like it but wish it were made of solid plastic or metal though.
It comes with 5 pairs of foam tips, a wax cleaning tool, a carry pouch, and some printed instructions. The phones are not packed in the pouch but have their own recess in the plastic tray. Impressive packaging overall.

First impressions:
These are one tiny pair of IEMs. I was surprised on seeing them for the first time. Did they send me the wrong phones? They looked much bigger in the photos! Did I just pay $100 for this tiny piece of plastic? Turned out many other people had the same impressions, esp. first time IEM buyers like me.
And the cable is very thin too. It’s braided type and almost like a thread. I started having doubts about its sound quality, coming from thick cables of philips HP805 headphones. Then I realized why it was so. These phones need very little power to operate. The soldering lead on my philips headphones looks bigger than the entire UM1 driver.

Build Quality:
They are so small and everything is so tightly packed in them that it acts like one solid piece of plastic. You can drop them, toss them around, and give them a beating and they would still work fine. Care needs to be taken for the tip though where foam is inserted. That is a small plastic pipe protruding from the main unit and could break under moderate force.

Comfort:
One of the reason that I went for these phones was the comfort. And I was not disappointed. I can literally forget that I am wearing them. There is no pain or fatigue even after hours of usage. And they don’t protrude out of your ear at all. If I wear them and look in the mirror (from front), I can’t see them! You can even sleep (on your side) while wearing them and not feel a thing.

Microphonics:
The UM1s have a very thin braided type cable which is extremely resistant to microphonics. They keep rubbing against my cloths and my office ID tag but never pick up any extraneous sound. Several people have this problem with some Shure and Etymotic models but UM1s are just fine.

My Setup:
iPod 5G (Apple lossless) -> Turbo dock -> Turbo mini-to-mini -> GoVibe 5 -> UM1

Sound Quality:
As with all IEMs, sound quality depends highly on the correct insertion and getting a proper seal. If the seal is not proper, these would sound muddy and won’t have any bass. So make sure that you insert them correctly before giving them a listen.
I typically use Chesky demo disc for making sound quality impressions ’cause I have listened to it countless times as part of headphone testing and know exactly what to expect. In fact, they tell you before each song what you should be listening for; a transcription of which can be found here. This would be my guide for judging UM1s. Just a note – The chesky demo disc is actually a SACD so the Redbook CD layer won’t be as detailed but it is still a very good reference.

  • High Resolution – Rebecca Pidgeon – Spanish Harlem
    Rebeca’s voice does sound real and you really feel that you can touch her. There are many times when her voice overpowers the shaker so you can’t really isolate its sound. The metal balls in the shaker move in a different pattern each time it is shaken and that’s what causes them to sound different. At the few places where shaker sound is prominent, each shaker does sound different from the one before it but this fact is not immediately apparent. You have to listen to it 3-4 times and even then the difference is not crystal clear. Though not extremely detailed, I would rate the UM1 resolution to be much better than average.
  • Depth – Sara K. – If I Could Sing Your Blues
    The trumpet that opens this song does sound distant and from slightly right to the stage. Sara’s voice sounds natural with just the right amount of reverberation. I could occasionaly hear the guitar pick but not too many times. The guitar is also full and warm but I could not judge the size of the studio. Not sure who is at fault here. Excellent performace by UM1 here.
  • Midrange Purity – Livingston Taylor – Grandma’s Hands
    There are 3 backup singers in this song and I could figure that out with UM1. But the finger snaps never had that flesh and bone quality to them. They sounded artificial to me. They sounded the same way on my philips HP805 too. Please let me know if your phones can reproduce it. Anyway, it is too much to expect this kind of timbre from such tiny and single-driver phones. Livingston’s voice does seem to have “chest” to it and sounds very real and human.
  • Naturalness – Ana Caram – Correnteza
    Excellent performance here by UM1. Ana’s voice sounds highly real, without any harshness or electronic gear. Mid-range is anyway the strongest point of these phones. The mids are neither too forward nor too recessed. They have just the right amount of laid-back quality that I enjoy.
  • Presence – McCoy Tyner & Joe Henderson – Ask Me Now
    No matter how much I listened to this recording, I could never hear the sound of the reflections off the rear wall. This just confirms that these phones are not too resolving. The mechanical sound of the keys was very clear though. The trumpet, at times, did not have the right timbre but it was still very much enjoyable.
  • Focus – Vivaldi, Flute Concerto in D
    I could easily pick out each instrument apart from the others. All the flute notes were distinct and quite clear, without any hint of blurriness.
  • Transients – Solisti New York – Stravinsky, The Royal March
    UM1 had no problem handling this piece. I think this quality is because of its tiny size and not inspite of it. The IEM driver displacement is extremely small when compared with the displacement of a full-size speaker diaphragm. So it has no problem starting and stopping with extreme precision. I do think the drum sound was not as tight as it could be but until there is a high-end system to compare against, I can not say decisively.

SQ impressions by frequency range:

  • Bass
    Track for bass tightness – “Hotel California” from “Hell Freezes Over”
    Track for bass extension – “Hero” (Jet Li) soundtrack by Tan Dun
    Very good, tight, and punchy bass. It doesn’t go as low as other high-end phones but it’s enough for normal music. Getting this kind of bass depends highly on having a good seal. If I turn up the volume slightly, I can get that chest thumping bass in Hotel California, right after the guitar intro. The bass is not too over-powering and not too diffuse, just the right kind.
  • Mids
    Strongest point of these phones. Absolutely no complaints here.
  • Highs
    This is the weakest point of these phones. There is a severe treble roll-off which makes them lose the details in the highs. I typically use “Latin” or “Treble booster” EQ on my iPod which helps a bit but still you feel something is lacking. This might be due to these being single-driver phones. On the plus side, this makes them non-fatiguing and you can listen to them for extended periods of time.
  • Soundstage
    Very good. I could easily make out the location of each instrument on several songs. On Sara K’s “If I could sing your blues”, the trumpet does sound distant and coming from the right side of the stage. On “Westmister Choir – Britten, Festival Te Deum”, you can really feel as if you are standing in a large cathedral. Impressive performance.

Conclusion:
These are currently among the best IEMs you can buy for $100. After reading about expensive UEs, Shures, and Etymotics, I was not expecting much but I was completely surprised by their performance. Highly recommended especially for the first time IEM buyers.

Credits/Links:

  1. UM1 first impressions
  2. Initial impressions on the UM1’s
  3. Westone UM1 VS Etymotic ER-6 Review
  4. UE SuperFi 5 Pro vs. Westone UM1
  5. UM1s not living up to expectations
  6. Why aren’t there that many UM1 Reviews?
  7. This review on head-fi

May 23, 2006

Kernel Streaming with iTunes.

Filed under: Apple,Audio,Software — Manish Bansal @ 5:36 am

iTunes is considered to be the best music organizer and foobar to be the best music player. But what if you could have the interface of iTunes but guts of foobar in one application? Enter Multi-plugin.

Here is what you’ll need:

  1. foobar (0.9.4) and Kernel Streaming plugin for foobar.
  2. iTunes (for Windows, ver 7.0.1)
  3. Multi-plugin (latest version is 2.4.2 as of September 22, 2006)

Install iTunes, foobar, and Multi-plugin. To install Kernel Streaming plugin for foobar, just copy the file “foo_out_ks.dll” to foobar components directory.

Run foobar, go to file-> preferences -> playback -> output and choose Kernel Streaming as the output method.

Run iTunes, go to Edit -> preferences -> Multi-plugin and make the following changes:

  1. Under “Appearance”, choose the default skin.
  2. Under “Other”, choose “foobar2000 passthrough”.

Now whenever you hit play on a song in iTunes, it would be played through foobar. This means that you get access to all the foobar DSP goodness too. Enjoy!

Notes:

  1. You might get the message “foobar not installed” when you enable “foobar2000 passthrough”. This happens because Multi-plugin looks for foobar information in the wrong place in the registry. It’s pretty easy to fix though. Just transfer the keys from “HKEY_LOCAL_MACHINE\Software\Foobar2000” to “HKEY_CURRENT_USER\Software\Foobar2000”.
    To do that, go to “HKEY_LOCAL_MACHINE\Software\Foobar2000” in the registry and choose File->Export. Then open the resulting *.reg file using notepad and change “HKEY_LOCAL_MACHINE\Software\Foobar2000” to “HKEY_CURRENT_USER\Software\Foobar2000”. Save the file and double-click. Done!
  2. You need to set the volume to maximum in iTunes to avoid any loss of quality because of attenuation.
  3. Even if you don’t notice any improvement in the sound quality, this would at least take care of the songs skipping in iTunes (a big problem in iTunes 7.x.x).
  4. You can not run both foobar and iTunes at the same time. Otherwise you’d get error “KS output error: error opening device”. In fact, you don’t have to run foobar to use Multi-plugin. iTunes would launch it automatically in the background.

Update on September 20, 2006:
Links now point to the latest version of Multi-plugin, 2.4.2.

February 14, 2006

A really sweet plugin for Yahoo Music Engine.

Filed under: Audio,Software — Manish Bansal @ 6:55 am

I am a big fan of Magnatune record label. They allow you to stream/download all of their catalog in 128 kbps DRM free MP3 files. It used to be a pain to browse the site and download though ’cause they didn’t give a direct link to the download page. You had to google it and then click on each and every file on that page. Not anymore.

Enter Web Media Browser plugin for Yahoo Music Engine by YMediaShare. It allows you to browse, queue, and download the Magnatune music directly from YME. No more hunting on Google. You can even queue up all the files you want and it will keep on downloading them in the background. And after downloading, the new music automatically gets added to your media library. Sweet! I was just about to swear off YME for good but this plugin has made me change my mind.

This plugin lets you do some more things also like Browse WebJay playlists directly from YME, download music from lots of different sources, rate them etc. But I am keeping it for the Magnatune thing.

February 10, 2006

How to rescan a folder in iTunes and keep song ratings.

Filed under: Apple,Audio — Manish Bansal @ 11:13 am

How to update/rescan your iTunes library if you have:-

Added new songs:
This was one of the most frustrating thing about iTunes. I would add a few songs to a folder which had already been added to iTunes but there was no way to tell iTunes to rescan that folder and pick only the updated songs. Every other jukebox software I know has this feature. Winamp even lets you schedule when you want to rescan the folder!
What did I know. This is actually simpler in iTunes. Just add the folder again to iTunes. If you have not moved the existing files from their previous location, have not renamed them, or done anything else to them, they would be ignored and only the new files would be added. All the old songs would maintain their playcount and rating etc. I regularly point iTunes to my top-level song folder and they get added just fine.

Updated tags outside iTunes:
I use GodFather to edit ID3 tags for my mp3s but since iTunes maintains its own database, the changes are not visible in iTunes. You can clean your iTunes library and add those songs again but you’d lose playcount and rating. The correct way to make those changes visible in iTunes is to select all files (using ‘Ctrl-A’), click on ‘Get Info’, and click ‘Ok’. iTunes will pick up all the tag changes without losing playcounts or ratings. Do NOT check any of the checkboxes for any of the tag fields. You’d nuke all your tags. Just click ‘Ok’ and it’d be done.

November 8, 2005

How to fix iPod Eq distortion.

Filed under: Apple,Audio — Manish Bansal @ 6:36 pm

The Problem:
iPod gives a somewhat harsh and metallic sound when the equalizer is turned on. It does not matter which preset you choose (except Flat). If you don’t keep the equalizer off, the sound comes out distorted and is not pleasant to listen to. It happens on all the iPod models, even on the latest 5G one which has the best sound among hard disc based models. The 5G fixes lot of problems with the earlier iPods like Noise Defect and comes with a number of improvements, especially in bass performance but the sound still clips with the equalizer.

The Reason:
There is nothing wrong with iPod. Really.

It has as good a sound as any other player. Though it sounds a little bright, the sound has lot of detail and really insignificant amount of distortion. Even the equalizer is well designed and behaves as it is supposed to. But that metallic sound? That clipping? Well, it’s a classic case of “garbage in garbage out".

It’s those damn mp3s. Or rather the original CDs themselves.

In a race to sound louder and louder, the CD mastering engineers push the recording level to its limits. This is especially true for mainstream pop/rock music. Somehow the producers think that the CDs have to be really loud to make a better impression.

Now when these hot mastered CDs (or mp3s made from them) are played with the equalizer on, the total loudness level goes beyond what an iPod can produce. Some of my mp3s had a loudness level of 99.6db!! Yikes! What can the poor iPod do when presented with this crap? Say I choose Dance preset which would typically apply a boost of 6 db. Add this to 97db (a typical figure) and you get a level of 103 db. Most players have an upper limit of about 95db, some even going till 100db but that’s it. No wonder the sound comes out distorted and harsh.

The Fix:
All we need to do is bring down the loudness level of the mp3s down so that we get a little headroom to apply the Eq. The generally agreed upon loudness level for this is 89db.

Download mp3gain. It’s an open source freeware program. Add the folder containing the mp3s. Choose ‘track gain’ and click on the ‘track analysis’. It will calculate and display the loudness level for each song and also how much correction needs to be applied. When this analysis is done, just hit ‘track gain’ and it will apply the required correction to each song.

Mp3gain does not re-encode or otherwise modify/degrade the file in anyway. All it does is set a flag in the file. When a player reads this flag, it knows how loud to play this song.

This whole correction process is a little slow. It took about one hour per GB on my Pentium 4 machine, 30 hours total for my entire collection. It’s the analysis part that is slow. The correction is instantaneous. So instead of hitting the analysis and waiting for 30 hours to do the correction, a better way to do this is to hit the track gain directly. It will analyze and correct in one step.

After all this is done, erase all the songs from your iPod, resync, and enjoy!

Notes:

  1. You can directly point mp3gain to iPod_control folder on the iPod but it is not recommended. You don't want that tiny hard disc on your iPod to be spinning continously for 30 hours. Moreover, if you do it on the PC, other mp3 players can also use this info.
  2. You can stop/cancel the track gain process anytime you want. Mp3gain will pick up from where it left when you start it next time.
  3. Mp3gain is more accurate at doing normalization than SoundCheck feature found in iTunes/iPod. Mp3gain is based on ReplayGain standard which takes into account the mechanism of how humans perceive loudness. Turns out that human ears use average energy over time to perceive how loud a certain sound is. So mp3gain divides each file into 50ms blocks and calculates the RMS energy value of each of these blocks. These values are then used to arrive at the overall RMS energy of the entire song. This is the value which is then used to normalize the song file.
    SoundCheck works in similar way but it seems to take much longer blocks (fewer samples) to calculate the average RMS energy. This makes it less accurate (but a lot faster) than mp3gain.

July 22, 2005

The ultimate Winamp setup guide!

Filed under: Audio — Manish Bansal @ 2:58 pm

When we call someone an "audiophile", we generally mean that the guy spends insane amounts of money on the audio gear. This is a wrong defintion, and a derogatory one too. To me, an audiophile is someone who is passionate about music. Who cares about music enough to invest in high quality gear. But it does not mean that we can't be audiophiles if we don't have all the high-end stuff. All it takes is right set of tools and a little bit of fiddling around.

A typical audio path looks like this:
CD –> Encoder –> Winamp (Decoder) –> DSP –> Kmixer –> Soundcard –> Headphones
Let's see what we can do to optimize each stage.

Encoder:
If most of your music comes from internet and other sources in MP3 form, there is nothing you can do about its quality. But if you rip the CDs yourself, read on. MP3/OGG/AAc sound great but why lose quality when you can rip to a lossless format. These lossless formats are really lossless. These are like winzip for audio. You get back the exact same data, with each and every bit intact. The lossless formats do take more space (5 MB for MP3 vs 25 MB for FLAC) but with harddisk space being so cheap, there is no reason to lose quality. The best and most popular foramt for lossless audio is FLAC. I use Yahoo music engine to rip the CDs to FLAC and this plugin to play it in Winamp. Even though a few of the portable audio players support this format, it is not yet widely available on DAPs. So if your player does not support FLAC and if DAP is your primary source of music, you'd be better off with MP3. Just make sure that you use a high enough bitrate (192 kbps or greater) and LAME to encode. Some people claim that AAC has better quality at same bitrates but I can't vouch for that. These are more like Nikon vs Canon debates.

Decoder:
The built-in MP3 decoder in winamp has been licensed from FhG which is pretty decent but not the best sounding one. We need something that can do dithering and noise shaping. I would use foobar but iZotope Ozone does not work with that. Fortunately, there is MAD plugin which does all this and it is free too. I must say that the difference in the decoders is very subtle and for the most part, insignificant. It is more of a purist thing. You should be ok with stock Winamp decoder.

DSP:
The next step in the chain is signal processing. This includes things like equalizer, normalizer, and other sound enhancing plugins. It takes a really good understanding of audio fundamentals to not screw up the sound with these things. You can either read tomes on this subject and try to play around with the settings yourselves. This is like using layers and masks and whatnot in photoshop to sharpen the picture where Photokit Sharpener can do a much better job at the press of a button. In other words, leave it to the pros. And the best DSP plugin for Winamp is by iZopte called Ozone. The basic plugin is free but it is so good that you'd never miss the pro version. I brings out the details in the music that you never even knew about. Especially in the mid and high frequency range. The music sounds more lus and the instrument separation improves to a remarkable degree. Listen to a well mastered CD like Gladiator or "The passion of the Christ" with and without this plug-in to fully appreciate it.

You don't need any other plugin with this, not even Winamp equalizer. I just leave the settings at default for both headphones and speakers. If you start experiencing listening fatigue on headphones, try switching to headphone preset. This mode adds a little crossfeed and HRTFs to make you feel as if you are listening to speakers. Or if you don't like too much zing in your music, try the preset with less sparkle. I found that default mode gives me the purest sound. Just play aroud with different presets and see what you like.

To use iZotope Ozone with foobar, you can use bridge DSP plugin for Winamp. This allows you to use DSP plugins written for Winamp in foobar.

Kmixer:
The signal coming out of DSP goes into a Windows component called kmixer. All it does is mix different audio streams so that two or more applications can play back audio at the same time. It does something else too. It resamples everything to 48 KHz (the native audio data is at 44.1 KHz) which results in a slight loss of quality. We can bypass this thing by using an output mode called 'Kernel Streaming'. It is more of a hack (experimental feature) to support applications that need very low-latency. This plugin does not support buffering (as of now) so the music might skip if you use your PC too heavily while Winamp is running. It should be fine for normal use though. In case you are not happy with KS, use directsound for Win 2K and XP and waveout for Win98/ME.
Update(Mar 04, 2005):
The updated version of kernel streaming plugin can be found at Steve Monk's homepage. It supports buffering for both input and output now.

Soundcard:
This is one of the most misunderstood pieces of hardware. Everyone knows that a Geforce4 is better than Geforce2 video card. You get much better frame rates and almost realistic texture. But a better soundcard? What could a better soundcard do? Play music faster?

Explaining what a good soundcard can do is like explaining color to a blind person. You have to listen to a good setup to really appreciate it. Try not to buy a Creative soundcard. These cards have been optimized for gaming with EAX effects and other 3-D trickery. You want a card built specifically for audio. Chaintech AV-710 and M-audio revolution cards are cheap and one of the best in this category.

If nothing else is available, Creative Soundblaster is a pretty decent solution. Just make sure that you turn off all the so called sound enhancing settings in the soundcard driver.

Headphones:
Much of what has been said about soundcards applies to headphones too. In fact, having a better headphone is more important than having a better soundcard because ear drums are a precious thing. Once damaged, they stay that way. Better buy a decent headphone and treat them nice.

A word of caution: Do not go overboard in trying to get better sound. Do not give the term audiophile its common misunderstood meaning. Listen to the music for music and become a real audiophile.

Peace!

June 15, 2005

How to simulate speakers on the headphones.

Filed under: Audio — Manish Bansal @ 12:24 pm

One of the reasons that we have two ears (or two eyes) is that it allows us to experience this world in three dimensions. We can see just fine with one eye but we need two eyes to gauge the depth of the scene. Similarly, two ears allow us to have spatial hearing. I.E we can localize the source of the sound. We can figure out whether the sound is coming from left or right, from up or down etc.

Say we are listening to some music being played on a speaker. Typically, the sound from the speaker would reach one of the ears earlier than the other (far) ear. This is because our ears are separated by about 10 inches and sound has a finite velocity. This time difference is called Interaural Time Difference (ITD) and is generally in microseconds. And the ear closer to the speaker would receive the sound waves directly, making the signal level at this ear slightly stronger than the far ear. This difference in level is called Interaural Level Difference (ILD). Together, ITD and ILD allow us to localize the azimuth (angle in the plane) of the sound source. These are also called binaural cues since these involve both the ears. We cannot determine the elevation of the sound source using just these cues though.

The sound that comes out of the speaker and the sound that we hear are not the same. Several things affect the sound before it can be heard by us. The distance of the speakers from the ear, shape of our head, the structure of our outer and inner ear, the angle at which the sound waves strike the ear, indirect sound from reflections off the walls etc. All these influences on the sound waves are collectively called as head related transfer functions (HRTFs). Mathematically, HRTF is the impulse response of the medium that carries the sound. These HRTFs allow us to determine the elevation of the sound source. These are also called monaural cues.

But what happens when both ears receive the same level of sound at the same time and there are no external influences on the sound? Since both ITD and ILD are zero and HRTFs are absent, there is no information to localize the sound. So the sound seems to come from the center of the head. This is what happens with the headphones. Our brains loses all its localization clues and constantly tries to figure out where the sound is coming from. This results in fatigue and uneasiness, the extreme case of which happens when we listen with only one headphone (right or left). Speakers, on the other hand, sound much more natural and pleasant since brain has all the information needed to figure out the spatial location of the sound. And all the music itself is recorded in such a way that it would sound most plesant when played back on speakers only.

So if we have to simulate the speakers on the headphones, all we have to do is make ITD and ILD non-zero and introduce some HRTFs and we are set. One of the best Winamp plug-ins to do this is Speakers Simulator by Vladimir Kopjov.

Interaural level difference (ILD):
When listening to speakers, both ears receive the sound from both the speakers. But in case of headphones, left ear receives the sounds only from the left channel and right ear receives the sound only from the right channel. To simulate this on headphones, we have to take a bit of left channel and send it to right ear and vice versa. This is called ‘crossfeed’. Its value varies from 0 to 80% in the above plug-in, default being 70%. The higher the crossfeed, the stronger the localization but lesser scene width.

Interaural time difference (ITD):
The sound coming from, say, left speaker would reach the near ear earlier than the far ear. To simulate this in headphones, the signal that is cross fed is also delayed by a small amount, the delay being roughly equivalent to what would be realized in practice. In the speaker simulation plug-in, the default setting for delay is 113.38 microsecond. More delay gives more scene width but less focus. If increased too much, this delay can cause some sound artifacts.

Head related transfer functions (HRTFs):
This is one of the most difficult parameters to measure because of interaction of so many different factors and different head/ear structures in different people. Lord Rayleigh modeled it assuming our head to be a perfect sphere and using wave propagation equations along a curved surface. The results show that the high frequencies get attenuated much more as they travel than the low frequencies.
Though they are mathematically complex, the HRTFs are really easy to simulate. All we have to do is make the high frequencies roll off gradually and we’ll get the same effect as the speakers. And unless your headphones cost $500 or more, it already has this desired frequency response (it is not so by design but rather from a desire to keep the costs down). So just make sure that the equalizer in winamp is flat for high frequencies. My Winamp equalizer looks like this.

The effect of speaker simulation plug-in is very subtle. It doesn’t seem to have much effect in beginning, but after a few hours of listening, the difference is clear as day and night. And, of course, it is much more pleasant this way and you can listen for longer periods of time without having any fatigue.

Credits:

  1. Sound Localization Using Head Related Transfer Functions
  2. Speakers Simulator plug-in
  3. Sound localization on Wikipedia
  4. Comments by Chris on HydrogenAudio forums

Update:
After trying out various other plug-ins, I have finally settled on 4Front Headphones. It does not apply as much equalization as Speaker Simulator so the sound is more or less unchanged. It also gives much better stereo imaging and puts the sound directly in front of you. The default setting of 30% gives a very distorted and artificial sound but at 10%, it sounds superb.

May 25, 2005

What is a Parametric Equalizer and how to use it on Rio Karma.

Filed under: Audio — Manish Bansal @ 11:46 am

In it’s simplest form, a speaker is just an energy conversion device. It converts electrical signals to sound waves of various frequencies. Ideally, all the frequencies in the speaker output should be at the same level of loudness. If we plot the frequency repsones curve of such an ideal speaker, with frequency (in Hertz) on x-axis and loudness (in Decibals) on y-axis, it would be a flat line at 0db. But such ideal speakers don’t exist. It’s really really difficult to construct such an ideal device. Even if it could be built, it would be too expensive to be practical. That means that we are stuck with ordinary speakers that don’t sound so great, atleast not without some tuning.

The frequency response of an ordinary speaker looks like the outline of a mountain. I.e. the low and high frequencies are not amplified as much as the middle ones. My Sennheiser MX500 headphones have this frequency response, taken from Headroom:

The sole purpose of an equalizer is to compensate for this bias in the speakers. It brings all the frequencies to the same level of loudness. In other words, it equalizes them and hence the name “Equalizer”.

Equazliers on sotware based players (Winamp, iTunes etc.) are typically 10-band and those on digital audio players are typically 5-band. A typical 10-band equalizer:

The frequency shown under each bar is called the center frequency. Just as there are no ideal speakers, there is no ideal equalizer either. I.e. instead of being a straight vertical line, each of these bars is more like a bell. And the range of frequencies falling under this bell is called a frequency band. So a 10-band equazlier can amplify/attenuate 10 separate, but overlapping, frequency bands. Because these bands extend to some distance on either side of center frequency, boosting the center frequency actually boosts this whole band, with the effect being maximum at the center frequency.

In a normal equalizer, the only thing that a user can control is the amount of amplification for each band. But in a parametric equalizer, in addition to the amplification, you can also change the center frequency and the width of each band. This additional level of control comes in handy when matching a pair of headphones to a particular device. I have set the Equalizer on my Rio Karma as:

Center frequencyuency Gain Width
12000 Hz +6.0 db 4.0 octaves
2500 Hz +0.0 db 4.0 octaves
500 Hz -2.0 db 4.0 octaves
150 Hz +6.0 db 4.0 octaves
40 Hz +8.0 db 4.0 octaves

This setting makes MX500 give an almost flat response when used with Rio Karma. The nice player that the Karma is, it offers 3 custom equalizers. So I have set the other one to match my Philips HP800 cans (Based on subjective tests, since I could not find the frequency response curve for it).

To match your headphone to Rio Karma, you need the frequency response curve of Rio Karma and a way to see how your headphone and Rio karma interact at various equalizer settings. This is exactly what John M has done with his KarmaEQ application. But the headphone response curve given by headphone.com is not usable as it is. It has to be converted to a text file having frequency-gain pairs. There are many examples of this on John’s site. I created a file with 30 sets of frequency-gain pairs for Sennheiser MX500. The values don’t have to be highly precise. Just a simple eyeballing would do.

Now all that you have to do is import your headphone response file in the KarmaEQ and start experimenting. The idea is to have the resulting curve as flat as possible. When you are satisfied with the results in KarmaEQ, try that in Rio Karma and see how it sounds. Since sound quality is a subjective thing, the flat curve may not be up to your liking. But take that as the starting point and explore from there on. Happy EQing.

Update:The HydrogenAudio thread on this post contains lot of interesting points on the differences between listening on headphones and listening on speakers. A highly recommended reading. Also my Rio Karma is dead :-(. I did everything I could but it just won’t boot. Well..

May 12, 2005

Why iTunes worked and why Yahoo music would work too!

Filed under: Audio,Opinions — Manish Bansal @ 11:27 am

Yahoo annoucnes it’s music store.

Way back in 1998, when I started collecting digital music, I used to use Windows Explorer to organize my music and Winamp to play it. It was not the best of setups but I didn’t know any better; Until i got an iBook.

The organization scheme used by iTunes completely blew me away. I actually spent 3 days cleaning up all my ID3 tags just so that I could use iTunes. It was that good. Just type a few letters and the song is there. No more mucking around with folders here and there and remembering where you put what. When iTunes for Windows was released, I made it my default player. Even though Winamp 5 has it’s own media library which works similarly, it’s no match for iTunes’ interface.

Now, iTunes for windows is a 20 MB download but I didn’t mind in the least. I just had to have it. The fact that I could buy songs through it was last thing on my mind. And that’s exactly why iTunes music store is such a success and so would be Yahoo music. If you want to buy songs from any online music store, you need a special software, which is different for each store! Imagine Amazon.com and BN.com each asking you to download 20 MB big software just so that you could buy books from them! Whereas you can buy books online using just your browser, you can’t buy music that way. No special software, no music. So how do you get people to download your special software? You do it the Apple way.

You make it so damn good that they start using it for their personal use, without any obligation to buy any stuff from you. The keyword here is “good”. I didn’t download iTunes to buy music. I downloaded it to organize the music that I already had. And that’s where Real and other stores fail. Their software is designed to make it easy for you to buy music, not to organize your existing collection. You can, of course, use it for that purpose but it is torturous to use. And this is where Yahoo gets it right (as did Apple). Infact, their music player is almost a copy of iTunes but with certain new features. It can play and encode OGG and FLAC, in addition to AAC and MP3. It has a UNIX-style shell. It supports open XSPF playlist format. How much more geeky can you get? It lets you share music through Yahoo Messanger and burn CDs. It even supports iPod for non-DRM files.

Being a beta release, it is missing a few things like an Equalizer and is quite slow to load. The best thing that I personally like about Yahoo music engine is that it supports FLAC format (playing and encoding) right out of the box. Since I rip all my CDs in FLAC and iTunes does not support it, I an switching over to YME. But I’ll keep Winamp around just in case and, of course, my trusty foobar2000.

Update 1:
I just ripped a few CDs using YME to FLAC format and the tags it fetched for those songs were the best I had ever seen. All the fields (song title, singer, album etc) were nicely formatted, with proper cases. I tried the ripping the same CDs in EAC and the freedb tags just made me cringe. All CAPS, wrong titles, and incomplete information. I guess YME fetches the tags from its own database instead of freedb. Well, one more reason to use YME.

Update 2:
I am really disappointed at the pace at which YME is being developed. There is still no equalizer, there are hardly any plugins, and there are some weird bugs in it. It cannot “see” an audio CD unless I login as Administrator. iTunes can read the same CDs just fine with a normal user account. It also shows Nero CD burning plugin as a removable device!

The weirdness does not end here. Turns out that YME uses Windows Media Player (or a part of it) in the background to play music. I think it is limited to just protected WMA files but I am not sure. The problem is that it even uses the graphic equalizer settings of Windows Media Player! So if you are not happy with the sound, YME help pages recommend to turn graphic equalizer off in WMP. How much more un-intuitive can you get?

Update 3:
Even though there is no built-in equalizer for YME, you can still use the equalizer on your soundcard. Some on-board soundcards (mostly found in corporate PCs) may not have one but otherwise every decent soundcard should have it. My Creative Soundblaster has a really good 10-band equalizer. And the nice thing about using soundcard EQ is that it is not limited to a particular player. It would work the same whether you use Winamp or Yahoo Music Engine.

Update 4: (Feb 13, 2005)
A new version of YME is out. Still no luck with CDs. Still no equalizer. It is now taking 77 MB of memory even if I am not playing anything! It does have some new features but nothing of interest to me (I do not buy songs from them). Disappointment again.

Next Page »

Create a free website or blog at WordPress.com.