16-bit stereo 32 kHz streaming success

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
johannesmutlu
Posts: 31
Joined: Fri Mar 11, 2011 2:22 pm

Compremises has to be made

Post by johannesmutlu »

While the snes is able to stream uncompressed true 16bit sound trough software,but that will eat up all the availible ram and cpu power inside the snes,so sadly,despites the soundchip has it's own proccesor,theres no room for proccesing any game logic or FMV data.
Maybe if we reduce those samples down to 8bit,then there will be room for game data etc,,,
But if you want a game with non-stop near cd quality audio,you need to stick an external soundchip inside your homebrewed snes game.
While the sega genesis has 1 8bit dac,the Z80 can control it so there will be no hit in performance , the genesis also has a psg chip were you can trickery simulate 1bit pcm,so even digital stereo sound is also possible on the genesis(!).
Trough the snes can somehow interpolate those 4bit brr samples back to 16bit along with gaessian noise filtering etc,, all without taking a hit in performancet on the main cpu but that’s it
Last edited by johannesmutlu on Sun Mar 05, 2023 1:38 pm, edited 3 times in total.
gamax92
Posts: 27
Joined: Sun Apr 10, 2011 12:05 pm
Location: Earth
Contact:

Post by gamax92 »

for the snes9x it does crackle and pop and sound really bad but go to
Sound > Playback Rate > 35KHz
or
Sound > Playback Rate > 48KHz

Those are the two that made it sound better.
dext3r
Posts: 14
Joined: Fri May 06, 2011 1:03 pm

Post by dext3r »

wow this is awesome! sounded ok for me on snes9x with directsound.

just awesome!
johannesmutlu
Posts: 31
Joined: Fri Mar 11, 2011 2:22 pm

Re: 15 or 16bit audio???

Post by johannesmutlu »

blargg wrote:I noticed that the DSP configuration I used wasn't as loud as it could be, and thus wasn't using the full DAC precision. Here's an updated one: blargg_near_cd_quality2.7z (mirror). I've also updated the link in the original message.

Before I had a single FIR constant of $3F (49%) and evol of $7F (99%). I had used the $3F because I was getting what sounded like overdriving when I was first developing the technique. I tried again yesterday and couldn't hear any of that, so I changed the FIR constant to $80 (-100%) and evol to $80 (-100%). Combined these give exactly 100%, i.e. no change in volume. There's no way to get +100%, so I used the two negatives to cancel each other out. This still technically only gives 15 bits per sample, due to the DSP always clearing the low bit during echo calculation, but there's no way around that.
The snes has 2 16bit dac’s and the sound demo says “near CD quality 16bit 32khz stereo”, it sounds 16bit to my ears,so it is and it must be absolutely 16bit,i asked people who clearly documented the snes audio system as well as people massuring the audio output of the snes with certain instruments,and they confirmed me that the audio output of the snes is indeed 16bit.
Last edited by johannesmutlu on Wed Feb 16, 2022 6:21 pm, edited 1 time in total.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: 16-bit stereo 32 kHz streaming success

Post by tepples »

A 15-bit stereo DAC is still a heck of a lot better than the 8-bit mono DAC (plus hard-panned FM and PSG channels) on the Genesis.

BRR is 4-bit, but it has emphasis filters and volume companding (the "shift") to improve dynamic range. And in a practical composition, different channels mask other channels' noise to an extent. Remind me when I get home and I might make an example showing exactly how lossy BRR doesn't sound.
AWJ
Posts: 433
Joined: Mon Nov 10, 2008 3:09 pm

Re: 15 or 16bit audio???

Post by AWJ »

johannesmutlu wrote:Huh,what,are you saying that those streamed samples are not 16bit but 15bit? Are those ADPCM samples in snes titles also just only 15bit??
Well ,if the snes can only stream 15bit sound,then it makes no sense to put 2 16bit DAC's inside a snes,in this can as a snes fan,i will feel myself soooo misleaded after all these years being dissappointed,but maybe am wrong maybe it could still generate 16bit but maybe at only 22 or 11 khz.
I don't know,i hope i have it wrong,maybe 15bit was just a typo,but if this is not generating 16bit,then it should,ve been called 15bit.
But again,i suppose it should be able to generate 16bit audion,hence those 2 16bit dacs!!??
THX.
If I understand things correctly, it's only the echo buffer that's effectively 15-bit. This streaming technique bypasses most of the DSP hardware (which is designed to play compressed samples, not to stream raw PCM) It's the audio equivalent of the DMA bitmap trick.
magno
Posts: 193
Joined: Tue Aug 15, 2006 5:23 am
Location: Spain
Contact:

Re: 16-bit stereo 32 kHz streaming success

Post by magno »

Sorry to re-float such an old thread, but I'm researching about SNES audio sub-system and its maximum usable bandwidth and watched a youtube video about this same blargg's ROM. I would like to have a look to the code, but both download links are broken.
Is there any other mirror where I can download the ROM?

Thanks!
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: 16-bit stereo 32 kHz streaming success

Post by KungFuFurby »

I have the ROM (or at least its most recent version). :D
Attachments
blargg_near_cd_quality2.smc
(4 MiB) Downloaded 432 times
magno
Posts: 193
Joined: Tue Aug 15, 2006 5:23 am
Location: Spain
Contact:

Re: 16-bit stereo 32 kHz streaming success

Post by magno »

KungFuFurby wrote:I have the ROM (or at least its most recent version). :D
Thanks!! I would like to do some test with audio programming in SNES, streaming samples to APU using HDMA... blargg's code for the SPC-700 could be useful because reduces at maximum acknowledge of samples in register $2140, so I can use HDMA without caring about SPC-700 getting the samples on time.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: 16-bit stereo 32 kHz streaming success

Post by lidnariq »

Discussion elsewhere led to people wanting to insert their own audio into Blargg's demonstration ROM above, so I wrote something that would cook ordinary stereo 16-bit 32kHz WAV files into the BRR-like format Blargg used in the above "blargg_near_cd_quality2.smc"

You will need:
The first 64KiB of the above "smc" file
At most 60.48 seconds of WAV file (blargg's code strictly only works from banks $C1 to $FF, each bank holds 2048×15 stereo samples)

Blargg's format is BRR-like: each sample has 8 bits of mantissa, and every 15 stereo samples shares an exponent.

Append the converted audio after the first 64KiB from blargg.
Attachments
wav2blarggenc.c
(2.81 KiB) Downloaded 37 times
Post Reply