96000HZ audio impliementation code submission.

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

byuu

Post by byuu »

What exactly is the problem with paying the developers to do something, anyway? It isn't like asking money for a ROM hack or something. Emulation has been ruled legal countless times in court (Bleem! for example charged for their emulator), and the software was written by the ZSNES authors with no trade secrets from Nintendo, so why can't they charge you even to add in your own code? It takes them time to verify your code works well on the majority of systems and to add it in there. And you're free to compile your own build and release that yourself. That's what GPL is for. Not for stopping project donations.

That said, I've spent over a week writing code for ZSNES to have it not used -- real code too, lots of assembler routine modifications and tracking obscure stuff down, so I know how you feel. But it isn't my software so if they don't want to add the changes, so what?
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

byuu wrote:That said, I've spent over a week writing code for ZSNES to have it not used -- real code too, lots of assembler routine modifications and tracking obscure stuff down, so I know how you feel. But it isn't my software so if they don't want to add the changes, so what?
What exactly were you adding/fixing?
sweener2001 wrote:and comparing professional and consumer products is retarded. if you're a professional, you buy the professional equipment. if you're a consumer, you buy the x-fi. what a surprise that the x-fi is catered to its target market.
I wasn't intending to compare professional products with gamer products. The very good marketing Creative had convinced people (probably still does) that the SB Live was good as the professional equipment... only to find out the truth... obvious you want to buy the professional version that uses the same chip (EMU branded - also owned by Creative)...
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
byuu

Post by byuu »

What exactly were you adding/fixing?
No reason to bring it up since it was four years ago, just some GUI changes.

I'm thinking a card with the VIA Envy24HT would be good. Supports up to 24/96khz (says 192khz, but who knows), and as low as 32khz with no resampling, bit-perfect ASIO output.
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

I'm thinking a card with the VIA Envy24HT would be good. Supports up to 24/96khz (says 192khz, but who knows), and as low as 32khz with no resampling, bit-perfect ASIO output.

byuu,that's the chipset most Terratec cards use (when I mentioned the cards from Terratec as the competition)

P.S. I can't wait for the next release of bsnes.It's great to see how your emulator is getting so good in such a short time . It takes all the good points from NEStopia (focus mainly on emulation accuracy) and Snes9x (the GUI and options) and will be a great alternative to the mighty ZSNES.
Snes9x is many years behind though...(sad,because competition is always great,and the good old days of competition between SNES9x and ZSNES are gone)
Last edited by kick on Fri Mar 10, 2006 2:01 am, edited 2 times in total.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

kick wrote:
I'm thinking a card with the VIA Envy24HT would be good. Supports up to 24/96khz (says 192khz, but who knows), and as low as 32khz with no resampling, bit-perfect ASIO output.

byuu,that's the chipset most Terratec cards use (when I mentioned the cards from Terratec as the competition)
I've heard about that chipset.. I've heard good things about it.. except for the lack of hardware acceleration for gaming.. but that's about it.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

kick wrote:because competition is always great,and the good old days of competition between SNES9x and ZSNES are gone
Competition is good because it makes each product strive to be better resulting in better products for everbody.

However ZSNES has plenty of compeition in the emulation department being worked on, and we've always been number one in the feature area. Despite this ZSNES keeps on adding on features anyway. We don't need competition to be creative.

bsnes has plenty of competition from ZSNES in several areas, and surely SNEeSe for sound, and pretty much everything else regarding speed and extras.

I think we're doing alright, except for the fact we don't have a single emulator with close enough to perfect for every program.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

Terratec and M-Audio both use the Envy24HT. Supposedly the hardware acceleration doesn't do any good anymore since the host processor is usually much faster than the sound card chip. Who knows if that's true or if they're just cheap.

I don't consider ZSNES competition, more like just a different approach to the same goal. With 100 times my userbase, I'd say a damn good one at that. I submit most of my findings to the ZSNES team, and would be contributing fixes if I were better at working with assembler code I didn't write myself.
Nach/ZSNES and anomie/SNES9x have both given me quite a lot of code that makes up bsnes, moreso than I've given them in return.

