English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 17 October 2018, 18:36   #1
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 485
Possible enhancements to Paula audio emulation

Hi Toni,

We had some discussion about this in the past I think (years ago probably..). I'm still intrigued by the theory behind it so I thought it could do no harm to post a separate topic about it.

Some time ago kb_ posted code in the pouet forum for a module replayer with the object of recreating the Amiga sound faithfully. Or to quote the author, the whole purpose of the experiment was

Quote:
To get the "non interpolated at 3.5MHz" sound and these subtle ring modulation artifacts that come out of the cheap way Paula does volume
The main features/objectives were:
  1. Rendering audio at the Paula clock rate of 3.5Mhz and then downsampling to the PC host output rate
  2. Incorporate complete (?) volume behaviour
I've attached the code, which also can be found here: http://www.1337haxorz.de/drugs/tinymod.cpp

After searching the forums I encountered one thread where number 2 is discussed:

Low-level workings of Paula

The blog referenced in that thread no longer exists, but "kebby" references the same author as from the attached code. (See https://twitter.com/kebby )

Does the current WinUAE implementation incorporate any of the volume behaviour discussed in that thread?

With regards to point 1) I would very much appreciate it if the main difference with the current WinUAE implementation could be explained?
Attached Files
File Type: txt tinymod.cpp.txt (20.2 KB, 128 views)
Dr.Venom is offline  
Old 17 October 2018, 21:28   #2
Rotareneg
Registered User
 
Rotareneg's Avatar
 
Join Date: Sep 2017
Location: Kansas, USA
Posts: 324
The internet archive has that blog post archived: https://web.archive.org/web/20140924...ebby.org/?p=11

Quote:
“But wait, shouldn’t that color the sound, ring modulation artifacts and such?” I thought. The answer is of course a resounding no (also all artifacts introduced by the PWM are outside the audible range) but that didn’t stop me from trying to emulate a Paula voice at the full 3.5MHz and then filtering it down to find out how it sounds.
Rotareneg is offline  
Old 18 October 2018, 10:18   #3
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 485
Quote:
Originally Posted by Rotareneg View Post
The internet archive has that blog post archived: https://web.archive.org/web/20140924...ebby.org/?p=11
Thanks, so apparently he changed his mind to the audible effects of the volume counter .

With regards to the sample rate, the Sameboy author changed the audio rate at which the libretro core generates audio to 384Khz, saying

Quote:
“Just pushed a commit that redid the way the libretro port did audio. Audio is now sent to libretro at 384KHz, which is then resampled by RetroArch to whatever rate the user configured. This should greatly improve audio quality on the RetroArch port, which by this commit should sound even better than the standalone versions.”
The Gameboy generates audio at a high pulse rate (1Mhz or 2Mhz), which I guess is the reason a difference may be heard in sound quality. It may be somewhat similar to the Amiga case?

Then again, alankila, who seems to have quite some knowledge on the subject and the creator of the Sinc resampler (interpolate.txt), suggested here in the forums that using the Sinc resampler with a "high enough" pc host output rate, like 48000Hz, would lead to most accurate sound.

His tests however were done in 2006 however (judging by the date of when he posted the results, see modguide folder). I think the Soundblaster X-Fi had just came out then, which had a max playback rate of 96Khz. So maybe he never had a real chance to contemplate or test what would happen when you have 192Khz or even 384Khz playback rates available?

It makes me curious whether somewhere down the line a testcase could be made following the line of the tinymod player and see whether generating at 3.5Mhz and downsampling to 192Khz (most soundboards these days) or 384Khz (e.g. Soundblaster X AE-5) would lead to an audible quality difference versus Sinc+48Khz output. The Amiga sound is so special, that to me personally any chance of possibly improving the emulation would make it worthwhile.

But I guess this all depends on what there is to see in Toni's Crystal Ball..
Dr.Venom is offline  
Old 20 October 2018, 13:57   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
Remind me after next official version is out.
Toni Wilen is offline  
Old 21 October 2018, 10:18   #5
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 485
Awesome, will do
Dr.Venom is offline  
Old 01 November 2018, 11:46   #6
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 485
Quote:
Originally Posted by alankila View Post
Amiga produces audio at 3.54 MHz sampling rate. This is because Paula, the sound chip, runs at this clock, and it's more or less directly hooked into the analog audio output plugs.

Now Amiga could not make use of much of this immense bandwidth. The way WinUAE and UADE are built mean that the higher sampling rate you use at PC, the better approximation of genuine Amiga sound you get.
Since the Soundblaster X AE-5 can do up to 384Khz (and given above quote which made me curious), I've been doing some tests whether a difference in sound quality can be distinguished when switching between 48Khz, 96Khz, 192Khz and 384Khz. For this both interpolation and filters are disabled.*

