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

Bahamut_ZERO_Clue

96000HZ audio impliementation code submission.

Post by Bahamut_ZERO_Clue »

Well I actually didn't think I could do it but I did it. Well, the sound is really messed up but it does work a little bit although I probably need to adjust the buffer rate a bit more. I'll keep pluggin away at it though.

================================================
line 504 of cfgload.c

- WRITE_LINE("; 6 = 48,000 Hz\r\n\r\n");
+WRITE_LINE("; 6 = 48,000 Hz, 7 = 96,000 Hz\r\n\r\n");

line 818 of winlink.cpp

+ case 7:
+ wfx.nSamplesPerSec = 96000;
+ SoundBufferSize=1024*12;
+ break;

line 951 of winlink.cpp

+ case 7:
+ wfx.nSamplesPerSec = 96000;
+ SoundBufferSize=1024*12;
+ break;

line 1833 of guiwindp.inc

+GUISoundTextB8 db '96000HZ',0

line 1412 of guikeys.inc

- .sampratenext db 1,4,5,6,2,3,0,0,0,0
+.sampratenext db 1,4,5,6,2,3,7,0,0,0

line 2578 of guimouse.inc

- sampratenext db 1,4,5,6,2,3,0,0,0,0
+sampratenext db 1,4,5,6,2,3,7,0,0,0

================================================

Well Nach here's 50 dollars worth of coding dude. JK:P... I'll try and contribute something to the ZSnes project when I get a chance.:) Money's been tight since I recently got a new job but I'll do anything I can that will help even if only miniscule.
Last edited by Bahamut_ZERO_Clue on Thu Feb 23, 2006 4:52 am, edited 1 time in total.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

WOW.

I didn't think you were going to go this far to get it in...
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

Well, it from the edit it sounds aweful but it does prove it can be done with some minor adjustments to the output buffer.

Edit:

I did some reasearch into the problem and I THINK it's somehow connected to the MinGW DirectSound code which is still DX8 and AFAIK DX8 never had any support for 24bit/96khz audio chipsets and cards or impliementations on that part but I'll keep reasearching. I'll get this right or... any help or assistance would be nice.
Starman Ghost
Trooper
Posts: 535
Joined: Wed Jul 28, 2004 3:26 am

Post by Starman Ghost »

You know the 50$ was a joke right?
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

Yeah :P I got the joke. Took me a few moments but I got it. Anywho any suggestions or comments?
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Bahamut_ZERO_939 wrote:Well, it from the edit it sounds aweful but it does prove it can be done with some minor adjustments to the output buffer.

Edit:

I did some reasearch into the problem and I THINK it's somehow connected to the MinGW DirectSound code which is still DX8 and AFAIK DX8 never had any support for 24bit/96khz audio chipsets and cards or impliementations on that part but I'll keep reasearching. I'll get this right or... any help or assistance would be nice.
I don't really think that's the case...

Some stuff I found with Google...
http://support.microsoft.com/?id=316638
http://support.microsoft.com/kb/308883/EN-US/
http://kxproject.lugosoft.com/tech.php?language=en
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

So basically until this can be fixed within Windows you'd have to downmix the 96khz to something like 48khz or less... or get the hotfix.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Bahamut_ZERO_939 wrote:So basically until this can be fixed within Windows you'd have to downmix the 96khz to something like 48khz or less... or get the hotfix.
Mmm... it's been fixed... but if you didn't understand the context of the fixes, they explain in their descriptions that 24-bit audio is allowable for DirectSound...

