What's new

Game Boy

bcrew1375

New member
I tried, but all I get right now is a series of beeps. It sort of sounds like a radar. :p Any idea what the Gameboy's playback frequency is? Is it variable or what?
 

HyperHacker

Raving Lunatic
Not sure what you mean... Basically you take whatever value is written to each channel's frequency register, convert it to a real frequency (I think the pan docs have the formula) and play it. Not including things like volume, envelope and noise, of course.
 

bcrew1375

New member
Yeah, I mean the... I guess you'd call it the sampling rate? It seems like it'd be 256 or something.

Edit: Looked at another emu's source. It looks like the sampling rate might only be 16 Hz! Of course, I still have no idea, this could be completely wrong.
 
Last edited:

aprentice

Moderator
i dont even know how to use direct sound or any sound api for that matter, knowing how to set it up and one could definately be a good start..
 

bcrew1375

New member
Setting up SDL's sound is pretty easy. Though, I still can't get it to play the sounds I want to yet. I have no idea about Direct X.
 

zenogais

New member
Sorry for not positng for a while, I've been extremely busy with other endeavors including thinking about college, and I'm itching to get back to work on NeoGameBoy, which has been gathering dust on my hard-drive for some time now. I see that you all are working on sound, and so I figured I'd make a post to help you guys get stuff up and running.

As far as decoding and playing waveforms goes that is fairly easy and straightforward, however actually creating the other channels (noise, sweep, etc..) that is a bit trickier. The noise is not very straightforward, though it sounds like it should be. The most common way of creating noise, and the one that is most likely correct, is to create Gaussian Noise. I did some research on this when I was working on PS2SP, and understanding it requires some basic knowledge of calculus. Gaussian noise is really quite simple, though the math to actually create it can be less simple. Gaussian noise is a pattern of waveforms which is evenly distributed across all frequencies. You can find a simple method for generating semi-gaussian noise on the fly here. For more information on the math I would look here. Hope this helps, I'll try to dig up some of my notes on ADSR later today.
 

bcrew1375

New member
Heh, I think most of us need help on actually setting the soundcard up for playback.

Edit: Hmm, I'm wondering about something. If you were to play a 22 KHz sound wave back at 44 KHz, but filled every other byte with the data of the byte before it(example: 0x00, 0xFF = 0x00, 0x00, 0xFF, 0xFF), would it sound exactly the same?
 
Last edited:

refraction

PCSX2 Coder
bcrew1375 said:
Heh, I think most of us need help on actually setting the soundcard up for playback.

Edit: Hmm, I'm wondering about something. If you were to play a 22 KHz sound wave back at 44 KHz, but filled every other byte with the data of the byte before it(example: 0x00, 0xFF = 0x00, 0x00, 0xFF, 0xFF), would it sound exactly the same?

sorry for my absense too, been busy :p

from my audio knowledge that would be correct yes BUT, playing a mono sound wave at 44khz would be pointless. even a CD is only 44khz for both left and right channels (2 * 22khz), not to mention the human ear struggles to hear frequencies about 20khz, so its best off staying at 22khz :)
 

bcrew1375

New member
Okay, does anyone know where I can ask for help with SDL? If I play unchanging sound data shouldn't it be a unbreaking screech sound? Like if I continually play 0xFF to the speakers, shouldn't the pitch and volume remain exactly the same? Everytime I try to do this I get a sort of "fuzz" noise.

Another dumb question. Is the sound data that you send to the sound card the volume or amplitude, or what?
 
Last edited:

Dark Stalker

New member
bcrew1375 said:
Okay, does anyone know where I can ask for help with SDL?
The SDL mailing list might be a good place to start :p
And as you should know, the SDL Home Page has quite a bit of documentation, with the doc wiki being especially nice.

I haven't looked at sound at all yet, but it's on my todo list. I've, however, found a bottleneck in my SDL drawing code that effectively made my emu several times slower. (My profiler couldn't catch this, since the cpu time was spent in an SDL function.) Fixing this made my emu run at 1000-4000 fps in unscaled software mode (in GNU/Linux at least). I should be able to do similar things for my other video engines too, since they're now mysteriously slower than the sw drawer (in unscaled mode at least).
 

Dark Stalker

New member
What was the bottleneck?
I underestimated the time it took to convert the colour format of my buffer to the screen format. Even if this only happened every v-blank, it took much more time than the sum of everything else happening. My profiler couldn't see it, since the time-consuming code was located in SDL's BlitSurface function.
 
Last edited:

zenogais

New member
To play RAW sound using SDL you're going to have to use RWops, this requires a bit more work to set up, but its what you're going to need unless you decide to go with some other sound library. Here is a good sample to get you started, the buffer used in the example will be your sound data buffer generated by the GameBoy program.
 

bcrew1375

New member
*bcrew1375 walks through the desolate wasteland that was once this thread.* Hello, is anyone out there!? Can anyone hear me!? :p

Seriously, it's been almost a month. Is anyone still working on there emus? Or, will I have to continue being the only "survivor" :p
 

HyperHacker

Raving Lunatic
Not in a while, no. I should but there's so much else to be done... Haven't quit though, just haven't worked on it in a long time.
 

aprentice

Moderator
bcrew1375 said:
*bcrew1375 walks through the desolate wasteland that was once this thread.* Hello, is anyone out there!? Can anyone hear me!? :p

Seriously, it's been almost a month. Is anyone still working on there emus? Or, will I have to continue being the only "survivor" :p

I touched mine last week, put it direct sound code, just havent gone beyond that yet regarding sound, i might give it a go today.. btw, is your emulator generating any good sound since you said your close to getting channel 3 working?
 

Top