My personal conclusion:
  1. I cannot hear a noticable difference between 96Khz, 192Khz and 384Khz
  2. But interestingly I can hear a clear difference between using 48Khz versus 96Khz when interpolation and filters are disabled, the 96Khz (or higher) setting sounding just that tiny bit less noisy / with less aliasing than the 48Khz setting.

Since audio quality is a somewhat subjective topic, I tried to find a simple repeatable "real" test which may be interesting to judge for yourself. One such example is that in GODS the sound the knifes makes when hitting a wall sounds different when using 48Khz versus 96Khz. Personally I find it to be slightly less noisy / scratchy when using 96Khz.


A subjective test to try yourself (config and statefile attached)

I've attached a config file and statefile (just copy to your respective WinUAE folders) that loads GODS. Just use Right-CTRL to throw a knife at the wall and switch between soundrates by using the keys "1" (48Khz) and "2" (96Khz). If you slowly keep throwing knifes at the wall and at the same time alternate between 48Khz and 96Khz, you'll probably notice the "knife hits wall sound" to sound different between the two rates.

I think it goes without saying that you probably need decent equipment to distuingish a difference at all. I'm using Sennheiser HD 600 headphones which makes the difference between 48Khz and 96Khz quite apparent.

So, it might be that when you like to listen to your WinUAE Amiga audio without interpolation and without filters that you may experience a slight increase in audio quality when using 96Khz or higher versus 48Khz.

Will be interesting to know whether other people can disguingish a noticeable difference themselves. If you care to try out above mentioned (attached) testcase, please report back





*To be able do quickly switch between the rates during runtime I configured keys "1" to "4" to switch between the various rates.
Code:
input.1.keyboard.0.button.2.1=KEY_1.0,'sound_frequency=48000'.0,'sound_max_buff=8192'.0,'sound_output=exact'.0
input.1.keyboard.0.button.3.2=KEY_2.0,'sound_frequency=96000'.0,'sound_max_buff=16384'.0,'sound_output=exact'.0
input.1.keyboard.0.button.4.3=KEY_3.0,'sound_frequency=192000'.0,'sound_max_buff=32768'.0,'sound_output=exact'.0
input.1.keyboard.0.button.5.4=KEY_4.0,'sound_frequency=384000'.0,'sound_max_buff=65536'.0,'sound_output=exact'.0
Attached Files
File Type: zip WinUAE_soundtest_(GODS_knife_against_wall).zip (427.3 KB, 107 views)
Dr.Venom is offline  
Old 31 December 2018, 15:12   #7
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
I added mixing algorithm (volume counter/3.58MHz) from tinymod but I can't get it to work (or I am missing something), there is high pitch whine in the background (if volume is less than max) and imho it also sounds too different. PWM volume will cause high pitch noise but I don't think it should be that obvious. Or does it need filter modifications? It is also possible "ReadFrac" logic conversion isn't correct.

Option in Sound GUI (Only added to make switching easier). It probably is good idea to disable interpolation, it is not bypassed. CPU load can be very noticeably higher..

Last edited by Toni Wilen; 31 December 2018 at 15:25.
Toni Wilen is offline  
Old 13 January 2019, 21:48   #8
mcbpete
Zone Friend
 
mcbpete's Avatar
 
Join Date: Oct 2004
Location: London, England
Age: 41
Posts: 239
Send a message via MSN to mcbpete Send a message via Yahoo to mcbpete
Quote:
Originally Posted by Toni Wilen View Post
It probably is good idea to disable interpolation, it is not bypassed. CPU load can be very noticeably higher..
Intriguing - So would you say 'disabled' is more accurate to the audio coming out a stock Amiga's phono sockets than Anti, Sinc, RH and Crux ? Always striving for realism in my configs and had had it sent to Sinc since reading this post:

Quote:
Originally Posted by Toni Wilen View Post
Anti is enabled by default in WinUAE since 1.3 (or was it 1.2..). It is very fast and should have good quality. Sinc is better but needs much more CPU power (but it also has free "led" filter emulation)
mcbpete is offline  
Old 13 January 2019, 21:54   #9
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
3.58MHz "volume counter rate" to output rate resampling already uses sinc-like filtering internally. It probably isn't good idea to do filtering twice.
Toni Wilen is offline  
Old 13 January 2019, 22:01   #10
mcbpete
Zone Friend
 
