POV-Ray : Newsgroups : povray.off-topic : Data compression Server Time
1 Nov 2024 19:15:50 EDT (-0400)
  Data compression (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: Invisible
Subject: Data compression
Date: 10 May 2011 11:32:25
Message: <4dc95a89@news.povray.org>
I've got a CD at home. When I first got it, I noticed that certain 
passages sound very slightly strange. Today, ten years later, I know 
exactly what it sounds like: it sounds like lossy audio compression.

This raises two interesting questions:

1. Why the hell would you put compressed audio onto a CD rather than the 
uncompressed original source?

2. If I can tell that it's compressed, despite not having the 
uncompressed original to compare to, doesn't that mean that there's more 
redundancy in the signal than the codec is taking advantage of?

Now I don't actually know which codec was used here. [Asking whether you 
can tell the codec by the compression artefacts is another interesting 
question.] But in this instance, there are long echo tails which are 
getting audibly chewed up. Not drastically so, but enough to be noticeable.

The only audio codecs I've looked at seem to work exclusively in the 
frequency domain. The general algorithm seems to be

- Chop the signal into chunks.
- Apply some Fourier-based transform to each chunk, taking it into the 
frequency domain.
- Use a psychoacoustic model to priorities each element of the spectrum.
- Adjust the resolution of each spectrum sample in proportion to 
priorities and available bandwidth.
- Encode each spectrum sample with the requisite number of bits.
- Apply an entropy coder to cram the results into the smallest available 
space.

All of this makes no use whatsoever of the striking similarity between 
consecutive audio chunks. That's the equivalent of a video codec which 
encodes each individual frame completely separately, without reference 
to the previous frames. (I really hope no serious video codes do this!)

This disregard for temporal redundancy is presumably why I can tell the 
difference between compressed and uncompressed audio, even with no 
reference to compare to. Interestingly, this /also/ suggests that it 
might perhaps be possible to /recover/ the lost information. I mean, if 
I can tell it's gone, perhaps it's possible to deduce what it was?

Perhaps a more interesting question is "how can we make a better codec?" 
My personal feeling would be to split the audio into many narrow-band 
signals, map the amplitude curve of each one, and store a compressed 
description of these curves.

Now I just need to go implement that... HA! o_O


Post a reply to this message

From: Darren New
Subject: Re: Data compression
Date: 10 May 2011 12:23:11
Message: <4dc9666f$1@news.povray.org>
On 5/10/2011 8:32, Invisible wrote:
> 1. Why the hell would you put compressed audio onto a CD rather than the
> uncompressed original source?

Because you don't have the original source, or the person mastering the CD 
got the original source over a network and didn't want to spend the 
bandwidth and didn't care?

There are lots of CDs out there that were copied off vinyl albums that 
weren't properly compensated and have the treble turned way up. (Vinyl turns 
the treble up, and the record player turns it back down, to reduce hiss.)

Tomita's "Pictures at an Exhibition" has several tracks where they put the 
same audio on both the left and right channel, just because they screwed up.

> 2. If I can tell that it's compressed, despite not having the uncompressed
> original to compare to, doesn't that mean that there's more redundancy in
> the signal than the codec is taking advantage of?

No. You can tell someone is talking over a telephone by the fact that too 
much information is lost. Same with autotune.

> Now I don't actually know which codec was used here. [Asking whether you can
> tell the codec by the compression artefacts is another interesting
> question.] But in this instance, there are long echo tails which are getting
> audibly chewed up. Not drastically so, but enough to be noticeable.

Sounds like nyquist limits screwing up the codec, to me.

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

From: Orchid XP v8
Subject: Re: Data compression
Date: 10 May 2011 13:13:23
Message: <4dc97233$1@news.povray.org>
On 10/05/2011 05:23 PM, Darren New wrote:
> On 5/10/2011 8:32, Invisible wrote:
>> 1. Why the hell would you put compressed audio onto a CD rather than the
>> uncompressed original source?
>
> Because you don't have the original source, or the person mastering the
> CD got the original source over a network and didn't want to spend the
> bandwidth and didn't care?

I can only imaging it was the latter. This particular CD is modern 
electronic dance music, after all.

> There are lots of CDs out there that were copied off vinyl albums that
> weren't properly compensated and have the treble turned way up. (Vinyl
> turns the treble up, and the record player turns it back down, to reduce
> hiss.)

The other day, I was listening to a CD of vintage music, and a suddenly 
noticed that most of it is monophonic. Imagine that! ;-)

