From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26228 invoked from network); 17 Feb 2021 00:10:43 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 17 Feb 2021 00:10:43 -0000 Received: from wopr.sciops.net ([216.126.196.60]) by 1ess; Tue Feb 16 19:06:00 -0500 2021 Received: (qmail 33114 invoked from network); 16 Feb 2021 16:05:51 -0800 Received: from 100.43.142.88.rev.sfr.net (HELO aib.nope) (qwx@88.142.43.100) by wopr.sciops.net with SMTP; 16 Feb 2021 16:05:51 -0800 Message-ID: From: qwx Date: Wed, 17 Feb 2021 01:05:47 +0100 To: 9front@9front.org In-Reply-To: <71E80890743ACBD0D641DECE5D327028@arrow.hsd1.ca.comcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: lossless leveraged HTTP base strategy Subject: Re: [9front] games/snes audio patches Reply-To: 9front@9front.org Precedence: bulk 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" 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