I'll probably never be aiming for the speed crowd, at least not with an SNES emulator. Extras, I've been working on in this last release because the program honestly is almost to a generally usable state with only a few more basics thrown in there, but I'll probably be going back under the hood as soon as the debugger rewrite is finished and I can start fixing bugs again. SNEeSe, I don't know. I've got a better CPU<>APU bridge, but TRAC just knows his stuff way more than I do when it comes to sound, and I haven't seen anomie in a while (he's who wrote the initial DSP core that I ported into bsnes). I'll have to eventually start figuring out more of how the DSP works myself to improve it, I imagine. Not aware of any real problems with it as of now, though.
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

As long as ZSNES and your code are all GPL, you can legally charge for the software.

Look through the GPL sometime.
The GPL is not anti-capitalist; it actually works to eliminate the monopoly a proprietary software vendor has over its products. Among other things, anyone can get the ZSNES source code, anyone can write new code for it, and anyone can charge money to write/release this new code code (as long as they either release their additions under the GPL or never make a public release of an executable built with it).

As for audio, Nyquist's sampling theorem shows that a signal sampled at 32 kHz can capture frequencies up to 16 kHz, and that this signal can be resampled to any higher sample rate (and back down to 32 kHz again, if desired) without altering its frequency content. It can be resampled to 44.1 kHz, 48 kHz, 73.912738723 kHz, 96 kHz, 192 kHz, etc., without introducing any audible difference. I've personally written a sinc-based FIR resampler for my Super NES SPC music player and it's not at all inefficient to do the conversion. Computer displays are different; you can't resample something to a higher resolution and get the same output image, so special handling of different video resolutions is necessary.
Reznor007
Lurker
Posts: 118
Joined: Fri Jul 30, 2004 8:11 am
Contact:

Post by Reznor007 »

blargg wrote:As for audio, Nyquist's sampling theorem shows that a signal sampled at 32 kHz can capture frequencies up to 16 kHz, and that this signal can be resampled to any higher sample rate (and back down to 32 kHz again, if desired) without altering its frequency content. It can be resampled to 44.1 kHz, 48 kHz, 73.912738723 kHz, 96 kHz, 192 kHz, etc., without introducing any audible difference. I've personally written a sinc-based FIR resampler for my Super NES SPC music player and it's not at all inefficient to do the conversion. Computer displays are different; you can't resample something to a higher resolution and get the same output image, so special handling of different video resolutions is necessary.
Yeah, but that's with a good resampler. Most sound cards have a crappy one, and kmixer isn't any better.
byuu

Post by byuu »

Yeah, and doing it in software is fine if you're resampling from 32khz->known, static frequency. What if your program ends up running at different speeds based on CPU usage of the current part of the program, thusly your frequency changes constantly? Each n sample buffer would need to be scaled differently, and I just can't see that being pulled off very well.

I've always thought this 96/192khz stuff was kind of mad considering there's no evidence people can hear above ~40khz or so anyway. Halve that for Nyquist.
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

I thought the range for the human ear was ~20Hz-20kHz ?

-shrugs-
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

No wave frequencies higher than 20 kHz can be represented with a 40 kHz sample rate.

I wonder if the 96/192 kHz sample rates exist as some kind of remedy for sucky resampling (due to the higher resolution, imagine "nearest point" filtering at 1.333x vs 13.33x). And I guess the higher sample rate helps if you'd want steps that with a 48 kHz sample rate would ie. be between 101010 (24 kHz) and 11001100 (12 kHz) (ones and zeros representing different sample values). I guess it's more about added resolution than higher frequencies.
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

96kHz exists to:

- prevent aliasing of high-quality sounds,especially FM,RM or analog-based synthesized sounds.
- improve resampling quality,especially used by X-Fi's DSP resampling algorithm
- improve the flatness of the frequency response curve of the soundcard (like the benefit having perfect gamma in monitors)
- introduce lower IMD distortion values.THD is tolerable,but IMD,even in small quantities sounds horrible.
- for internal high-quality DSP effects processing in soundcards (to achieve high-quality DSP effects)

96kHz has many benefits,but 192kHz is overkill and nearly nobody uses it,even professionals dislike 192kHz.

You can't compare a high-quality 256-tap sinc filter with crappy point sampling or sucky bilinear interpolation.
M-Audio makes great semi-pro cards too :)
Last edited by kick on Tue Jan 15, 2008 6:49 am, edited 2 times in total.
sinamas
Gambatte Developer
Gambatte Developer
Posts: 157
Joined: Fri Oct 21, 2005 4:03 pm
Location: Norway

Post by sinamas »

kick wrote:You can't compare a high-quality 256-tap sinc filter with crappy point sampling or sucky bilinear interpolation.
I'm well aware of that, I was trying to illustrate how higher resolution may improve resampling accuracy. Point sampling is easier to visualize.
FitzRoy
Veteran
Posts: 861
Joined: Wed Aug 04, 2004 5:43 pm
Location: Sloop

Post by FitzRoy »

I question some of those as advantages. I have a high end soundcard with Sennheiser HD580 headphones, and I can only just barely pick up the difference between a 16/48 and 24/96 version of a file. And I'm a huge audio buff.

Now, those were seperate recordings. Here, we're dealing with an upsampling from 32khz, where no new original information is gained.

Now consider my setup, which is probably in the 1% echelon of users.

Now consider this is a Super Nintendo which isn't exactly wav sound. It's practically a friggin high end midi chip.

Now consider how absolutely FANATICAL this entire 96khz effort is. THD improvements? Are you kidding me?

PS to Nach. I'm not exactly sure I would say SneEse is competing with bsnes' sound. The two sound the same to me, and emulate the oh-so common rape correctly. Second, so long as authors are helping each other, I wouldn't say anyone is competing. I'd actually be careful of that. I needn't tell you how kids on the internet love to voice their favorites and turn collaboration into war.
www.zapatabase.com
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

96kHz exists for:

1. To prevent aliasing of high-quality sounds,especially FM,RM or analog-based synthesizers.
2. To improve resampling quality,especially used by X-Fi's DSP resampling algorithm
3. To improve the flatness of the frequency response curve of the soundcard (like the benefit having perfect gamma in monitors)
4. To introduce lower THD and IMD distortion values.
5. For internal DSP effects processing in soundcards to achieve high-quality DSP effects.
One use of a higher hardware rate is to account for the finite transition band in the analog filter after the DAC. A DAC's output has harmonics above the desired range, so these must be filtered out. It's less-demanding on the analog filter if the space between these harmonics and the signal is wider, which is what a higher sample rate does.

Once you have the DAC portion working optimally, the rest can be done in software. Any synthesized sound can be band-limited before sending it to the DAC, eliminating all aliasing. A higher sample rate is absolutely not required. Of course, it might be more cost-effective to do less band-limiting in software and rely on a higher-rate DAC-filter combination, since the computational load can be significant. I take it that this was the intended approach here, to account for sub-optimal resampling performed by the OS, something that can't easily be bypassed.

I must say, I'm near my limit of fluffy talk about subjective audio quality.
Now consider how absolutely FANATICAL this entire 96khz effort is. THD improvements? Are you kidding me?
I bet we could get the same perceived quality improvements by having ZSNES and Windows claim that it's outputting at 96 kHz or 192 kHz :)
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

A quick question.. does resampling affect audio quality more when the original frequency is low? (example, 11/22KHz -> 44/48 KHz)

I'm starting to think the impact of resampling is not as significant as one would make it out to be (obviously it depends on the resampling algorithm, but I'm wondering in general).
FitzRoy wrote:PS to Nach. I'm not exactly sure I would say SneEse is competing with bsnes' sound. The two sound the same to me, and emulate the oh-so common rape correctly. Second, so long as authors are helping each other, I wouldn't say anyone is competing. I'd actually be careful of that. I needn't tell you how kids on the internet love to voice their favorites and turn collaboration into war.
With my limited dealing with SNEeSe, I'm inclined to at least agree that it is closer to the real thing (well, for the SPC rape anyway) that most other SNES emulators. That's as far as that goes.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
FitzRoy
Veteran
Posts: 861
Joined: Wed Aug 04, 2004 5:43 pm
Location: Sloop