Strangely enough, I don't know why we're never able to manually adjust the audio bitrate (I think that's the correct term)... hmm..
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

Yeah and it looks like ZSnes is using a bitrate of 16 currently as read from lines... I'd like to see what Nach did to get some ideas.
byuu

Post by byuu »

Yeah and it looks like ZSnes is using a bitrate of 16 currently as read from lines...
uint32 sample_24 = uint16(sample_16) << 8;

Or if you really want to go all out here:
sample_24 = (sample_16 << 8) | (sample_16 >> 8);

Can't you at least just use 96khz with 16-bit samples? You're basically just making up data that isn't there. At all.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

http://zsnes.game-host.org/~pagefault/top.ogg

This is what your code produces.
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Great coding there, Bahamut.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

pagefault wrote:http://zsnes.game-host.org/~pagefault/top.ogg

This is what your code produces.
Awful, but somehow funny...
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Lord Alpha
Lurker
Posts: 165
Joined: Wed Jul 28, 2004 3:15 am
Location: The Land of Insanity
Contact:

Post by Lord Alpha »

creaothceann wrote:
pagefault wrote:http://zsnes.game-host.org/~pagefault/top.ogg

This is what your code produces.
Awful, but somehow funny...
Agreed. Maybe this should be put in ZSNES anyway, as an easter egg or something :P

(j/k)
It is better to be silent and thought a fool then to open your mouth and remove all doubt

I am Zophar, Master of Sh*t!

[url=http://archlyn.bravejournal.com]View my blog[/url]
FitzRoy
Veteran
Posts: 861
Joined: Wed Aug 04, 2004 5:43 pm
Location: Sloop

Post by FitzRoy »

Ironic hilarity.
www.zapatabase.com
funkyass
"God"
Posts: 1128
Joined: Tue Jul 27, 2004 11:24 pm

Post by funkyass »

:D
Does [Kevin] Smith masturbate with steel wool too?

- Yes, but don’t change the subject.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

:lol: :twisted: :wink:
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
snkcube
Hero of Time
Posts: 2646
Joined: Fri Jul 30, 2004 2:49 am
Location: In front of the monitor
Contact:

Post by snkcube »

pagefault wrote:http://zsnes.game-host.org/~pagefault/top.ogg

This is what your code produces.
Oh man, I can't stop laughing.
Try out CCleaner and other free software at Piriform
Image
-_pentium5.1_-
Lurker
Posts: 110
Joined: Sat Sep 04, 2004 7:55 pm
Location: USA

Post by -_pentium5.1_- »

Um, what exactly is the problem with this code? If it generates 24-bit samples, it should be modified to generate 16-bit samples. (Sorry if I'm not reading the code carefully enough. DirectSound *does* support 96kHz x 16bits, right?) Since 96kHz is exactly 3 times 32kHz, it should theoretically be possible to get very clean sound with proper buffering. I know I'm not taking enough time to understand the issue, but what exactly is holding this code back from production?
This signature intentionally contains no text other than this sentence.
Starman Ghost
Trooper
Posts: 535
Joined: Wed Jul 28, 2004 3:26 am

Post by Starman Ghost »

-_pentium5.1_- wrote:Um, what exactly is the problem with this code? If it generates 24-bit samples, it should be modified to generate 16-bit samples. (Sorry if I'm not reading the code carefully enough. DirectSound *does* support 96kHz x 16bits, right?) Since 96kHz is exactly 3 times 32kHz, it should theoretically be possible to get very clean sound with proper buffering. I know I'm not taking enough time to understand the issue, but what exactly is holding this code back from production?
Did you listen to pagefault's recorded output with his code? It doesn't work.
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

winamp reports it as 44khz isnt it meant to be 96khz 24bit?
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
Aerdan
Winter Knight
Posts: 467
Joined: Mon Aug 16, 2004 10:16 pm
Contact:

Post by Aerdan »

It's 44kHz at 96kHz speed.
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

AFAIK DirectSound can only produce up to 48000hz with 16bit samples, I'm still researching and I haven't had too much time to work on this. I have some time this week do do some more coing so I'll get back to work and see what I can figure out.

BTW I know it sounds like a cat getting rubbed by a cheese graiter (aka awful as hell). 24bit sampling is needed for anything over (again) 48khz AFAIK.
xaimus
SUICIDE BOMBER LOLz
Posts: 149
Joined: Fri Jul 30, 2004 2:45 am

Post by xaimus »

pagefault wrote:http://zsnes.game-host.org/~pagefault/top.ogg

This is what your code produces.
ahaha
ahahha
AHAHAHHHAAAHAHAAH

I haven't laughed this hard in a loooong time.
kode54
Zealot
Posts: 1140
Joined: Wed Jul 28, 2004 3:31 am
Contact:

Post by kode54 »

Bahamut_ZERO_939 wrote:AFAIK DirectSound can only produce up to 48000hz with 16bit samples
No.
BTW I know it sounds like a cat getting rubbed by a cheese graiter (aka awful as hell). 24bit sampling is needed for anything over (again) 48khz AFAIK.
No again.

You missed all the lovely tables in cpu/dspproc.asm. BufferSize, BufferSizes, SoundSpeeds, SBToSPCSpeeds, NumofSPCBlock... No, wait, I'm making this too easy for you.

For a start, maybe you should make the effort to test this crap on your own system before submitting patches. Not like you'll notice over all the placebo.
Post Reply