Welcome, Guest. Please login or register.

Author Topic: Paula Audio Emulation AudioUnit  (Read 4901 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline bloodlineTopic starter

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Paula Audio Emulation AudioUnit
« on: March 24, 2012, 10:11:59 AM »
Some time ago (2006 I think) Karlos and I were discussing the nonlinear nature of the Amiga's audio DACs and how that might colour the audio reproduction of samples.

Put simply the Amiga's audio DAC should take a number (henceforth known as a sample) and then produce an electrical voltage that is proportional to that number. Although the Amiga uses signed 8bit numbers, and positive and negative polarities the following simplified example should make it a little clearer:

A DAC can output any value between 0 and 5 volts, the Amiga has an 8bit audio DAC with means the output is divided into 256 discrete values, thus:

   0 -> 0.0000 volts
   1 -> 0.0195 volts
...
128 ->2.5000 volts
...
234 -> 4.5703 volts
...
255 -> 5.0000 volts

You get the idea...

And by altering the voltage a few thousand times every second, the Amiga can reproduce an audio signal.

But as mentioned above, the Amiga's DACs are nonlinear meaning they don't produce exactly the voltage one would expect... This is probably due to design limitations, engineering considerations and manufacturing defects, however it contributes to what makes the Amiga's audio output rather distinctive.

After some work, with Karlos's help, I managed to build a calibration table which listed the difference between the expected output value and the real output value which I wanted to use to colour an audio signal.

Now when playing an 8bit audio recording on 16bit hardware (i.e. modern audio hardware), each sample is simply multiplied by 256 to give the 16bit value... but I used my calibration table to give the value that real Amiga hardware would produce rather than what should have been produced.

For example:

The 8bit sample of 120 (Signed) would give a 16bit sample of 30720, but a real Amiga would have a value of 30816... simple :)

Ok, I have worked on and off on this idea for a few years, and last weekend I had a bit of free time and built a static converter to take an 8bit audio sample and then output a 16bit sample with the Amiga audio "distortion", to really see how much of a difference it makes:

First the original 8bit sample (depending upon your audio hardware this should sound the same as the linear upscaled 16bit version):
http://www.troubled-mind.co.uk/paula/ergo8.aiff

Now the Linear upscaled 16bit version (using simple mathematical conversion)
http://www.troubled-mind.co.uk/paula/ergo16.aiff

Now the Amiga distortion emulation 16bit version:
http://www.troubled-mind.co.uk/paula/ergopaula.aiff

If I'm really honest I can't tell the difference between them, I'm not sure that it was worth the effort... some feedback would be most welcome :)

Offline bloodlineTopic starter

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Paula Audio Emulation AudioUnit
« Reply #1 on: March 24, 2012, 05:32:25 PM »
:) thanks for your comments guys!

I'm thinking that the nonlinear nature is effectively dithering the sample... Which "should" improve the quality of a poor quality sample. I chose the "Ergonomically..." Audio as it is a classic well known 8bit sample from a 1991 Amiga game and it was easy enough to rip it.

My next test will be to record a clean 16bit audio at 44100, then down scale it using the best algorithms my expensive audio software can do, into 8bit 15040Hz and then run it through my static converter and see I we can hear the difference :)

Offline bloodlineTopic starter

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Paula Audio Emulation AudioUnit
« Reply #2 on: March 25, 2012, 09:54:33 AM »
Quote from: ChaosLord;685181
Thorham is correct.  The Amiga has at least a 14 bit DAC.  It might even have a 16-bit DAC where 2 of the bits are permanently unusable.
Not really, you can't count the 6 volume bits when talking about audio reproduction. The Amiga's audio chip is fed with 8bit signed integer values and at full volume, the DAC is an 8bit DAC... So those extra 6bits are simply altering the maximum output value, the resolution of the input remains 8bit.

Ok, if you are prepared to lose an audio channel, then you can modulate the volume in time with the audio sample and get 14bits... But that is a special case and not part of what I'm trying to do :)

Offline bloodlineTopic starter

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Paula Audio Emulation AudioUnit
« Reply #3 on: March 25, 2012, 10:00:23 AM »
Quote from: Karlos;685140
Didn't we also conclude that aliasing played a big part in the colouring of Paula's audio?

I found that for certain bright sounds, like cymbals, there were quite noticeable effects as you approached the regular PAL 27kHz playback limit, specifically a bit like the old aphex corp's "aural exciter" effect.
Indeed, once I get the resolution issues sorted (An idea hit me last night at the pub with some friends)... I will look at how to recreate the effect of the amiga sample rates...