English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 09 February 2021, 04:13   #1
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
14.57731 bit audio

Hello,

I've been writing about this in another thread, but thought this is important enough to warrant it's own thread.

I have just finished testing a solution to get a bit higher audio quality out of Amiga. The solution works both in emulators and on the real machine.

The difference between this and the 14bit audio we've been using for ages is that you're getting the combined samples by using a channel set to 64 and 63 volume instead of 64 and 1. The combined values work well in the range -12223 to 12222, which is ~14.57731 bit quality. You can also modify the conversion to work with the range -16256 to 16129, but then you will get lower quality as you reach those higher levels because some values can not be derived from a*64 + b*63 (where both a and b are in range of -128 to 127)

This system, also gives higher volume compared to the old 14bit system, and reaches ~75% of the volume of just playing 8 bit sound on both channels at maximum volume.

I have attached the conversion tables, both ones that convert in the -12223 to 12222 range - if you generated audio into that range, or converted from higher bits to that range, as well as for -32768 to 32767 range, if you just want to convert 16bit sound into this format.

It should be pretty straightforward to implement into any audio players, so I hope someone will make something useful out of this.

The files in the attachment are:
24446tab63.dat -- values to convert from -12223 to 12222 range for the 63 volume channel
24446tab64.dat -- values to convert from -12223 to 12222 range for the 64 volume channel
65536tab63.dat -- values to convert from 16bit for the 63 volume channel
65536tab64.dat -- values to convert from 16bit for the 64 volume channel
Attached Files
File Type: zip remaptables.zip (8.6 KB, 46 views)
orangespider is offline  
Old 09 February 2021, 10:37   #2
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 2,804
This is a fascinating development, I'll be sure to look into it
Did you do any tests (other than listening) on the quality you get by using this method?
roondar is offline  
Old 09 February 2021, 10:41   #3
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by roondar View Post
This is a fascinating development, I'll be sure to look into it
Did you do any tests (other than listening) on the quality you get by using this method?
No, don't have any way to measure output signals, am hoping someone would do it because I see people are doing measurements in the other thread.

The base PSNR is lower than in the 14bit audio, but I have absolutely no idea what distortions happen in the machine once the digital signal gets there.
orangespider is offline  
Old 09 February 2021, 10:44   #4
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL
Posts: 1,734
There is 65 levels from Max to null. http://amiga-dev.wikidot.com/hardware:audxvol - special coder (mapper) should use approach where one DAC is free from PWM and remain fraction is PWM active - with proper reconstruction filter most of harmonics should be removed giving as such higher SNR.
I can prepare signals if you are interested to verify your idea (and to simplify overall process lets stick to normal sample rates to avoid all issues with ECS/AGA).

Quote:
Originally Posted by orangespider View Post
No, don't have any way to measure output signals, am hoping someone would do it because I see people are doing measurements in the other thread.

The base PSNR is lower than in the 14bit audio, but I have absolutely no idea what distortions happen in the machine once the digital signal gets there.
Nowadays everyone has PC with line in - this provide for everyone possibility to verify Amiga audio output quality, your PC can be calibrated with help of external CD player or even decent MP3 player).
pandy71 is offline  
Old 09 February 2021, 10:48   #5
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by pandy71 View Post
There is 65 levels from Max to null. http://amiga-dev.wikidot.com/hardware:audxvol - special coder (mapper) should use approach where one DAC is free from PWM and remain fraction is PWM active - with proper reconstruction filter most of harmonics should be removed giving as such higher SNR.
I can prepare signals if you are interested to verify your idea (and to simplify overall process lets stick to normal sample rates to avoid all issues with ECS/AGA).
So far I was testing with period 124 on PAL, which should be 28867Hz.

Quote:
Originally Posted by pandy71 View Post
Nowadays everyone has PC with line in - this provide for everyone possibility to verify Amiga audio output quality, your PC can be calibrated with help of external CD player or even decent MP3 player).
Yeah, but my PC has a wretched audio in, I get noise on everything.
orangespider is offline  
Old 09 February 2021, 11:03   #6
nikosidis
Registered User

 
Join Date: Jan 2020
Location: oslo/norway
Posts: 812
Quote:
Originally Posted by orangespider View Post
Hello,

I've been writing about this in another thread, but thought this is important enough to warrant it's own thread.

I have just finished testing a solution to get a bit higher audio quality out of Amiga. The solution works both in emulators and on the real machine.

The difference between this and the 14bit audio we've been using for ages is that you're getting the combined samples by using a channel set to 64 and 63 volume instead of 64 and 1. The combined values work well in the range -12223 to 12222, which is ~14.57731 bit quality. You can also modify the conversion to work with the range -16256 to 16129, but then you will get lower quality as you reach those higher levels because some values can not be derived from a*64 + b*63 (where both a and b are in range of -128 to 127)

This system, also gives higher volume compared to the old 14bit system, and reaches ~75% of the volume of just playing 8 bit sound on both channels at maximum volume.

I have attached the conversion tables, both ones that convert in the -12223 to 12222 range - if you generated audio into that range, or converted from higher bits to that range, as well as for -32768 to 32767 range, if you just want to convert 16bit sound into this format.

