[uae] Re: Sound tips for Linux

  • From: "Kjetil S. Matheussen" <kjetil@xxxxxxxxxxxxxxxxxx>
  • To: uae@xxxxxxxxxxxxx
  • Date: Wed, 12 Jul 2006 22:55:30 -0700 (PDT)

On Thu, 13 Jul 2006, Richard Drummond wrote:

Hi All

To get decent sound performance on E-UAE in Linux:

1) Use the latest source snapshot.
2) Compile against ALSA or OSS for sound (not SDL). SDL sound performs poorly
  under high CPU load in E-UAE on Linux. This is not something that's
  easily fixable. All future official builds will be built against ALSA
  instead.
3) When using ALSA, the default behaviour is the E-UAE uses the default ALSA
  device. What this is depends on your ALSA set-up, but this will probably
  use the ALSA dmix plugin on recent Linux systems. This may add to the CPU
  load and sound latency. By-pass the dmix plug-in with the config file
  option 'alsa.device=plughw:'.
4) Definitely don't use dmix with ALSA (or rather libasound) 1.0.9 or 1.1.10.
  The dmix configuration doesn't allow low latency set-ups there. You'll
  typically end up with a 300ms latency (unless you re-configure your dmix
  set-up). Yuck!
5) If you know that your audio system only supports a fundamental audio
  frequency, configure E-UAE to use that frequency. This will avoid
  unnecessary rate conversions. For example, the ALSA dmix plug-in is
  typically configured to work at 48000KHz. Set E-UAE's audio frequency with
  sound_frequency=48000.
6) If you can configure, build and install a Linux kernel yourself, build a
  pre-emptible kernel.

Note: if you have a 1 GHZ or better PC, there's really no reason why shouldn't
get decent audio performance in E-UAE on Linux. If you don't, it's probably a
configuration issue somewhere.

Comments, anybody?


Yes, as I have said earlier. Its impossible to get descent audio (ie. without clicks or large lag) in linux without running realtime. So the ideal solution is to put all things that can block, like graphics, disk, input, in their own threads which are communicated with thru lockfree ringbuffers. After that, set the main thread of e-uae to realtime, find points in the e-uae source where you can do proper sleeping that does not block the rest of linux or make e-uae run too slowly or unreliably. After that, you can safely lower the soundbuffer to something nice like 1-3 ms with a descent kernel, plus that you get a lot lower cpu-usage if everything is tuned correctly.


I have the knowledge to do the realtime and threading part, but unfortunately not the time to do the programming. But maybe I'll do it anyway. :-)

My ee-uae version of e-uae was a step towards the above goal, and it works quite well for system friendly midi-programs, but I haven't tried with audio.

Other related posts: