• HomeBoards
  • RulesRules
  • HelpHelp
  • WikiWiki
  • Donate

Author Topic: What are the odds of getting "perfect" SNES Sound emulation?  (Read 7260 times)

Haze (OP)

  • Posts: 13
Just a quick question, how likely is it that we will see "perfect" sound emulation on the GCW Zero. Getting enhancement chip games running is great but it would be nice if Mario getting a mushroom in Super Mario World sounded right! :)

Nebuleon

  • Guest
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #1 on: August 07, 2014, 01:18:26 am »
Yes, there are weird sound bugs (extended notes, short notes and deleted notes) even with the best audio syncing option in the Snes9x core. I have noticed this, but don't know exactly what happens.

My first guess is that the audio buffer is sometimes getting refilled at the start and end of the same frame (lengthening notes) and the next time is at the start of the second next frame, skipping one (shortening notes, or deleting those shorter than a frame - which I assume the mushroom sound is using).

My second guess is a data race between the audio thread and the Snes9x core, which gets me sound for a SNES state that is still advancing between the start and the end of my request.

If neither of those is it, I'd have to get recordings from you on Snes9x/PC and PocketSNES/GCW0 and zoom them in Audacity. On OpenDingux you can apparently use 'arecord' (ALSA record), but I don't know if that captures the speaker output or records from the microphone. On Windows you could use Stereo Mix recording. Would that be alright with you?

Nebuleon

  • Guest
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #2 on: August 07, 2014, 10:05:20 am »
Please test this OPK, which is issued from my audio-fixes branch of PocketSNES:

Download: https://dl.dropboxusercontent.com/u/106475413/gcw-zero/PocketSNES-20140807-1.opk

commit 4e22ea5: Synchronise on audio.

* The timing spin-loop using sal_TimerRead() in main.cpp:Run is now a sleeping loop in main.cpp:S9xSyncSpeed, reducing CPU usage (increasing battery life) and more closely matching the refresh rate of the LCD for 60 Hz games.
* The audio is kept active but muted if Sound is set to OFF, because otherwise the emulation would not advance due to the above.
* The audio is not muted via S9xSetSoundMute anymore, because that is automatically undone if SNES Global Mute is enabled, then disabled.

Minor changes:
* 3 frames worth of audio are buffered instead of 2. Frames are now skipped if the number of frames worth of buffered audio falls below 2, except if using manual frameskip.
* Volatile variables are read less often in sal_sound.c.

This commit also fixes the following issues:
* The timing is off from a real SNES by 3%~5%.
* Sound may overrun multiple times per second, leading to a data race that causes SNES notes to lengthen, to shorten or to be deleted.

edit: '"Timing is off" is fixed' is a lie. It's not really fixed; I went and tested the timing of Yoshi's Cookie-US/SNES on a real SNES. But the image and audio timing is much less jittery than before.
« Last Edit: August 07, 2014, 10:23:51 am by Nebuleon »

Malleus

  • Posts: 67
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #3 on: August 07, 2014, 12:24:57 pm »
Not at home to try it, but does that mean that you cant get some extra speed by turning off sound in this version?

Nebuleon

  • Guest
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #4 on: August 07, 2014, 12:52:27 pm »
Not at home to try it, but does that mean that you cant get some extra speed by turning off sound in this version?
That's what it means, yes. For exactly 4% added performance. I could leave the version of the timing check that doesn't rely on muted sound sync to work, and use it if sound is disabled, but counter-intuitively it would take more CPU time, and therefore use up more battery life, to have sound muted (!)

Oh, software optimisation, how I love it.

For most games, which already run at 60 FPS*, there is no speedup to be had anyway. Those games, with sound on, will now take around 40% CPU instead of 75%, and still be at exactly 60 FPS*.

_________
* = or PAL at 50 FPS, but who plays PAL games? ;D

Malleus

  • Posts: 67
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #5 on: August 07, 2014, 03:27:09 pm »
Great!

the_randomizer

  • Posts: 62
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #6 on: August 07, 2014, 04:46:03 pm »
That's awesome, like, really awesome! This is the no. 1 concern of mine with the GCW-zero, to see audio sync in the Snes emulator. Now, that has become a reality  ;D

Kouen Hasuki

  • Posts: 155
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #7 on: August 07, 2014, 10:22:51 pm »
Sent Randomizer a quick MP3 sample, its not perfect but demo's the new audio

the_randomizer

  • Posts: 62
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #8 on: August 07, 2014, 10:26:27 pm »
Yeah, just listened to the audio sample Kouen Hasuki sent me, the audio has improved dramatically, like, I was taken aback.  ;D  :o Castlevania IV sounds amazing  ;D

