Wednesday, January 21, 2009

Kirk's compression test

I have a nagging doubt about the way I have carried out this test as three of us were really unable to find much difference between the files.

The files on my computer, as downloaded from Kirk's file, are wav files. I can play these on my computer.
If I record these onto a CD they do not play in my CD player. It shows the tracks playing but I cannot hear anything.
On the CD I was testing these have been converted to .cda files by my CD-making programme Roxio.

Kirk has told me that if I use I-tunes to make a CD they become .mp3 files and they are all at the same compression rate so they will all sound the same. Is this equally true of cda files? If so it invalidates the test.

I would like to know how the rest of you are doing this.

17 comments:

  1. "Kirk has told me that if I use I-tunes to make a CD they become .mp3 files and they are all at the same compression rate so they will all sound the same. Is this equally true of cda files? If so it invalidates the test."


    I sure hope that's true...

    because I did use iTunes to make my CD (I've not made the second CD which is part of the reason I've been held up in my comparative listening)... and I've not heard any significant (or simply: any) difference between the files. [I didn't do "side-by-side bursts", but still, I would have thought I'd hear something... for example in the ambience after the end of the Bach cantata, or during the oboe-key clicking in that cantata...]

    ReplyDelete
  2. I completely agree - something didn't seem right to me, as I can generally hear some difference between my son's 128 downloading and my 320 files, but here there simply didn't appear to be any difference at all. I used iTunes then Windows Media Player, and they really did all sound the same - honest !

    ReplyDelete
  3. I'm a cheapskate and didn't make a CD, but played the files direct - one at a time over RealPlayer. I find this is the only way I can play files derived from iTunes. My mate Graham of Leeds sends ripped music to me in this way, and so I already had my routine up and ready: and yes, using Grado headphones I could hear differences. These can be very subtle, and even going back to do relative comparisons there would often be more than one which might have been a candidate for the 'original' version. Sometimes it's just an apparent difference in colouration or spectral emphasis, which would mean knowing the original to be absolutely sure.

    ReplyDelete
  4. Interesting, because as someone who has also believed (or deluded himself) that compressed music sounds different I had the same response as everyone else. I'm no expert but I wondered whether there is something in the conversion to .wav files that masks the difference between the samples?

    The auditory memory is a strange thing and I couldn't help wondering whether hearing, say, a recent, high-quality recording and then being asked to identify rips thereof would make more sense. I'm not suggesting that Kirk's methodology is flawed; it's just that I'm really puzzled I couldn't even identify the lowest bit rate with confidence when a side-by-side comparison of a Mahler recording as a CD and as a 320 MP3 file did indeed sound very different to me.

    Is it purely psychological, and our ears/brains adjust to the expectation of fewer bits? I listened several times to the files via iTunes using a good-quality sound card and headphones and made my selections then and there. I didn't feel listening via my SACD player would yield any significant aural clues so didn't take it any further.

    I await the results with interest (and some trepidation).

    ReplyDelete
  5. Kirk's suggestion is
    Add them to iTunes in a new playlist. Click the Burn Disc button,
    then, in the window that displays, choose Audio CD.

    But that is where I first started and that gives .cda files. There seems to be no way round this. I wounder if this is a Mac vs PC problem

    Len

    ReplyDelete
  6. I'll see now if anything is different if I use headphones appropriate for the sound card outlet (Etymotics) and listen to the .wav files directly. Koopman's Latin Masses will have to wait. :-)

    ReplyDelete
  7. I've just had an interesting conversation with a friend who is well-versed in these things and he pointed out that contrary to what I expected it's the middle frequencies rather than the extremes that tend to identify variations in bit rates. Apparently those of us who are 40 and over (I'd guess that means most of us) are less discriminating here, which is perhaps why we are struggling with this test.

    ReplyDelete
  8. I'm confused now... did, or didn't, burning CDs off the iTunes files invalidate the test-non-results (as taken from those consequent CDs)?

    ReplyDelete
  9. Well that is the question I am posing. I-tunes converts the files from wav to cda (CD Audio). wav files on a Cd do not load up in a cd player whereas cda files do so clearly there has been a change. Also we cannot hear any clear differences between these files whereas those using headphones on a computer and listening to wav files think they can. So my guess is that it has invalidated the test just as if the CD had been made using mp3 files. I am no expert in this area so base that purely on what I hear. I think it puts a question mark over the disemmination of these files by CD.

    So what about those who download commercial files onto their computer? Presumably if they pop these into an i-pod they would still hear the benefit but if they stick them on a CD do they lose that enhancement? I merely pose the question.
    Len

    ReplyDelete
  10. I simply played the files off my computer using Windows Media Player (WMP) and a cable to connect to the amplifier of my stereo. I presume therefore that I was listening to exactly what Kirk prepared and, like Dominy, I do think that marginal differences in sound were audible. However, I am not at all confident that I will have been able discriminate between them consistently according to the bit rates.

    I know nothing about iTunes and cannot answer Len's question but there seems to be some confusion here. I don't think there is any question of "enhancement" but less “loss” at higher bit rates. If you download a commercial mp3 file and burn it to CD (as I have now done quite a bit, mostly using WMP) a conversion process is involved but I understand that you basically get a straight copy of the sound file i.e. further no compression is involved. What is already lost cannot be put back so I think the test should stand if you use Windows Media Player (which is present on all Windows based computers). I just burnt a CD from Kirk’s files using it and it plays OK on two different players so I would suggest that this might be a way forward.

    ReplyDelete
  11. I have now received two lots of information to the effect that a .cda file is just an indexing system and that the music tracks will be unaffected. So this test IS valid if a CD is made from Kirk's files. In that case the results were most intersting!

    Len

    ReplyDelete
  12. Let me assure you that converting back to WAV _does not_ nullify the compression. Once the files are compressed, you can't go back again. Converting them to WAV is just the same thing as burning CDs from compressed files: anything that is "missing" in the compressed files will remain missing from the WAV files.

    As to frequencies, a friend, who's an audio engineer, explained that it's the high frequencies (and harmonics) that suffer from compression, notably because there are more waves per second at higher frequencies, and the sample rate (the number of times per second that a sound is sampled) has to be much higher for high frequencies to come through well. Otherwise, you can hear a sort of "whoosh" sound of phasing coming through. You would hear this best on the harpsichord sample (if you can, indeed, hear it). The oboe key-clicking is a good thing to listen for; the friend said that you'd hear problems with breath sounds of a flute, for example.

    Dan said that he could hear the difference between a CD of a Mahler symphony and a 320 kbps rip; of course he could! Because he knew which was which! That's why blind tests are important. If you're expecting the files to sound different, and you know which is which, of course you'll hear the difference, even if there is none. Tons of psychological experiments have shows this (like the one where kids prefer carrots that are labeled "McDonalds" to unlabeled carrots).

    I suggested to Len that I'd post the results this weekend. Does anyone need more time?

    ReplyDelete
  13. It is academic now but both Patrick and Kirk seem to imply that I was suggesting that "we could go back again" My concern, which I am assured is groundless , wass that conversion to .cda might add further compression bringing them all down to the same level which was why they seemed to sound the same.

    ReplyDelete
  14. This is because you used the word "enhancement" Len. As you know, I specifically asked my son the question whether burning a CD from a wav file could involve compression. It would be very hard to understand the reason for this and the answer was a clear no.

    ReplyDelete
  15. How do, all!

    This, supposedly my maiden comment, has been somewhat delayed by the vagaries of Firefox and IE. It may still be of use to someone craving reassurance, so I'm posting it anyway . . .

    I am acutely aware of the risk of teaching my grannie to suck eggs. Nevertheless, with my accustomed diplomacy, here goes -

    As Kirk explained when announcing that his test files were ready, the recordings have been subjected to "lossy" compression. This simply means that some of the signal has been removed. For any given degree of compression, a certain proportion of the signal must be dumped. The trick is in winkling out those parts of the signal whose absence is least detrimental to the perceived sound. One cmpression methodology is better than another when it is cleverer at doing this. What is held in the compressed file is thus an approximation to the original signal. It is important to remember that the bits of the signal that were dumped are GONE FOR GOOD.

    The reason why compression can be perceived in the middle, rather than the high frequencies is that this is where our ears are most sensitive. This does not mean that the compression process is affecting the middle more, but merely that we are hearing the effects, of the compression method messing around with the upper partials, thorough the medium of their respective fundamental tones

    Also, let's not overlook the important fact that the compression process is working on two distinct but intimately-related data streams - the left and right channels. Not just some, or even most, but ALL of the phase information, that is crucial to the formation of a realistic stereophonic sound-image, depends on
    the accurate correspondence of these streams. So-called "compression artefacts" affect not only the "purity" of the musical sound, but also its spatial and temporal distribution, of which the most infamous example is the "corkscrewing bathroom" effect.

    Whatever the compression method, to get a playable signal the data must be decompressed. The decompression method must fill the gaps, not by "blanks" but by interpolating values between the "known points". This is also done when converting between formats. WAV format, which seems to be the de facto intermediary, is for practical purposes the same as CD-audio (i.e. CD "red book" standard format), except that values are stored as floating point numbers rather than integers. Thus, assuming a
    good-quality sound card, replaying Kirk's WAV files directly from your computer to your audio amplifier will most faithfully reproduce the compression artefacts.

    Converting from WAV to CD-audio is largely a matter of rounding the FP values to the earest whole number. Burning Kirk's WAV files to a "red book" standard CD, compatible with a normal CD player, must necessarily include this conversion. Other than the addition of a tiny amount of rounding noise, the approximations resulting from the original compressions will be reproduced as faithfully as in the "WAV playback" method. If the resulting CD plays, but no sound is heard, then either there was a failure of the WAV to CD-audio stage of the burn process, or the amplifier isn't switched on (etc.). I'll leave you to guess which of these is the more likely!

    Note that the rounding noise, which is comparable to the "dither" commonly applied to digital recordings to smooth out low-level encoding artefacts, is at a much lower level than the compression artefacts - in other words, it will not result in any sort of "masking" of the effects.

    If you convert a WAV file to (say) MP3, then the signal data are compressed as above. However, if, as here, the WAV file was derived from an MP3 source, then you get an approximation OF an approximation. Thus, "if I use I-tunes to make a CD they" may well "become .mp3 files," but even if "they

    are all at the same compression rate" there is no way "they will all sound the same". Each one will contain the approximations resulting from its original compression, augmented by further approximations due to the conversion back to MP3. The only effects this has are (a) there are even more compression artefacts, and (b) you can't tell which artefacts are caused by which compression process (assuming that you can perceive any, that is!).

    We should bear in mind that each set of files includes one that has not been subjected to any compression at all. This WAV file will have been created by importing a "true" CD-audio file. The only operation carried out on the data is the conversion from CD-audio integers to WAV floating point, which is a virtually error-free process.

    High-quality headphones do make a BIG difference to this sort of critical listening. Because there is no channel crosstalk, there are no complicated room reflections, and distracting external noises are moderated, you stand a much better chance of detecting small differences in the sound.

    FINALLY, it strikes me that with "MP3", or any other compression system, we tend to confuse two entirely different things. On the one hand, MP3 is a format, a simple file layout definition. Regardless of how the information got into the file, "MP3" is the template that tells retrieval mechanisms how to extract the data and reconstitute the waveform. On the other hand, MP3 is a process, the implementation of a set of algorithms for perfoming the compression. Over time, these algorithms can be improved and even augmented, resulting in data that produce "better" results, all without any need to modify the retrieval mechanisms. Thus, while an "old" 96 kbps MP3 of a given recording might sound grotty, a "new" 96 kbps MP3 of the same recording could well sound much better - or at least less grotty!

    To summarise:

    If you can't hear any sound, the fault is most likely with the software.

    If you can hear the sounds, then the differences will be in there, somewhere.

    For the best chance of hearing the differences, listen directly to the WAV files rather than via a CD, and use good headphones rather than loudspeakers (the biggest bar to validity of the results lies, I suspect,in the disparities of the kit and environment of the several test subjects).

    Don't forget that differences may be of either tonal quality or stereophonic dynamics (or both)

    If you can't hear any differences, either your playback kit is rubbish, or, not to put too fine a point on it, your ears aren't good enough

    ReplyDelete
  16. If I may be so bold, let me correct some errors in your comment...

    First, compression is not most obvious in middle frequencies. If anything, it's most obvious in high frequencies, because of the, well, frequencies (which are the number of times per second that a wave moves through its cycle). Sample rates have to be high enough to be able to "grab" the sound at a regular interval without phasing.

    Next, no decompression method "fills in the gaps". When playing compressed music, it's not like the error correction on a CD player that, well, fills in gaps, but it is simply like a zip file being decompressed then a stream being played. The decompression process is neutral.

    The quality of your sound card won't have _any_ effect on the playback of the files I sent, nor would they have any effect on compressed files, because the compression is performed by the computer. The sound card merely changes the data to sound. The sound card _will_ have the same effect that a good or bad amp will have, but no more.

    Converting from WAV to CD involves no change in data at all. I don't know where you got that one. A WAV file (or an AIFF file) is _exactly_ the same data as a CD file, just with additional headers so it can be exploited by a computer. Playing back a WAV file will provide exactly the same data as playing back that WAV file burned to CD.

    http://en.wikipedia.org/wiki/WAV

    "To record WAV files to an Audio CD the file headers must be stripped and the remaining PCM data written directly to the disc as individual tracks with zero padding added to match the CD's sector size."

    And as to hearing differences, well, I'm waiting to see if your playback kit is rubbish, or if it's your ears. :-)

    ReplyDelete
  17. In the interests of boldness, it behoves me to respond:

    Regarding "middle frequencies", I was responding to Dan's comment. I didn't say that compression was most obvious in the middle, but merely that it can be sensed through its effect ON the middle. We are agreed that compression, as a process, generally operates on the higher frequencies. The sampling rate is determined by a mathematical formula - it has to be at least double the highest frequency that you want to record. I admit that I am not entirely sure of what Kirk means by the term "phasing" in this context!

    There are many ways that compression methods skin their cats. A simple one that can be used in lossless compression is to record the first sample complete, then the successive subsequent samples by differences (which require fewer bits). Another, based on psycho-acoustics, is to find places where there are two high frequency tones at very nearly the same pitch, and remove the weaker of the two. The effect of this is to smooth out the waveform a bit, offering the opportunity to record fewer samples. Obviously, this would be pointless if you still have to record a value for every sample, i.e. it will only save space if the format permits the encryption of "n samples omitted". It's these omitted samples that, during decoding, would become the "gaps", to be filled by (say, second or third order) interpolation, which would yield a close approximation to the smoothed waveform. I agree that it's not like CD error correction, but it IS like CD error compensation (except here the gaps are, shall we say? accidental).

    I never suggested that the quality of the sound-card had any "effect" on either the compressed files or the playback - I merely pointed out that good-quality kit would "most faithfully reproduce" the sounds in the files. With poor enough kit, the differences you are trying to hear would be drowned in the sea of noise, and strangled by the limited bandwidth and roller-coaster frequency response.

    I hold my hands up over WAV files and floating point format! I've now checked, and seen that I presumed too much, albeit with good(ish) reason. What happened was this: I found that my wave-editing software, which uses WAV format for its I/O, worked in floating point (this results in much less loss of accuracy when performing manipulations). I not entirely unreasonably assumed - and the difference between CD-audio and WAV file sizes tended to reinforce the impression! - that WAV must therefore store the numbers in that same form. It's a pity that it doesn't.

    My playback kit is good enough, and, fortunately or unfortunately, I am all too well aware of the limitations of my hearing.

    ReplyDelete