Raw Audio

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

Post Reply
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Raw Audio

Post by Nach »

I want to get a raw audio dump from ZSNES.

Anyone know which buffer I should be trying to steal, and how I should be stealing it?
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Nightcrawler
Romhacking God
Posts: 922
Joined: Wed Jul 28, 2004 11:27 pm
Contact:

Post by Nightcrawler »

From what I gather, the raw sound data is contained in 'DSPBuffer'

As far as how.. I can't help too much but I can tell you a few things..


1.). You can rip that data from the windows port anytime there is a frame update and the DSPBuffer data is copied to the DirectSound primary buffer to be played. (UpdateVFrame() function)

2.) You can also find reference in the DOS port(sound.asm) where you can do the same thing.

3.) Same concept for the Linux port.. in the UpdateVFrame(void) function.

4.) To make one change to affect all ports, you can probably hit up 'dspproc.asm' and grab some data there. I'm a little rusty on my 32-bit x86 assembly and as always the ZSNES code annoys me with no comments ;) So, I'm not exactly sure where the best place to pull some data would be there.

As far as how you need to steal it. I think being that it should be RAW sound data, you just need to know the format the data is in(frequency, sample rate etc..) to play it back. I can grab that info from the DirectSound code if you want. I don't have much time to look at this stuff now.
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
anomie
Lurker
Posts: 151
Joined: Tue Dec 07, 2004 1:40 am

Post by anomie »

Nightcrawler wrote:As far as how you need to steal it. I think being that it should be RAW sound data, you just need to know the format the data is in(frequency, sample rate etc..) to play it back.
If you really have RAW SNES sound data, that'd be stereo 16-bit linear at 32000Hz. But i wouldn't be terribly surprised if zsnes is spitting out mono/stereo 8/16-bit linear (depending on the audio confifg) at the configured output rate into DSPBuffer...
Nightcrawler
Romhacking God
Posts: 922
Joined: Wed Jul 28, 2004 11:27 pm
Contact:

Post by Nightcrawler »

anomie wrote:
Nightcrawler wrote:As far as how you need to steal it. I think being that it should be RAW sound data, you just need to know the format the data is in(frequency, sample rate etc..) to play it back.
If you really have RAW SNES sound data, that'd be stereo 16-bit linear at 32000Hz. But i wouldn't be terribly surprised if zsnes is spitting out mono/stereo 8/16-bit linear (depending on the audio confifg) at the configured output rate into DSPBuffer...
You're right. The DirectSound buffer format is set depending upon the configuration. So, you'd have to grab the config info, then rip the data from the buffer. Add a WAV file header to it and then you could rip the data directly to a playable wave file.
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
Post Reply