Nebuleon

  • Guest
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #9 on: August 07, 2014, 10:42:27 pm »
the_randomizer: Was your issue with the audio related to the note-length jumpiness, similar to Rydian's replies in the CATSFC thread?

I would especially like you to hear the rupee sound effect before Zelda: A Link to the Past's title screen in the new PocketSNES. And I would especially like edit: , from Kouen, a file of Super Mario World with the Funky level's music sped up 9 times (like this) to confirm that it doesn't have a haphazard rhythm anymore.

(I have received the file separately from Kouen, and I am aware that you have no GCW Zero.)
« Last Edit: August 07, 2014, 11:23:12 pm by Nebuleon »

the_randomizer

  • Posts: 62
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #10 on: August 07, 2014, 11:19:52 pm »
the_randomizer: Was your issue with the audio related to the note-length jumpiness, similar to Rydian's replies in the CATSFC thread?

I would especially like you to hear the rupee sound effect before Zelda: A Link to the Past's title screen in the new PocketSNES. And I would especially like a file of Super Mario World with the Funky level's music sped up 9 times (like this) to confirm that it doesn't have a haphazard rhythm anymore.

(I have received the file separately from Kouen, and I am aware that you have no GCW Zero.)

Uh, well, that might be prove to be difficult as I don't have such a device yet, or a means to test the emulator, so unfortunately, I can't test that particular sound effect/tempo in the emulator. I suppose what I can do (and this is a long shot and likely not to be efficacious), is for me to do the opposite and record those same sounds in Snes9x, which uses Blargg's S-SMP/SPC700 audio core, which to my knowledge is cycle-accurate to an Snes. See that way, it would be a baseline way to compare, a way to gauge the audio from emulator to emulator.

I know it's an asinine and possibly even a wacky idea, but just a thought. How would I be able to hear the audio PocketSNES? I currently have no means of actually listening to it...sorry I can't be of much help at all....   :(  *Sigh* Some help I've been.  Given the fact you know I don't have one, I don't know how you propose that I can help out...
« Last Edit: August 07, 2014, 11:22:54 pm by the_randomizer »

the_randomizer

  • Posts: 62
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #11 on: August 07, 2014, 11:21:05 pm »
*Double post* Disregard.

Nebuleon

  • Guest
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #12 on: August 07, 2014, 11:22:19 pm »
I meant that part towards Kouen.

the_randomizer

  • Posts: 62
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #13 on: August 07, 2014, 11:26:01 pm »
I meant that part towards Kouen.

I saw both of Kouen's and my name mentioned, so I was confused. He sent me the file to listen to it and that I don't have the device at all so...no idea what's going on. Just saw the @the_randomizer part...


Didn't mean to derail.

hi-ban

  • Posts: 889
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #14 on: August 08, 2014, 04:58:07 am »
All audio quality issues Pocketsnes had, or at least the ones i was aware of, seem to be fixed in this build.

Weapon sound in Super Probotector is fixed, and FX sound in Super Castlevania is fixed, too.



Oh wait... the music in Secret of Mana is not fixed. It still makes noises when playing notes. Same happens with Actraiser.
Anyway, it's a great improvement, so the seal of approval stays there.
« Last Edit: August 08, 2014, 05:08:08 am by hi-ban »

Nebuleon

  • Guest
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #15 on: August 08, 2014, 05:26:15 am »
Secret of Mana and Actraiser are plagued by a different bug, which I call the "rusty NES audio controller" bug. I don't know where that one could even come from.

Haze (OP)

  • Posts: 13
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #16 on: August 08, 2014, 11:31:50 pm »
Thats quick work! Amazing, I'll download now and give it a go.

Haze (OP)

  • Posts: 13
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #17 on: August 08, 2014, 11:51:45 pm »
After a quick look everything seems fine apart from MK2's character select screen. But thats a very common problem with mobile emulators.

Nebuleon

  • Guest
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #18 on: August 09, 2014, 12:17:03 am »
I've merged the audio-fixes branch into master and issued an update on the main PocketSNES thread, which edit: is now on the GCW Zero download page as well.

By MK2, you mean Mortal Kombat 2, right?
« Last Edit: August 09, 2014, 12:24:46 am by Nebuleon »

Haze (OP)

  • Posts: 13
Re: What are the odds of getting "perfect" SNES Sound emulation?
« Reply #19 on: August 09, 2014, 12:31:06 am »
Yep Mortal Kombat 2. The gong sound lingers and repeat. Also can I ask where the emulators save states are located?

 

Post a new topic
Post a new topic