>> 2. If I can tell that it's compressed, despite not having the
>> uncompressed
>> original to compare to, doesn't that mean that there's more redundancy in
>> the signal than the codec is taking advantage of?
>
> No. You can tell someone is talking over a telephone by the fact that
> too much information is lost. Same with autotune.

You can't tell that information has been lost unless you can tell that 
it was there in the first place. And if you can tell there's something 
missing just by looking at what's still there, there's redundancy.

>> Now I don't actually know which codec was used here. [Asking whether
>> you can
>> tell the codec by the compression artefacts is another interesting
>> question.] But in this instance, there are long echo tails which are
>> getting
>> audibly chewed up. Not drastically so, but enough to be noticeable.
>
> Sounds like nyquist limits screwing up the codec, to me.

Take any piece of sound. Apply too much MP3 compression. You can hear 
the quantinisation steps in the signal levels.

This isn't that bad, of course. You have to listen fairly hard to hear 
it. Then again, I'm the sort of person who owns a £100 set of headphones 
and a £300 CD player, so...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Darren New
Subject: Re: Data compression
Date: 10 May 2011 14:23:53
Message: <4dc982b9$1@news.povray.org>
On 5/10/2011 10:13, Orchid XP v8 wrote:
> I can only imaging it was the latter. This particular CD is modern
> electronic dance music, after all.

Yeah, I usually encounter it on albums that were old on vinyl. :-)

> You can't tell that information has been lost unless you can tell that 
it
> was there in the first place. And if you can tell there's something mis
sing
> just by looking at what's still there, there's redundancy.

Except you can compare to that which you've heard elsewhere. Have you eve
r 
heard someone do a call-in phone interview on the radio? Could you tell t
he 
difference between the DJ's voice and the phoned-in voice, even though yo
u 
might never have heard either before? It's because you know what tonal 
ranges you should be hearing.

You can tell an over-compressed violin because you're comparing it to oth
er, 
uncompressed violins in your memory. Even if there's no redundancy left. 

Indeed, why do you not think you're hearing a lack of redundancy?

> Take any piece of sound. Apply too much MP3 compression. You can hear t
he
> quantinisation steps in the signal levels.

OK.

> This isn't that bad, of course. You have to listen fairly hard to hear 
it.
> Then again, I'm the sort of person who owns a £100 set of headphon
es and a
> £300 CD player, so...

Yep.

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

From: Warp
Subject: Re: Data compression
Date: 10 May 2011 14:31:14
Message: <4dc98472@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> On 5/10/2011 8:32, Invisible wrote:
> > 1. Why the hell would you put compressed audio onto a CD rather than the
> > uncompressed original source?

> Because you don't have the original source, or the person mastering the CD 
> got the original source over a network and didn't want to spend the 
> bandwidth and didn't care?

  It becomes even worse when executives demand the audio to be amplified
ten-fold due to the loudness war.

-- 
                                                          - Warp


Post a reply to this message

From: Alain
Subject: Re: Data compression
Date: 10 May 2011 15:15:18
Message: <4dc98ec6@news.povray.org>

> I've got a CD at home. When I first got it, I noticed that certain
> passages sound very slightly strange. Today, ten years later, I know
> exactly what it sounds like: it sounds like lossy audio compression.
>
> This raises two interesting questions:
>
> 1. Why the hell would you put compressed audio onto a CD rather than the
> uncompressed original source?

Maybe that the original recording was done in a lossy format, or even a 
non-lossy format but with a sample rate set to low and a sample 
resolution also to low... Like 4000 kHz (or even less), 4 bits...
(I had a single CD that contained the whole Beatles discography encoded 
as .wav at that level or about...)

>
> 2. If I can tell that it's compressed, despite not having the
> uncompressed original to compare to, doesn't that mean that there's more
> redundancy in the signal than the codec is taking advantage of?

It's just that you have reasons to expect a higher chromatic range than 
the one you have.
If it sound like speech but misses the harmonics that are normaly 
present and expected, it will sound suspicious or strange.
Same thing for any known musical instrument's sounds.
If there is some sampling of previously heard peices, you also can 
perceive the lacking parts.

>
> Now I don't actually know which codec was used here. [Asking whether you
> can tell the codec by the compression artefacts is another interesting
> question.] But in this instance, there are long echo tails which are
> getting audibly chewed up. Not drastically so, but enough to be noticeable.

Even the best codec set at the highest quality can't do miracle if the 
source is bad...


Post a reply to this message