It should be pretty straightforward to implement into any audio players, so I hope someone will make something useful out of this.

The files in the attachment are:
24446tab63.dat -- values to convert from -12223 to 12222 range for the 63 volume channel
24446tab64.dat -- values to convert from -12223 to 12222 range for the 64 volume channel
65536tab63.dat -- values to convert from 16bit for the 63 volume channel
65536tab64.dat -- values to convert from 16bit for the 64 volume channel
I can record the output on my A1200, but I do not understand how to use this?
nikosidis is offline  
Old 09 February 2021, 11:09   #7
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by nikosidis View Post
I can record the output on my A1200, but I do not understand how to use this?
Well those are the lookup tables for anyone who wants to make a player. If you just want to play something, I can convert it, and post the executable, but I don't even know what source audio should we use. If someone has a good test sample, I could convert it into this format and then we could also play it back from some 14bit player and an 8bit player and compare the outputs.

edit: The lookup table usage is pretty simple, especially the 65536 ones, it goes something like this:

lea tab64+32768, a0
lea tab63+32768, a1
lea input, a2
lea output64, a3
lea output63, a4
lea input+length, a5
.lp
move.w (a2), d1
move.b (a0, d1.w), (a3)+
move.b (a1, d1.w), (a4)+
cmp.l a2, a5
bne .lp
orangespider is offline  
Old 09 February 2021, 11:10   #8
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL
Posts: 1,734
Quote:
Originally Posted by orangespider View Post
So far I was testing with period 124 on PAL, which should be 28867Hz.
IMHO period 128 should be used due PWM (unwanted and additional distortions present in periods different than 128)
pandy71 is offline  
Old 09 February 2021, 11:16   #9
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by pandy71 View Post
IMHO period 128 should be used due PWM (unwanted and additional distortions present in periods different than 128)
Are you talking about AUDxPER or sample period? Because if you're talking about AUDxPER, I've never read it has additional distortions at different periods. (That's what I was talking about).
orangespider is offline  
Old 09 February 2021, 11:25   #10
nikosidis
Registered User

 
Join Date: Jan 2020
Location: oslo/norway
Posts: 812
Quote:
Originally Posted by orangespider View Post
Well those are the lookup tables for anyone who wants to make a player. If you just want to play something, I can convert it, and post the executable, but I don't even know what source audio should we use. If someone has a good test sample, I could convert it into this format and then we could also play it back from some 14bit player and an 8bit player and compare the outputs.

edit: The lookup table usage is pretty simple, especially the 65536 ones, it goes something like this:

lea tab64+32768, a0
lea tab63+32768, a1
lea input, a2
lea output64, a3
lea output63, a4
lea input+length, a5
.lp
move.w (a2), d1
move.b (a0, d1.w), (a3)+
move.b (a1, d1.w), (a4)+
cmp.l a2, a5
bne .lp
We can use this one from Revision demo party.

https://files.scene.org/get/parties/2019/revision19/streaming-music/wright_and_bastard_-_the_fat_dandy_butterfly_slims.zip

In the archive use the .wav file.

This will be interesting
nikosidis is offline  
Old 09 February 2021, 11:40   #11
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,000
Quote:
Originally Posted by orangespider View Post
Are you talking about AUDxPER or sample period? Because if you're talking about AUDxPER, I've never read it has additional distortions at different periods. (That's what I was talking about).
The point is that the volume PWM runs once every 64 colour clocks, so if you set AUDxPER to be a multiple of 64 it will remain in phase with the volume PWM, which is desirable.
Using AUDxPER of 128 will give you exactly 2 iterations of the PWM per sample.
robinsonb5 is offline  
Old 09 February 2021, 12:11   #12
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by robinsonb5 View Post
The point is that the volume PWM runs once every 64 colour clocks, so if you set AUDxPER to be a multiple of 64 it will remain in phase with the volume PWM, which is desirable.
Using AUDxPER of 128 will give you exactly 2 iterations of the PWM per sample.
Ok, that makes sense, swapped my test code to 128.

Quote:
Originally Posted by nikosidis View Post
We can use this one from Revision demo party.

https://files.scene.org/get/parties/...rfly_slims.zip

In the archive use the .wav file.

This will be interesting
That file is 44100, and my only test playback code is PAL only... Anyway, I converted it to 27965 Hz and cut the first minute out of it. In the archive you got:
audiotest.exe -- my quick and dirty playback program (do not start it unless you're on a PAL screen or you'll probably get a mess)
audiotest.wav -- the resampled/cut 16bit version of the song you can play with other players to compare quality

edit: forgot the link:
http://s000.tinyupload.com/index.php...55144672142109
orangespider is offline  
Old 09 February 2021, 12:32   #13
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 44
Posts: 3,224
VERY interesting

Is the source code available? I'd like to try with some other kinds of music.
Thorham is offline  
Old 09 February 2021, 12:37   #14
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by Thorham View Post
VERY interesting

Is the source code available? I'd like to try with some other kinds of music.
Well I can post the source code of the player, but it's just playing back the pre converted files (which are added as INCBIN). It's also just rushed. But you can easily make your own player just use the lookup tables attached to my original post. If you point at the center of the table, and read a 16 bit audio value, it will give you the 8 bit value you should use. The value from the 63 table should be used in the channel with 63 volume, the value from the 64 table should be used in the channel with 64 volume.
orangespider is offline  
Old 09 February 2021, 12:44   #15
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL
Posts: 1,734
Quote:
Originally Posted by orangespider View Post
Are you talking about AUDxPER or sample period? Because if you're talking about AUDxPER, I've never read it has additional distortions at different periods. (That's what I was talking about).
AUDxPER in Amiga is a Sample Rate - we can't ignore physics - Paula is clocked 1/8th of main clock and all samples are internally resampled (Zero Order Hold i assume) to 3.546895MHz (PAL AUDxPER=1) - side to this volume regulation is controlled not trough multiplicator (as in WINUAE and other emulators) but trough PWM so to avoid additional distortions period 128 fit perfectly in PWM (where PWM frequency is AUDxPER=64) so this is OK from signal perspective.

you should read very good analysis of Paula made by buggs

Quote:
Originally Posted by buggs View Post
I've updated my Paula writeup with Details to these measurements. The PDF can be found here
There is multiple sources of unwanted distortions in Amiga - even power quality and PCB layout is a serious factor - i see no sense in flame war on 80+dB SNR in system where active floppy disk can be heard (trough power lines fluctuations) - for HQ audio whole Amiga PCB need to be redesigned.
Also Paula is limited - there is no separate power for DAC, IC layout seem to be also futile from HQ perspective.

Last edited by pandy71; 09 February 2021 at 12:50.
pandy71 is offline  
Old 09 February 2021, 12:45   #16
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,000
Calibrating this will be an "interesting" problem to solve!

It definitely needs testing with some much more dynamic music. (The kind of music where if you tried to listen to it while driving, most of it would be lost in the road noise.)
robinsonb5 is offline  
Old 09 February 2021, 12:46   #17
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by pandy71 View Post
AUDxPER in Amiga is a Sample Rate - we can't ignore physics - Paula is clocked 1/8th of main clock and all samples are internally resampled to 3.546895MHz (PAL AUDxPER=1) - side to this volume regulation is controlled not trough multiplicator (as in WINUAE and other emulators) but trough PWM so to avoid additional distortions period 128 fit perfectly in PWM (where PWM frequency is AUDxPER=64) so this is OK from signal perspective.

you should read very good analysis of Paula made by buggs

Yeah, someone else also gave an explanation a few posts ago (altho not this extensive), so I have already switched to 128.
orangespider is offline  
Old 09 February 2021, 12:47   #18
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 44
Posts: 3,224
Quote:
Originally Posted by orangespider View Post
But you can easily make your own player
I have to look up all that audio hardware stuff, so that's going to have to wait.
Thorham is offline  
Old 09 February 2021, 12:51   #19
orangespider
Registered User

 
Join Date: Feb 2021
Location: Becej / Serbia
Posts: 120
Quote:
Originally Posted by Thorham View Post
I have to look up all that audio hardware stuff, so that's going to have to wait.
This is the audio hardware stuff from mine:
Code:
	move.l	#c_left64, d0
	move.l	d0, aud0lc
	move.w	#32768, aud0len
	move.w	#128, aud0per
	move.w	#64, aud0vol
	
	move.l	#c_right64, d0
	move.l	d0, aud1lc
	move.w	#32768, aud1len
	move.w	#128, aud1per
	move.w	#64, aud1vol
	
	move.l	#c_right63, d0
	move.l	d0, aud2lc	
	move.w	#32768, aud2len
	move.w	#128, aud2per
	move.w	#63, aud2vol
	
	move.l	#c_left63, d0
	move.l	d0, aud3lc
	move.w	#32768, aud3len
	move.w	#128, aud3per
	move.w	#63, aud3vol

	move.w	#%0000000011111111, adkcon
	move.w  #%1000000000001111, dmacon   ; dma set on
I'm using a 65536 channel buffer that I fully fill at the start and then after every vblank after the first I write in 552 bytes. This is a bit nasty because I am actually writing a few bytes less than needed, but the buffer is large enough that this won't become a problem if the song is 10 mins or less.
orangespider is offline  
Old 09 February 2021, 13:01   #20
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 44
Posts: 3,224
Quote:
Originally Posted by orangespider View Post
This is the audio hardware stuff from mine:
Thanks
Thorham is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
15 bit 44 khz audio idea. Thorham Coders. General 31 17 February 2021 08:51
24 or 32 bit audio capture within WinUAE EAUniW support.WinUAE 7 17 September 2018 22:22
Questions about 14 bit audio playback xxxxx Coders. Asm / Hardware 16 22 December 2014 19:30
High Quality reproduction of Audio on 8 bit. pandy71 Amiga scene 0 01 July 2013 15:08
Simple 14 bit audio question... Thorham Coders. General 7 06 June 2010 10:55

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:47.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.10857 seconds with 13 queries