mcbpete's Avatar
 
Join Date: Oct 2004
Location: London, England
Age: 41
Posts: 239
Send a message via MSN to mcbpete Send a message via Yahoo to mcbpete
Quote:
Originally Posted by Toni Wilen View Post
3.58MHz "volume counter rate" to output rate resampling already uses sinc-like filtering internally.
Is that feature present in the current build (v4.1.0 from http://www.winuae.net/download/ rather than the libretro build), or is this something to come in a new version ?

If it's not available in the curent (non-libretro) version, is Sinc still the best option - or should I switch it to disabled ?

Last edited by mcbpete; 13 January 2019 at 22:34.
mcbpete is offline  
Old 14 January 2019, 10:02   #11
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 485
Quote:
Originally Posted by Toni Wilen View Post
I added mixing algorithm (volume counter/3.58MHz) from tinymod but I can't get it to work (or I am missing something), there is high pitch whine in the background (if volume is less than max) and imho it also sounds too different. PWM volume will cause high pitch noise but I don't think it should be that obvious. Or does it need filter modifications? It is also possible "ReadFrac" logic conversion isn't correct.

Option in Sound GUI (Only added to make switching easier). It probably is good idea to disable interpolation, it is not bypassed. CPU load can be very noticeably higher..

Hi Toni, thanks for looking into this!

I tried it and it indeed does sound quite different, it's almost as if there's some surround effect going on and/or some frequency bands are missing or something. Pretty difficult to pinpoint what's really off with it.

Do you see any room to improve / find out where the issue may be?

With regards to the 3.58Mhz output I have also been thinking about another possibility. Suppose on a breadboard it is possible to build the Amiga DAC + real analogue filter stage, would there be some sort of possibility to feed the 3.58Mhz signal right into that from WinUAE?

I'm not too well versed in hardware, but from looking at some youtube examples of building simple DACs with filter and audio output, it seems doable (I think at least with some help of the people with more hardware building knowledge on this board).

The end goal would be to have a simple list of components and a small build guide such that every user interested could build this Amiga audio output stage on a breadboard*, and together with the 3.58Mhz output option in WinUAE, experience 99.9% faithful Amiga audio through WinUAE.

I would love to hear your opinion on this: could outputting the 3.58Mhz signal into an external (breadboard like) device belong to the potential possibilities?


* We could even have things like a hardware switch on the breadboard for switching between A500 and A1200 filter stage and such..
Dr.Venom is offline  
Old 14 January 2019, 12:50   #12
mcbpete
Zone Friend
 
mcbpete's Avatar
 
Join Date: Oct 2004
Location: London, England
Age: 41
Posts: 239
Send a message via MSN to mcbpete Send a message via Yahoo to mcbpete
There's a developer in an audio forum I frequent (alas notoriously full of grumpy people!) who seems to know quite a bit about the subject (and made a VSTi that sounds (to my ears) very Amiga-ish in the filters):

Here's where he discusses the issue:
https://www.kvraudio.com/forum/viewtopic.php?p=7281871

And here's his possible solution with code examples:
https://www.kvraudio.com/forum/viewtopic.php?p=7282800
mcbpete is offline  
Old 14 January 2019, 13:29   #13
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 485
Quote:
Originally Posted by mcbpete View Post
There's a developer in an audio forum I frequent (alas notoriously full of grumpy people!) who seems to know quite a bit about the subject (and made a VSTi that sounds (to my ears) very Amiga-ish in the filters):

Here's where he discusses the issue:
https://www.kvraudio.com/forum/viewtopic.php?p=7281871

And here's his possible solution with code examples:
https://www.kvraudio.com/forum/viewtopic.php?p=7282800

Solution to what problem?
Dr.Venom is offline  
Old 14 January 2019, 13:35   #14
mcbpete
Zone Friend
 
mcbpete's Avatar
 
Join Date: Oct 2004
Location: London, England
Age: 41
Posts: 239
Send a message via MSN to mcbpete Send a message via Yahoo to mcbpete
The 'Possible enhancements to Paula audio emulation' problem
mcbpete is offline  
Old 14 January 2019, 15:04   #15
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 485
I wouldn't call that a "problem" to be honest.


But in a broad sense every suggestion to improve audio emulation is welcome of course

From reading the thread you mentioned, he (aciddose) seems to have more of an issue with OpenMPT code than with WinUAE? Also his comment about WinUAE is based on some stuff he saw in the past? Is he of the same opinion when using current WinUAE / codebase? (See quote below...)

But in case he does see a specific part that could be improved in current WinUAE, it will definitely help if you get him to be much more specific what his issue is with the current WinUAE soundcode, and what part of his code should improve on it.

At least that's my 2 cents..


Quote:
Originally Posted by aciddose
I haven't bothered to look at the WinUAE source to be so informed, I only remember having seen it and used it in the past and being very disappointed at quality/performance.

I believe it's based upon this document: https://pastebin.com/hZwxx4P0

The code itself and its implementation in WinUAE does "work".. the OpenMPT implementation is broken and done wrong. I believe a ringbuffer out-performs the method ("antti" ?) and there are other modern techniques that produce far superior filter kernels and far greater efficiency and flexibility.

See my "cheap-a-blep-a" ("itsa-me-mario!") kernel + implementation here: https://sourceforge.net/p/protracker/co ... /pt_blep.c
https://sourceforge.net/p/protracker/co ... /pt_blep.h

This is an unoptimized implementation because such optimization simply isn't needed. We're generating 4 channels... Xhip does 200+.

Warning, the author regularly does (IMO) silly things and edits my original code/comments, so... I can't vouch for the edited versions

For utilization and filter implementation see here: https://sourceforge.net/p/protracker/co ... pt_audio.c

(Same disclaimer, these are not optimal and totally inaccurate, but way more accurate than most other implementations... it's definitely possible to further optimize them or improve their accuracy but I believe the trade-offs are near ideal already.)
Dr.Venom is offline  
Old 14 January 2019, 15:39   #16
mcbpete
Zone Friend
 
mcbpete's Avatar
 
Join Date: Oct 2004
Location: London, England
Age: 41
Posts: 239
Send a message via MSN to mcbpete Send a message via Yahoo to mcbpete
Apologies, looks like my links don't go to the specific posts in that thread. The reason he mentions OpenModTracker is that apparently he says it uses the UAE code for the sound playback of Amiga Mods - whether it's true or not I can't say

When he flagged it I said the following - 'Toni seems like he's always striving to make WinUAE the best it can be so I totally would imagine he'd be interested in code that can make the emulation be improved ....' but whether aciddose is willing to share his knowledge or not is another story.
mcbpete is offline  
Old 14 January 2019, 15:54   #17
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
Quote:
Originally Posted by Dr.Venom View Post
I tried it and it indeed does sound quite different, it's almost as if there's some surround effect going on and/or some frequency bands are missing or something. Pretty difficult to pinpoint what's really off with it.

Do you see any room to improve / find out where the issue may be?
First question is: does tinymod actually sound identical?

Quote:
With regards to the 3.58Mhz output I have also been thinking about another possibility. Suppose on a breadboard it is possible to build the Amiga DAC + real analogue filter stage, would there be some sort of possibility to feed the 3.58Mhz signal right into that from WinUAE?
I am not interested in anything that connects to physical hardware. Too annoying and I don't do drivers.

About other sound updates: I only care about digital side where everything is logical enough. When it goes to "analog"/filter side: I require full code that is confirmed working and work as expected.
Toni Wilen is offline  
Old 14 January 2019, 17:10   #18
mcbpete
Zone Friend
 
mcbpete's Avatar
 
Join Date: Oct 2004
Location: London, England
Age: 41
Posts: 239
Send a message via MSN to mcbpete Send a message via Yahoo to mcbpete
Ah sorry yeah, just seen that this rabbit hole was greatly explored on here already - http://eab.abime.net/showthread.php?t=71580
mcbpete is offline  
Old 20 January 2019, 15:02   #19
mcbpete
Zone Friend
 
mcbpete's Avatar
 
Join Date: Oct 2004
Location: London, England
Age: 41
Posts: 239
Send a message via MSN to mcbpete Send a message via Yahoo to mcbpete
So just to clarify: As it currently stands ( v4.1.0 - the build from http://www.winuae.net/download/ ) is the closest accuracy as to what you'd hear coming from a real Amiga achieved by setting Interpolation to 'Sinc' or 'disabled' ?
mcbpete 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
Looking for the most accurate Paula audio emulation craig64 support.Other 69 23 July 2023 19:36
Paula's audio range is 9 octaves Foebane Nostalgia & memories 51 03 March 2018 14:00
Change Paula/CD Audio volume with a commodity Leandro Jardim request.UAE Wishlist 19 18 August 2015 00:01
Paula audio in RTG modes Mad-Matt support.WinUAE 8 13 May 2007 15:28
Amiga 4000 Paula Audio CU_AMiGA support.Hardware 50 01 March 2007 21:26

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 18:33.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.33520 seconds with 16 queries