From: Invisible
Subject: Re: Data compression
Date: 11 May 2011 04:04:49
Message: <4dca4321$1@news.povray.org>
On 10/05/2011 20:15, Alain wrote:

> Maybe that the original recording was done in a lossy format, or even a
> non-lossy format but with a sample rate set to low and a sample
> resolution also to low... Like 4000 kHz (or even less), 4 bits...
> (I had a single CD that contained the whole Beatles discography encoded
> as .wav at that level or about...)

A normal CD is 40 kHz, so 4000 kHz would be 10x *higher* resolution than 
normal. And 4 bits per sample would be almost unrecognisable.

>> 2. If I can tell that it's compressed, despite not having the
>> uncompressed original to compare to, doesn't that mean that there's more
>> redundancy in the signal than the codec is taking advantage of?
>
> It's just that you have reasons to expect a higher chromatic range than
> the one you have.

Chromatic range? I think perhaps you meant dynamic range.

> Even the best codec set at the highest quality can't do miracle if the
> source is bad...

In this case, that's unlikely to be the problem.


Post a reply to this message

From: Invisible
Subject: Re: Data compression
Date: 11 May 2011 04:06:48
Message: <4dca4398$1@news.povray.org>
>> You can't tell that information has been lost unless you can tell that it
>> was there in the first place. And if you can tell there's something
>> missing
>> just by looking at what's still there, there's redundancy.
>
> Except you can compare to that which you've heard elsewhere. Have you
> ever heard someone do a call-in phone interview on the radio? Could you
> tell the difference between the DJ's voice and the phoned-in voice, even
> though you might never have heard either before? It's because you know
> what tonal ranges you should be hearing.
>
> You can tell an over-compressed violin because you're comparing it to
> other, uncompressed violins in your memory. Even if there's no
> redundancy left. Indeed, why do you not think you're hearing a lack of
> redundancy?

Like I said, I can hear glitches in various quiet echo trails. The sound 
should die away smoothly, but instead it's stepping. The codec is 
apparently ignoring temporal redundancy.


Post a reply to this message

From: Le Forgeron
Subject: Re: Data compression
Date: 11 May 2011 04:27:09
Message: <4dca485d$1@news.povray.org>
Le 11/05/2011 10:04, Invisible a écrit :
> On 10/05/2011 20:15, Alain wrote:
> 
>> Maybe that the original recording was done in a lossy format, or even a
>> non-lossy format but with a sample rate set to low and a sample
>> resolution also to low... Like 4000 kHz (or even less), 4 bits...
>> (I had a single CD that contained the whole Beatles discography encoded
>> as .wav at that level or about...)
> 
> A normal CD is 40 kHz, so 4000 kHz would be 10x *higher* resolution than
> normal. And 4 bits per sample would be almost unrecognisable.

CD is 44.1kHz, dual channel, 16 bits per sample (linear PCM).

I guess Alain was thinking of a recording at 4000 Hz.

4 bits sampling does in fact exist, but not in CD format, rather as
adaptative delta encoding (I used to have such hardware which could
record & play sound using only 4 bits per sample. All the smart was in
the chip)
Transforming a capture into a CD-style wav file is something I never
succeed to achieve.



-- 
Software is like dirt - it costs time and money to change it and move it
around.

Just because you can't see it, it doesn't weigh anything,
and you can't drill a hole in it and stick a rivet into it doesn't mean
it's free.


Post a reply to this message

From: Invisible
Subject: Re: Data compression
Date: 11 May 2011 04:36:28
Message: <4dca4a8c@news.povray.org>
>> A normal CD is 40 kHz, so 4000 kHz would be 10x *higher* resolution than
>> normal. And 4 bits per sample would be almost unrecognisable.
>
> CD is 44.1kHz, dual channel, 16 bits per sample (linear PCM).
>
> I guess Alain was thinking of a recording at 4000 Hz.

Which would put the Nyquist limit at a piffling 2000 Hz. Even POTS 
manages better bandwidth than that. Note that 2000 Hz is roughly 2 
octaves above middle C. And that's only the fundamental frequency, 
ignoring all the harmonics. Note also that the human voice runs well 
outside that range as well.

> 4 bits sampling does in fact exist

Indeed. It depends on what you're trying to sample. Some applications 
might not need high spatial resolution. Others might not need high 
temporal resolution. For example, we sample the output of our mass 
spectrometers at about 4 Hz. The signal changes so slowly that there's 
really no need to sample any faster.

I would suggest, however, that 4 bits/sample would be inadequate for 
audio applications.


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.