Welcome, Guest. Please login or register.

Author Topic: Simple Amiga audio question.  (Read 8062 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline ThorhamTopic starter

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1149
    • Show only replies by Thorham
Simple Amiga audio question.
« on: June 04, 2010, 07:17:48 PM »
Hi,

If I take a 16 bit audio file, and chop of the bottom two bits from each sample, it seems that the sound quality (when playing back in 14 bit on the miggy) isn't reduced. What I want to know is simple: Is there really no audible difference, or is there still some?

Any thoughts are appreciated :)
 

Offline johnklos

  • Full Member
  • ***
  • Join Date: Feb 2010
  • Posts: 190
    • Show only replies by johnklos
Re: Simple Amiga audio question.
« Reply #1 on: June 04, 2010, 08:04:03 PM »
I used to use my Amiga 1200 for ALL audio, and I've had it connected to very nice, very accurate speakers and a very clean amplifier at a time when one of my roommates was an audiophile. After explaining to him that bits are bits (why, for instance, the $5000 CD players which do 50x oversampling and "bathe the underside of the disc in blue laser light" and so on give you the exact same bits as a $39 CD player, and that it's just the digital to analog convertors which matter), he began to focus more on the quality and merits of various DACs. He then proceeded to help me test various types of DACs, including the ones in my Amiga.

14 bit on the Amiga really doesn't make a very audible difference. If anything, it slightly softens the sound, but this could also be due to the Amiga audio hardware (note I always had the filters off). But that doesn't mean you don't get accurate treble; rather, you get good treble that doesn't sound artificial as it sometimes does when all of your gear is clean and you put in a test CD.

Note that Amiga hardware with the filters off and good quality sound will always exceed the quality you can get from most audio formats. mp3s, for instance, make me cringe - the quality difference is tremendous. Most people can't tell because they're used to mp3s, but I can easily hear the difference. Also, most compressed (filesize compression) formats also compress (audio compression) the audio levels, so a track from a CD compressed (file and audio) would often have all of the levels evened out, and this completely ruins certain kinds of music. Classical, for instance, will die from audio compression.

So if you have good quality, clean 16 bit audio files without audio or filesize compression and you convert them to 14 bit and play them on the Amiga with the filters off, you'll have audio quality which exceeds most consumer device outputs, in my opinion.

There are other factors - make sure your power supply is clean, and make sure you have good grounds so you don't need a ground loop isolator (which affects the quality of the sound), et cetera. An Amiga can sound quite good!
« Last Edit: June 04, 2010, 08:07:44 PM by johnklos »
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Simple Amiga audio question.
« Reply #2 on: June 04, 2010, 08:33:44 PM »
Quote
So if you have good quality, clean 16 bit audio files without audio or filesize compression and you convert them to 14 bit and play them on the Amiga with the filters off, you'll have audio quality which exceeds most consumer device outputs, in my opinion.


No conversion to 14-bit is necessary. The 14-bit replay routines do all that anyway.
int p; // A
 

Offline ThorhamTopic starter

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1149
    • Show only replies by Thorham
Re: Simple Amiga audio question.
« Reply #3 on: June 04, 2010, 08:55:28 PM »
Quote from: johnklos;562892
I used to use my Amiga 1200 for ALL audio, and I've had it connected to very nice, very accurate speakers and a very clean amplifier at a time when one of my roommates was an audiophile.
That's cool, that will certainly sound great :)
Quote from: johnklos;562892
14 bit on the Amiga really doesn't make a very audible difference.
Sorry, but I've asked the question in an unclear way :o What I'm really asking is if a 14 bit player actually chops off bits 0 and 1 of each sample. I should've been more clear here :o
Quote from: johnklos;562892
Classical, for instance, will die from audio compression.
Yeah, I know, just try Classical internet radio stations. The music itself is still very enjoyable, but the quality certainly isn't optimal.
Quote from: johnklos;562892
So if you have good quality, clean 16 bit audio files without audio or filesize compression and you convert them to 14 bit and play them on the Amiga with the filters off, you'll have audio quality which exceeds most consumer device outputs, in my opinion.
Cool :) This is about a little project of mine. I'm using 16 bit, 48Khz stereo WAVs which I've down sampled to 28KHz using Sox, so the quality is quite good.
Quote from: johnklos;562892
There are other factors - make sure your power supply is clean, and make sure you have good grounds so you don't need a ground loop isolator (which affects the quality of the sound), et cetera. An Amiga can sound quite good!
Oh man, everything here is ungrounded :(
Quote from: Karlos;562902
No conversion to 14-bit is necessary. The 14-bit replay routines do all that anyway.
Ah, yes, that's what I wanted to hear, thanks :) The bit chopping I'm doing is for a lossless compression algorithm I'm writing. Of course bit chopping isn't lossless, but the resulting data is meant to be replayed on an Amiga in 14 bit, so effectively it should be lossless.

Nice to have this and some other things cleared up, thanks guys :)
« Last Edit: June 04, 2010, 09:02:32 PM by Thorham »
 

Offline platon42

  • Hero Member
  • *****
  • Join Date: Jul 2002
  • Posts: 573
    • Show only replies by platon42
    • http://www.platon42.de/
Re: Simple Amiga audio question.
« Reply #4 on: June 04, 2010, 09:54:41 PM »
Quote from: Thorham;562905
What I'm really asking is if a 14 bit player actually chops off bits 0 and 1 of each sample.


No, not if the output uses the calibration table. In this case, the conversion is not linear and all the 16 bits are used for mapping the input to the 2 x 8 bit output channels (one at full volume, the other at volume 1).
--
Regards, Chris Hodges )-> http://www.platon42.de <-(
hackerkey://v4sw7CJS$hw6/7ln6pr7+8AOP$ck0ma8u2LMw1/4Xm5l3i5TJCOTextPad/e7t2BDMNb7GHLen5a34s5IMr1g3/5ACM
 

Offline koshman

  • Sr. Member
  • ****
  • Join Date: Nov 2009
  • Posts: 445
    • Show only replies by koshman
Re: Simple Amiga audio question.
« Reply #5 on: June 04, 2010, 10:11:35 PM »
Quote
Yeah, I know, just try Classical internet radio stations. The music  itself is still very enjoyable, but the quality certainly isn't optimal.

I think jonklos was reffering more to so called "loudness war" in this case - i.e. severely reducing (compressing) dynamics by evening out the volume levels of different sections of a track (http://www.youtube.com/watch?v=xkkqsN69Jac&feature=fvst). Not that classical music would be the usual victim...
- Radim
 
A600 - 68020/33, 10MB RAM, 3.1, 2GB SD
 

Offline bubblebobble

  • Jr. Member
  • **
  • Join Date: Dec 2003
  • Posts: 66
    • Show only replies by bubblebobble
    • http://www.hd-rec.de
Re: Simple Amiga audio question.
« Reply #6 on: June 04, 2010, 11:29:52 PM »
Reducing bit resolution doesn't do anything to the frequency range, means bass and trebble are not affacted.
2 bits less raise the quantisation noise about 4 times. Nothing more, but nothing less. Depending on the audio material, this can get audible of course, especially in very silent passages. For "loud" regular pop music, this won't be much audible though. If the dynamic range is well used, quantisation noise starts to be audible roughly at 12 bits.
On the other hand, if you want to compress the audio data, removing 2 bits of 16 is ridiculous. Better use 8 or 4 bit ADPCM, the 8bit variant will sound almost as 16bits, and halves the data size. 4 bit is good for voices, but can get problematic for complex music with a lot of high frequencies, then it starts to crackle a bit.
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de
 

Offline ThorhamTopic starter

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1149
    • Show only replies by Thorham
Re: Simple Amiga audio question.
« Reply #7 on: June 06, 2010, 08:02:54 AM »
Quote from: platon42;562918
No, not if the output uses the calibration table. In this case, the conversion is not linear and all the 16 bits are used for mapping the input to the 2 x 8 bit output channels (one at full volume, the other at volume 1).
Perhaps the table includes the bit reduction?
Quote from: koshman;562922
I think jonklos was reffering more to so called "loudness war" in this case - i.e. severely reducing (compressing) dynamics by evening out the volume levels of different sections of a track (http://www.youtube.com/watch?v=xkkqsN69Jac&feature=fvst). Not that classical music would be the usual victim...
Ugh, that's a pretty bad practice (and I'm not even an audiophile) :(
Quote from: bubblebobble;562934
Reducing bit resolution doesn't do anything to the frequency range, means bass and trebble are not affacted.
2 bits less raise the quantisation noise about 4 times. Nothing more, but nothing less. Depending on the audio material, this can get audible of course, especially in very silent passages. For "loud" regular pop music, this won't be much audible though. If the dynamic range is well used, quantisation noise starts to be audible roughly at 12 bits.

Very interesting :)
Quote from: bubblebobble;562934
On the other hand, if you want to compress the audio data, removing 2 bits of 16 is ridiculous.
It's for an audio compressor I'm writing for a little project of mine, the bit chopping isn't used by itself.
Quote from: bubblebobble;562934
Better use 8 or 4 bit ADPCM, the 8bit variant will sound almost as 16bits, and halves the data size. 4 bit is good for voices, but can get problematic for complex music with a lot of high frequencies, then it starts to crackle a bit.
ADPCM is a last resort in case I can't fit all the music on a single CD. I really want lossless 14 bit compression.
 

Offline bubblebobble

  • Jr. Member
  • **
  • Join Date: Dec 2003
  • Posts: 66
    • Show only replies by bubblebobble
    • http://www.hd-rec.de
Re: Simple Amiga audio question.
« Reply #8 on: June 06, 2010, 08:55:59 AM »
Just to clarify: by "compressing" you mean data compression, not dynamic range compression as a DSP effect?

Looseless:
If you compress looseless, you can not guarantee any compression rate. If the data to compress doesn't show any redundancy, no compression is possible. (like zipping a zip file)
In reality, true looseless compression achives about 2 times compression rate on average complex audio data.

Loosless compression almost always works with a predictor (a function that predicts the next sample from the previous samples), calculates the error of the prediction (the delta between the predicted and real value) and zipps the result. E.g. like Flac for audio or PNG for images.

DPCM or ADPCM is not looseless. ADPCM8 uses 8 bits to store the error of the prediction and unpacks into 16bit samples. This is  loossy, but almost not audible. ADPCM4 uses 4 bit per 16bit sample, and is audible, depending on the material of course. Music will sound a bit harsh in high frequencies. MP3 uses 1-2bit per 16bit sample and designed for music. So if you want to pack music, this should be your first choise. If you use 192 or 256 kbps and a decend encoder like LAME, the compression is almost not audible. Better than 12bit or ADPCM4. ADPCM8 is much faster to encode/decode than MP3, but packs only 1:2.
« Last Edit: June 06, 2010, 09:11:54 AM by bubblebobble »
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de
 

Offline ThorhamTopic starter

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1149
    • Show only replies by Thorham
Re: Simple Amiga audio question.
« Reply #9 on: June 06, 2010, 09:17:26 AM »
Quote from: bubblebobble;563105
Just to clarify: by "compressing" you mean data compression, not dynamic range compression as a DSP effect?
Yes, I mean data compression. Adding audio effects is absolutely out of the question, even if it improves compressibility.
Quote from: bubblebobble;563105
Loosless compression almost always works with a predictor
Yes, but I've been unable to come up with a reasonable predictor (it's really easy to make a bad one :lol:), so I'm experimenting whith the deltas of the samples, or, to be more accurate, the deltas between the deltas. I'll try those predictors again, but I just wanted to try something else after failing initially.
Quote from: bubblebobble;563105
DPCM or ADPCM is not looseless.
Yep, I know, hence the 'last resort' remark ;) This might be a last resort because I'm trying to fit 1.67 gigs of audio on a CD with a few megs to spare (for code and graphics) :lol:

Anyway, I want to store the audio without any loss, and while mp3 could be useful, it's to heavy for the target hardware (as low as possible).
« Last Edit: June 06, 2010, 09:20:28 AM by Thorham »
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Simple Amiga audio question.
« Reply #10 on: June 06, 2010, 10:47:51 AM »
Quote from: Thorham;563106
Yes, I mean data compression.
http://flac.sourceforge.net/

You're unlikely to beat flac with your custom "predictors".
« Last Edit: June 06, 2010, 10:52:54 AM by Piru »
 

Offline ThorhamTopic starter

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1149
    • Show only replies by Thorham
Re: Simple Amiga audio question.
« Reply #11 on: June 06, 2010, 11:09:25 AM »
Quote from: Piru;563110
http://flac.sourceforge.net/

You're unlikely to beat flac with your custom "predictors".
Sorry, but FLAC isn't an option, because it's to heavy. Someone is doing a FLAC decoder for Amiga, and while it's quite optimized, it still uses about 90% CPU time on a 50Mhz '030. This is sadly much too heavy. Not a problem for me personally, but I want this to work on lesser CPUs than said CPU.

Also, I'm not using predictors at all right now (tried something quick, and failed :lol:), just deltas ;)
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Simple Amiga audio question.
« Reply #12 on: June 06, 2010, 11:45:13 AM »
I wrote a low CPU use audio compression format. Encoding was relatively expensive though. Essentially, it split 16-bit audio into frames, found the best N delta values (depending on the # of bits  to encode) for that frame (the expensive bit).

It supported, if I recall correctly, between 2-5 bit encoding. It was lossy but didn't sound too awful.

The idea was that each frame could be independently replayed.

Each compressed frame contained a 16-bit word that had some encoding flags, followed by a 16-bit signed sample (2 for stereo and so on) that comes unmodified from the input frame and serves as the starting point. After that, the next 4/8/16/32 16-bit words contain the best 4/8/16/32 delta values as determined by the encoder.

The remainder of the compressed frame was simply bitfield lookups into that table. Stereo data was interleaved IIRC. For 2-bit encoding, each 16-bit word contained 8 entries, 3-bit encoding stored 5 entries (LSB aligned), 4-bit encoding stored 4 entries, 5-bit stored 3 entries (LSB aligned).

The replay algorithm simply takes the start value and then extracts each field value, looks up the delta value from the table and adds it to the current value to recreate the next sample.

I am sure I still have the sources somewhere.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Simple Amiga audio question.
« Reply #13 on: June 06, 2010, 11:53:27 AM »
^ I never implemented it, but the replay routines were aimed at keeping the sample data compressed in memory and simply generating output directly to a mixing stage. In order to support volume, each frame would have it's start sample and delta table attenuated to the current volume, resulting in an output stream at the correct level of attenuation.

This meant that the mixing routine only ever had to add the output sample values. Overall the aim was to avoid excessive multiplication or table lookup.
int p; // A
 

Offline bubblebobble

  • Jr. Member
  • **
  • Join Date: Dec 2003
  • Posts: 66
    • Show only replies by bubblebobble
    • http://www.hd-rec.de
Re: Simple Amiga audio question.
« Reply #14 on: June 06, 2010, 12:55:34 PM »
Loosless compression will be always too expensive for your purpose, since it always involves some kind of zip compression.

MP3 is too expensive as well, otherwise this would be the best choise.

What's left is only DPCM or ADPCM. Those are relatively cheap to decode in linear complexity.
If you are calculating deltas, you are already using a predictor. The predictor says "the next sample will have the same value as the current one". Which isn't a bad predictor at all. This gives you already 80% of the quality.
ADPCM is significantly better than DPCM, since the value range is adaptive to the current audio data. But I would say roughly 4 times more expensive to calculate.

If this is a game project, I would also consider using a lower samplingrate and maybe mono, because nobody would recognize your nearly-looseless afforts anyway. 44100Hz/16bit/stereo is already quite expensive to sqeeze through the Zorro Slot without any decoding involved.
In 16kHz/8bit/mono you could also consider to use mp3, and decode it "offline" into a ram buffer. If the songs are not soo long, this should be affordable. 8bit isn't too bad either if you do proper dithering. (same effect as with pictures, when doing dithering even 12bit color looks acceptable)
« Last Edit: June 06, 2010, 01:06:53 PM by bubblebobble »
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de