Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Advanced sound and a second barrage of miscellany

Reply to topic
Author Message
vecna
  • Guest
Reply with quote
Advanced sound and a second barrage of miscellany
Post Posted: Sun Apr 16, 2000 10:58 pm
I have a whole crapload of assorted qs... I guess I'll just get right to it ^_^:

1) I keep seeing references to emulators supporting "stereo GameGear sound", but all the docs on differences between SMS and GG mention nothing of the sound, and treating GG sound identically as an SMS PSG seems to work. Does the GG actually support stereo sound? There's only one speaker on the actual unit ... If so, how is it handled? A second set of PSG ports, or an added panning command, or..? Both of those seem rather far-fetched..

2) How does speech work? Do I need to emulate some sort of DMA or something? I've not seen anything about that. It seems that it can only really work via rapid manipulation of the PSG ports, presumably the noise channel, but if thats the case it _should_ work on mine (unless the resolution of my sound events simply isn't great enough, which could be the case).

3) None of the emulators that emulate the FM chip produce sound on my computer, so I have absolutely no idea how this is supposed to sound. Does anyone have like an mp3 or something of how the FM chip sounds on a real SMS, or even a well done emulation of it? I think there was one on the MEKA site, but the link is dead or something. Also, how do most emulators handle it? Since adlib opl isn't a very good idea on modern systems since not all systems have it, does MEKA for instance emulate this digitally, or use some sort of MidiOut interface or something?

4) Huh. There are some threads down near the bottom of the board about Pro Action Replay and Game Genie and what not, but nowhere did I see any specs on how those codes actually work. Does anyone have a breakdown of the code format?

5) I'm not so much concerned about this one yet, as this is farther down on my todo list I guess, but what about lightgun and the paddle? I planned on trying to hack these out manually by checking out port activity and disassembly of games that use them, but if someone has already put this information up publicly somewhere there's no need to reinvent the wheel.
I guess the 3d glasses would also be in this category. I've never actually gotten my hands on a pair of 3d glasses... but I know they're the kind that actually alternatingly switches the eyes on and off, so I assume the plug in to the card port simply supplies power and probably a syncing signal.

Thanks again! ^_~ Hopefully I should have a new version of CHASMS ready in a few days :D

- vecna
 
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
Post Posted: Sun Apr 16, 2000 11:49 pm
Quote
> 1) I keep seeing references to emulators supporting "stereo GameGear sound", but all the docs on differences between SMS and GG mention nothing of the sound, and treating GG sound identically as an SMS PSG seems to work. Does the GG actually support stereo sound? There's only one speaker on the actual unit ... If so, how is it handled? A second set of PSG ports, or an added panning command, or..? Both of those seem rather far-
fetched..

I never heard of stereo game gear sound. If it does exist, I assume you'd only be able to hear it on a real gamegear if you used the headphone jack.. there -is- a headphone jack, right?
Chances are, certain psg channels output to the left speaker, and the others output to the right.. the noise channel might be mixed betwen the two.. but I don't know. This is the first I've heard of it.


Quote
> 2) How does speech work? Do I need to emulate some sort of DMA or something? I've not seen anything about that. It seems that it can only really work via rapid manipulation of the PSG ports, presumably the noise channel, but if thats the case it _should_ work on mine (unless the resolution of my sound events simply isn't great enough, which could be the case).

Nope, there's no DMA to the system ram in the sms/gg whatsoever. Sampled sounds are handled by rapid updates to one or more of the tone generators (NOT the noise generator.. even though some of the PWM sounds of the early SMS games sound pretty noisy, heh).
When a sound channel is to be used for sample playback, it's frequency is set to '0' to lock the output to its high* point, otherwise the 'motion' of the square wave would interfere with sample playback. Then, at regular intervals, the audio data is written directly to the volume control for that channel. Thus, the amplitude of the wave is written to the volume of channel, controlling the sound wave directly. This is a little hard to explain without diagrams, but if you meditate on it (and you understand enough about audio theory) you'll get it.
Earlier SMS games used Pulse Width Modulation, where the volume output was always either maximum ($f) or minumum ($0), with no in between. This really sounded scratchy and awful, but it was loud enough to hear clearly, and may have used a bit less memory to store.
Later carts (Arcade Classics, Lemmings, Music Station..) use the full spectrum of volume levels to make a cleaner, 4-bit PCM sample output. However, 4-bit PCM is much softer. To make it loud enough to be clearly audible, you must output the data to all three tone channels (music station doesn't do this, which is why it's hard to hear).
To properly emulate this, you need to log all outputs to the audio ports, along with the number of cycles between each output, for each frame. Using this list, you can reconstruct the proper sound wave from list of how long each setting was held before it was updated.
Since the only timing mechnism in the SMS with enough precision to time sample playback was the clock speed of the CPU itself, the sample playback routines used idle loops and precise timing to make sure each sample was sent to the volume control at the right time. So, you must have a z80 emulator with accurate cycle-counting to reproduce the sound correctly.

Quote
> 3) None of the emulators that emulate the FM chip produce sound on my computer, so I have absolutely no idea how this is supposed to sound. Does anyone have like an mp3 or something of how the FM chip sounds on a real SMS, or even a well done emulation of it? I think there was one on the MEKA site, but the link is dead or something. Also, how do most emulators handle it? Since adlib opl isn't a very good idea on modern systems since not all systems have it, does MEKA for instance emulate this digitally, or use some sort of MidiOut interface or something?

I think it still outputs to the OPL chips directly (as it is a dos applications and windows API calls are not available to it). Thus, some people are just out of luck if their sound cards don't have (or emulate) OPL. Massage does this as well. I think Zoop was working on digital FM emulation, but that's still off a ways into the future.
My modern sound blaster still supports OPL, and I'm sure many others do too
My recommendation, find a cheap ISA sound card (I got mine for $7) and use it only for dos compatibility.


Quote
> 5) I'm not so much concerned about this one yet, as this is farther down on my todo list I guess, but what about lightgun and the paddle? I planned on trying to hack these out manually by checking out port activity and disassembly of games that use them, but if someone has already put this information up publicly somewhere there's no need to reinvent the wheel.

I don't know about paddles, but as for the light gun emulation:
Zoop once said something to the effect of:
"Bit 6 of port $dd is set when the raster beam is where the gun is pointing. And that's all you need to know."
And that'd probably be all you need to know.
To analyze this a bit, I assume that:
When the sms is checking for the position of the light gun, it just enters a loop where it polsl bit 6 of $dd until it returns zero. As such point, the input of port $7e is the verical coordinate of the point on the screen where the light gun is aimed at, and in input of port $7f is the horizontal coordinate. With accurate sms timing and an adjustment to the routine that handles reads fromport $dd, you can implement light gun support. If I'm correct, and maybe I'm not.
  View user's profile Send private message Visit poster's website
Consolemu
  • Guest
Reply with quote
Finally, something I can speak on...
Post Posted: Mon Apr 17, 2000 2:19 am
Quote
> I never heard of stereo game gear sound. If it does exist, I assume you'd only be able to hear it on a real gamegear if you used the headphone jack.. there -is- a headphone jack, right?
> Chances are, certain psg channels output to the left speaker, and the others output to the right.. the noise channel might be mixed betwen the two.. but I don't know. This is the first I've heard of it.

There is a headphone jack located either on the top left or the top right (it's been years). Stereo sound? I honestly can't remember. Yes, there is only one speaker on the bottom right and it outputs all sounds Mono. At times when I hooked it up to my Stereo Speakers, the sound was much more clear and I think it was indeed in stereo sound. I'm thinking that all this time the SMS Docs have been wrong. Like, mabye the Game Gear used some new and advanced Texas sound chip that was programmed exactly like the SMS' but supported new features like stereo panning. I wish I still had my Game Gear so I could find out for myself.


Quote
> I think it still outputs to the OPL chips directly (as it is a dos applications and windows API calls are not available to it). Thus, some people are just out of luck if their sound cards don't have (or emulate) OPL. Massage does this as well. I think Zoop was working on digital FM emulation, but that's still off a ways into the future.
> My modern sound blaster still supports OPL, and I'm sure many others do too
> My recommendation, find a cheap ISA sound card (I got mine for $7) and use it only for dos compatibility.

I do hear the Adlib YM2413 emulation but it doesn't sound right. It sounds too "PCish". It doesn't have that synthetic Yamaha feel, you know? It really needs to be digitally emulated; no matter how close the two chips are.

Chris :o)
 
Ricardo Bittencourt
  • Guest
Reply with quote
Post Posted: Mon Apr 17, 2000 3:11 am
Quote
> Later carts (Arcade Classics, Lemmings, Music Station..) use the full spectrum of volume levels to make a cleaner, 4-bit PCM sample output. However, 4-bit PCM is much softer. To make it loud enough to be clearly audible, you must output the data to all three tone channels (music station doesn't do this, which is why it's hard to hear).

I tried to output the pcm value to more channels
but unfortunately there was not enough cycles available for that

If I add the volume boost, I'll have to remove some of the animations

And I think that a softer volume with more animations is nicer
than a louder volume with no animations :)

Ricardo Bittencourt
 
Ricardo Bittencourt
  • Guest
Reply with quote
Post Posted: Mon Apr 17, 2000 3:12 am
Quote
> Later carts (Arcade Classics, Lemmings, Music Station..) use the full spectrum of volume levels to make a cleaner, 4-bit PCM sample output. However, 4-bit PCM is much softer. To make it loud enough to be clearly audible, you must output the data to all three tone channels (music station doesn't do this, which is why it's hard to hear).

I tried to output the pcm value to more channels
but unfortunately there was not enough cycles available for that

If I add the volume boost, I'll have to remove some of the animations

And I think that a softer volume with more animations is nicer
than a louder volume with no animations :)

Just press + in the numeric keyboard of brsms to boost the volume :)

Ricardo Bittencourt
 
vecna
  • Guest