Post by FitzRoy »

It's funny. I'm not a rocket scientist. I don't know the intricacies. All I know is that there is a logic that comes before all that mumbo jumbo. It's separate from it. Upgrading your sound card or speakers is going to improve the sound. More accurate spc emulation is going to improve the sound (that 96khz isn't going to stop the starfox engine distortion is it? Misplaced concern from 96khz whores, hmm?). Making up data that wasn't there isn't going to do squat, and even if it did, it would be so small and so subtle, you'd need a graph to point it out to yourself.

It's the same thing with audio cds. Every time, it's the (re)mastering quality, not a dvd-audio sample rate that has the largest effect on how good it sounds on the same equipment. It's not the sample rate that makes dvd-audio perceivably better. It's the multi-channel and usual remaster that tricks you into thinking so. Not only is the sample rate difference subtle, you need expensive ass equipment to hear it. There's overkill, and then there's overkill and then there's overkill.
With my limited dealing with SNEeSe, I'm inclined to at least agree that it is closer to the real thing (well, for the SPC rape anyway) that most other SNES emulators. That's as far as that goes.
I'm going to have my digital snes to record some uncompressed wav files of popular games in a few weeks. When I do, they will be made available for an objective and subjective comparison. bsnes can output wav files, so it should be easy to obtain virgin wavs from it. I dunno about sneese or others.
www.zapatabase.com
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

FitzRoy wrote:It's funny. I'm not a rocket scientist. I don't know the intricacies. All I know is that there is a logic that comes before all that mumbo jumbo. It's separate from it. Upgrading your sound card or speakers is going to improve the sound. More accurate spc emulation is going to improve the sound (that 96khz isn't going to stop the starfox engine distortion is it? Misplaced concern from 96khz whores, hmm?). Making up data that wasn't there isn't going to do squat, and even if it did, it would be so small and so subtle, you'd need a graph to point it out to yourself.

It's the same thing with audio cds. Every time, it's the (re)mastering quality, not a dvd-audio sample rate that has the largest effect on how good it sounds on the same equipment. It's not the sample rate that makes dvd-audio perceivably better. It's the multi-channel and usual remaster that tricks you into thinking so. Not only is the sample rate difference subtle, you need expensive ass equipment to hear it. There's overkill, and then there's overkill and then there's overkill.
I'm pretty sure that the quality of something is only as good as its source...
I'm going to have my digital snes to record some uncompressed wav files of popular games in a few weeks. When I do, they will be made available for an objective and subjective comparison. bsnes can output wav files, so it should be easy to obtain virgin wavs from it. I dunno about sneese or others.
That would be appreciated.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

Here's some fresh competition for X-Fi cards:

New soundcard coming from Razer.

http://www.razerzone.com/

Razer Barracuda AC-1 Gaming Audio Card

The Razer Barracuda™ AC-1 Gaming Audio Card features a 7.1 channel output, 24 bit audio technology and unprecedented 117dB SNR (output).

The 117bB Signal to Noise Ratio (output) specification clearly outperforms all current soundcards in the market that only perform up to an average of 105dB. The Razer Barracuda AC-1 Gaming Audio Card is the world’s first gaming audio card that performs up to a 117dB SNR.

Gaming-specific positional audio, Powered by Razer Fidelity™, allows gamers to take advantage of an expanded dynamic soundstage for gaming tuned frequencies with Razer ESP™ (Enhanced Sonic Perception™). The in-built audio chip processes and optimizes audio signals from games to provide the ultimate positional gaming audio experience through the Razer 3D (720?) Positional Gaming Audio Engine™.

The Passive EMI shield™ minimizes electromagnetic interference (EMI) by preventing unwanted interference from graphics cards and other electrical devices that may affect the gaming audio performance.

The Razer Barracuda AC-1 Gaming Audio Card also features optimized proprietary software drivers to provide for the prioritization of enhanced gaming audio signals while leaving as small a memory footprint as possible.

Razer HD-DAI™ (High Definition—Dedicated Audio Interface) further optimizes the Razer Barracuda IAS gaming audio experience by allowing for a proprietary connection for optimized signal transmission when used with the Razer Barracuda HP-1 Gaming Headphones.



...but one major thing: No EAX,and it's useless for anything other than gaming (Audio Recording/Creation ,for example) It's no all-rounder like the X-Fi cards from Creative.
FitzRoy
Veteran
Posts: 861
Joined: Wed Aug 04, 2004 5:43 pm
Location: Sloop

Post by FitzRoy »

Fuck EAX. It is a proprietary extension. In fact, any "gaming" immersion tech is stupid to begin with and only usable in games where you embody something with surroundings. Even then, the games have to support it. What use are "3d" sound tricks in a strategy game? Platformer? Fighting? Puzzle?

In the end, audio is nowhere near as elaborate as video. It's just hilarious to me to see Creative pretending to be the "nvidia" or "ati" of audio, and to see people buy into it. ARRR ExTReME GaMing SoUnd JusT for GamerZ! Your statement about this card being only useful for gaming solidifies it. Gee, wouldn't that pretty SNR have the same improvement for music and movies as well as games? :roll:

I'll keep an eye out on this product.
www.zapatabase.com
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

FitzRoy wrote:Fuck EAX. It is a proprietary extension. In fact, any "gaming" immersion tech is stupid to begin with and only usable in games where you embody something with surroundings. Even then, the games have to support it. What use are "3d" sound tricks in a strategy game? Platformer? Fighting? Puzzle?
3D sound tricks are mostly applied to FPS.. sadly. EAX is really glorified reverb... there isn't any real "work" being done.. programmers just specify room environment and the specific setting and that's it. No real (physics) algorithm is applied.
In the end, audio is nowhere near as elaborate as video. It's just hilarious to me to see Creative pretending to be the "nvidia" or "ati" of audio, and to see people buy into it. ARRR ExTReME GaMing SoUnd JusT for GamerZ! Your statement about this card being only useful for gaming solidifies it. Gee, wouldn't that pretty SNR have the same improvement for music and movies as well as games? :roll:

I'll keep an eye out on this product.
I kinda wish the audio market was like the video card market (I'm not clear on what's stopping other people from implemented some cool audio tech)...

The stupid thing about specs though is that sometimes they aren't entirely useful (like MIPS for processors for example). It is all about the marketing these days.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

3D sound tricks are mostly applied to FPS.. sadly.
What about RPGs and driving/flight sims? They are mostly needed there,not just in FPS.

Gee, wouldn't that pretty SNR have the same improvement for music and movies as well as games?

I'll keep an eye out on this product.
I wouldn't count on it,cause it uses crap I would stay away from,like PROPRIETARY connectors,uhh :(
I won't be able to do jack shit with this kind of soundcard,like not having analog recording and not having analog sound and headphone outputs.That sucks ass.
You have to buy their overpriced "gaming" headphones to use them with this card.Normal ones or high-end (like Senns or AKGs) won't connect at all.

I'll still stay with theX-Fi Fatal1ty FPS or Elite Pro,and rather buy an E-MU 1212m instead of the Razer,if I'm not into gaming.
Last edited by kick on Mon Mar 13, 2006 2:23 am, edited 1 time in total.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

kick wrote:
3D sound tricks are mostly applied to FPS.. sadly.
What about RPGs and vehicle/flight sims? They are mostly needed there,not just in FPS.
I suspect RPGs do get EAX.. but I can't say much about flight sims though.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

I'm going to have my digital snes to record some uncompressed wav files of popular games in a few weeks. When I do, they will be made available for an objective and subjective comparison. bsnes can output wav files, so it should be easy to obtain virgin wavs from it. I dunno about sneese or others.

The best thing to do is get the udial.ape test tone from Hydrogen Audio,convert it to SNES stream format at 32kHz,using the best available resampler,make a SNES Test ROM to do streaming of the file as ToP,or even better- like the Breath Of Fire II Remake romhack will do,and run it in ZSNES at various samplerates and hear the difference.
Post Reply