9front - general discussion about 9front
 help / color / mirror / Atom feed
From: qwx <qwx@sciops.net>
To: 9front@9front.org
Subject: Re: [9front] games/snes audio patches
Date: Wed, 17 Feb 2021 01:05:47 +0100	[thread overview]
Message-ID: <E11041E82294C6367F454FD9D2B81DF9@wopr.sciops.net> (raw)
In-Reply-To: <71E80890743ACBD0D641DECE5D327028@arrow.hsd1.ca.comcast.net>

Hi,

> I noticed that the audio of games/snes was pretty bad for most games I
> tried, so I did some bug hunting and found a few. Patches are attached.

These look good to me, the results are great, good job!  I'm in favor
of pushing patches 1-3 and 5.


> Finally, I saw that it was using nearest-neighbor upsampling from 32
> kHz to 44.1 kHz, which results in noticable aliasing. My first
> thought was to pipe the output through audio/pcmconv which has a
> high-quality resampler. However, games/snes uses audio write blocking
> to control the emulation speed, so using a pipe here was problematic.
> It would fill up the pipe buffer, then hang while pcmconv wrote the
> upsampled data to /dev/audio, then repeat. Anyone have ideas about a
> good way to reuse the pcmconv resampler for this (maybe split off into
> a library)? For now, patch 4 changes it to use linear interpolation,
> which is a big improvement and may be good enough.

From: "Steve Simon" <steve@quintile.net>
Date: Mon, 15 Feb 2021 10:55:09 +0000
To: 9front@9front.org
Subject: Re: [9front] games/snes audio patches
> nearest neighbour is a crude upconverter, linear is much better,
> a halfband filter with a few taps (maybe 8) should be good enough IMHO,
> though I am not a game player so you may disagree. You can improve the
> resolts of a short halfband filter by feeding it your linerly interpolated
> stream.
> 
> Don't be tempted to filter only the missing samples as you are likely
> to have gain or/and phase ripples due to the rounding errors of your
> coeficents. itsbetter to filter everything equally well/badly.
> 
> -Steve

As Steve points out, there may be additional adjustments to improve
upsampling.  I don't know much about dsp, but we could either try some
more stuff, or if you think you're not up to it for now, push your patch
which already improves it, and add more further on.  Steve's suggestions
seems relatively simple to try out.  Using pcmconv is a nice idea, but I
think it's overkill.  Either waiting for pcmconv to write to /dev/audio,
or feeding back its input to games/snes, or completely decoupling audio
from timing seem more complex to do correctly than just try to add some
simple processing.  Perhaps if more improvements will blow up the code
size, your linear interpolation might be just fine.

The other patches should be imported imo.

Thanks for your great work!

qwx

  parent reply	other threads:[~2021-02-17  0:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 10:25 Michael Forney
2021-02-15 10:55 ` Steve Simon
2021-02-17  0:05 ` qwx [this message]
2021-02-17  5:31   ` Amavect
2021-02-17  9:10     ` hiro
2021-02-17  9:32       ` Steve Simon
2021-02-17  9:57         ` hiro
2021-02-17 10:24           ` qwx
2021-02-17 10:53     ` hiro
2021-02-21 11:06 ` [9front] " Michael Forney
2021-02-22  0:32   ` qwx
2021-02-22 15:15   ` qwx

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E11041E82294C6367F454FD9D2B81DF9@wopr.sciops.net \
    --to=qwx@sciops.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).