Author |
Message |
noname
Member |
"Play16" used to do the 14 bit trick as well, incl. support for many different output devices, cybersound calibration and adpcm playback.
|
doom
Member |
The DACs are definitely poor, just like the video encoder in the A1200. They chose some really stupid places to save a few pennies. Still, 14-bit audio does sound better than 8-bit ditto, and it's easy and cheap.
I really don't know about audio dithering, especially with lo-fi audio on the Amiga.
|
rload
Member |
we had dithering on lux aeterna, but I must admit it is hard to make up ones mind whether it makes a difference.. I'd say it is reduced quality in a different way rather than good quality. I bet bumping up the Khz does way more for the sound than adding dithering.
|
doom
Member |
You can bump up the kiloherz, but that costs kilobytes. It's a tradeoff thing, but no big surprise really. ;) What really hurts is if the audio itself isn't properly mastered (see: Kilofix).
|
Blueberry
Member |
I guess it will always give best results to use as high sampling frequency as possible, even for the same bitrate. Dithering also becomes much more effective with higher bitrates, as you can use some of the less audible frequencies for dithering the lower ones. Problem is, if your demo is running in PAL mode (which it is) you can only bump up the frequency to 28604Hz, which is just short of satisfactory. But that's what we got.
Anyway, to get any benefit from dithering, you will have to store the exact dithered signal losslessly, or use some compression method which outputs enough quality for a higher-than-9-bit signal. This effectively rules out ADPCM.
On a related note, ADPCM is a very-fixed-rate compression scheme (fixed number of bits for every single sample) which means that it provides inferior quality in difficult parts and wastes bits in easy parts. Does anyone know of a comparatively simple variable-bitrate codec (not necessarily as simple as ADPCM but preferably simpler than full-fledged sub-band coding) that could be used to avoid this drawback?
|
doom
Member |
There's no reason why you couldn't cut the sample up into blocks and selecting a different ADPCM scheme for every block. By some simple mechanism like picking the most compact encoding that produces an error below a fixed threshold. Also, the encoded data can be further packed with various lossless methods.
I've also considered post-processing to improve the result. Haven't actually experimented though.
|
winden
Member |
8bit + dithering doesn't really cost anything compared to plain 8bit since you are going to be waiting for the soundbuffer chipmem longword write. OTOH, 14bit forces to write double the amount of chipmem.
|
doom
Member |
Does it help, though? In the 28 khz, 8-bit context, I mean.
|
winden
Member |
For the sound case I've tried with loading a 28khz 16bit wav and outputting to amiga 8bit via realtime floyd-steimber, using this code:
; a0 = 16bit samples
; a1 = 8bit dithered samples
; d0 = chipmem buffer register
; d1 = current sample
; d2 = error from previous sample
m1 macro
move.w \1(a0),d1
add.w d2,d1 ; add error from previous sample
add.w #$80,d1 ; round to nearest 8bit
move.w d1,d2 ; save
and.w #$ff00,d1 ; quantize to 8bit
sub.w d1,d2 ; calc error
ror.w #8,d1 ; output to lowbyte
move.b d1,d0
endm
.loop
m1 0
lsl.l #8,d0
m1 2
lsl.l #8,d0
m1 4
lsl.l #8,d0
m1 6
move.l d0,(a1)+
dbra d7,.loop
I'm not really good at sound, but in images the same routine (in fact the images one was the original) did a very good job for a 8bit --> 4bit greyscale conversion.
BTW, anyone remembers how many cycles was chipmem copyspeed on a1200/060?
|
Kalms
Member |
winden: 26-28 cycles.
(Original a500 core clock period: 140ns. bus runs at half that: 280ns. CPU gets every other cycle: 560ns. 060/50 clock period: 20ns. 560/20 = 28.)
|
rload
Member |
I think Blueberry made an interesting point on dithering. We have a 4 bit signal which is extrapolated to 16-bit and then we optionally dither it down to 8-bit or 14-bit.
How much resolution does the signal really have left after it is expanded to 16-bit? Is the output made 16-bit mostly for the convenience or does it actually use the full resolution in a sensible way?
|
doom
Member |
ADPCM isn't just 4-bit quantization. The amplitude of the error (on average) is proportional to the change in amplitude for the last (couple of) samples. To reduce resolution on top of that would only make it worse. It might not matter much because there's a great deal of noise anyway, but I can hear the difference between 8-bit and 14-bit playback, at least, with my IMA ADPCM replayer.
Also, consider that ADPCM will pack a simple triangle wave very nicely with very little noise, and in some cases zero noise.
I'd love to see some discussion of the nature of ADPCM noise though. There might be a decent way to filter some of it out with stopband filters etc., and lots of free time for it while waiting for chipmem.
|
noname
Member |
Three years old thread revival!
I would be interested in testing some ADPCM routines on my Amiga for a change. Seeing that so many people seem to have their ADPCM routine ready-at-hand, is anyone willing to share theirs with me?
If desirable, I could also add it to WickedOS and make a new release so that others could enjoy ADPCM playback as well.
|
rload
Member |
I have something in C. It is Microsoft ADPCM and the routine is just written to the point where it works, but maybe we can upload it to some google code repository and start tweaking on it. I think a common optimized asm adpcm routine could do wonders for the 060 scene.
|
noname
Member |
Hi Loaderror, I think that is a very good idea. So many playroutines out there, but none for ADPCM on Amiga. Btw. I wrote you an email at yourhandle@amigascne.org.
|
Kalms
Member |
I've got a version that is optimized for plain 68000 lying around. If someone sets up an online repo then I'll upload it there.
|
rload
Member |
@kalms : I've made a repository now on google code: http://code.google.com/p/unitedstatesofamiga/I'm happy to add you as admin if you give me your email so you can upload stuff. (I think that is the only thing required to grant access).
|
Kalms
Member |
Thanks Loady!
ADPCM decoder is in the repository now :)
|
Blueberry
Member |
Such nice things you can find on ADA if you dig a little. ;)
I integrated your code into my demosystem (and extended it to support stereo replay) and it works great. Thanks! :)
|
britelite
Member |
If anyone is interested I can provide you with two different adpcm-routines, one for 020+ and one for 68000 that is able to decode 28khz/mono at 14bits on an A500 with some cpu-time to spare :)
|
Reloaded
Member |
What software can I use to convert wav (or mp3) files to ADPCM?.
|
bstrr
Member |
|
Reloaded
Member |
Thanks bstrr, I was blind. It works perfectly :)
|