Reply with quote
Post Posted: Mon Apr 17, 2000 5:40 am
Quote
> I never heard of stereo game gear sound. If it does exist, I assume you'd only be able to hear it on a real gamegear if you used the headphone jack.. there -is- a headphone jack, right?
> Chances are, certain psg channels output to the left speaker, and the others output to the right.. the noise channel might be mixed betwen the two.. but I don't know. This is the first I've heard of it.

Hmm. I dragged out the Game Gear just a few minutes ago and plugged in the headphone jack, and sure enough, it _does_ have stereo. Now the trick is to determine how it works. You're probably right, it's prolly just chans x and z are left and y is right or something of that nature. I'll have to experiment with this in the emulator. You can hear this stereo effect on Columns for instance, when dropping pieces.

Quote
> To properly emulate this, you need to log all outputs to the audio ports, along with the number of cycles between each output, for each frame. Using this list, you can reconstruct the proper sound wave from list of how long each setting was held before it was updated.

I see. This makes sense, and explains why it's not working on mine... It will take a bit of restructuring the sound player to make this work, but I'll need to overhaul it to support stereo GG effects as well as hopefully digital FM emulation.

Quote
> My modern sound blaster still supports OPL, and I'm sure many others do too
> My recommendation, find a cheap ISA sound card (I got mine for $7) and use it only for dos compatibility.

My _card_ still supports OPL, but since it's a windows native emulator, I don't really think I can actually access it. I'll probably attempt to emulate it digitally, or else use MidiOut or something like that.

Also, WHEEEHEEHEE! I finally figured out (after 3 hours of debugging) why my @#$)@#$ movies were losing sync. I rule! :D

- vecna
 
  • Joined: 28 Sep 1999
  • Posts: 1197
Reply with quote
Post Posted: Mon Apr 17, 2000 7:45 am
Quote
> 1) I keep seeing references to emulators supporting "stereo GameGear sound", but all the docs on differences between SMS and GG mention nothing of the sound, and treating GG sound identically as an SMS PSG seems to work. Does the GG actually support stereo sound? There's only one speaker on the actual unit ... If so, how is it handled? A second set of PSG ports, or an added panning command, or..? Both of those seem rather far-fetched..

Game Gear's have a custom PSG that allows you to enable each of the four channels out of the left and right speakers.
This is controlled by port 06h:

d7 - left noise
d6 - left tone 3
d5 - left tone 2
d4 - left tone 1
d3 - right noise
d2 - right tone 3
d1 - right tone 1
d0 - right tone 0

The default setting is FFh, for example 88h would enable
the noise channels out of both speakers and mute the tone channels entirely.

Quote
> 3) None of the emulators that emulate the FM chip produce sound on my computer, so I have absolutely no idea how this is supposed to sound. Does anyone have like an mp3 or something of how the FM chip sounds on a real SMS, or even a well done emulation of it? I think there was one on the MEKA site, but the link is dead or something. Also, how do most emulators handle it? Since adlib opl isn't a very good idea on modern systems since not all systems have it, does MEKA for instance emulate this digitally, or use some sort of MidiOut interface or something?

I've heard MP3's of sound from the VRC7 sound chip, which is
a 6-channel variation of the YM2413. I compared this to running
VRC7 sound commands through the YM2413 emulator used in Meka,
and the output was almost identical.

I've uploaded some YM2413 register logs and a sound player
using Meka's emulation so you can hear what the FM sound is like, and I am very
confident that it is quite close to the real thing:

http://www.wenet.net/~cgfm2/SSL.ZIP

The player will work for people without OPL-2 sound chips,
it pipes the YM2413 emulator's output into the YM3812 emulator
from MAME. Providing you can run this under Win2K, that is...


Quote
> 4) Huh. There are some threads down near the bottom of the board about Pro Action Replay and Game Genie and what not, but nowhere did I see any specs on how those codes actually work. Does anyone have a breakdown of the code format?

For the PAR, the first 2 digits do nothing, the next four
digits are an offset in RAM, and the last two are the value
to write at that location.

For instance, 00101CBD would write BD to D01C.



  View user's profile Send private message Visit poster's website
Consolemu
  • Guest
Reply with quote
SSL Player
Post Posted: Mon Apr 17, 2000 3:16 pm
So wait, this program emulates the YM2413 though the Adlib or digitally through the MAME driver? I want to know the full truth. And I had a feeling that the Game Gear had stereo Sound! Those jerks, Damaged Cybernetics, and all the smucks who developed for the Game Gear without having a real one should be smacked with a wet fish! I knew there was a bit of sound difference between the two.

Chris :o)
 
  • Joined: 28 Sep 1999
  • Posts: 1197
Reply with quote
Re: SSL Player
Post Posted: Mon Apr 17, 2000 3:52 pm
Quote
> So wait, this program emulates the YM2413 though the Adlib or digitally through the MAME driver?

Digitally. So it will work if you don't have an OPL-2/3 sound
chip (only older Sound Blaster cards do, I believe).

It also emulates the SN76489 sound chip too, but none of
the sound logs I uploaded have any PSG sound. ;)


  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!