(By "amplitude value" I really mean the position on the y-axis of a typical wave-drawing. I can't find the right term, and in a square wave the displacement is always as big as the amplitude anyway.)
aprentice said:
I'm sure what you're saying right now makes sense to you since you apparently mastered this stuff but to me it makes little sense, did you use direct sound for your emulator?
I used SDL, which wraps around DirectSound on windows.
Each gameboy sample is 4 bits, and in direct sound i have it set up as 16 bits for each sample, so am i suppose to shift 8 or 12 bits to make it louder?
There is no such thing as an actual game boy sample (unless you refer to ch3). The amplitude of the waves generated by each channel indeed has a range of 0-15. Additionally there is the output level of SO1 and SO2 which range from 0-7, which the final amplitude will be multiplied by. The value of a sample represents the "amplitude value" of a position in the sound wave. If you multiply each sample's value, you will get a louder output. There's no rule for what's the right average volume of the output, as long as one sample isn't amplified more than another. That said, I'm currently multiplying the value of the individual samples I'm generating by 64, since that seems to yield an overall volume similar to most other things outputting sound on my comp.
And do i have to do anything to each sample to control the frequency because i see direct sound has a SetFrequency function but that wouldnt control it for every sample..
No, you don't. As I said, each sample only represents an "amplitude value". Frequency refers to how often this value changes. The sample rate is how often a new sample is generated/expected (typically 44100 Hz). Generally, the higher the sample rate, the more accurate the representation of the sound wave, since you can support more fine grained changes and higher frequencies. What matters for the notes of the melody is how often the values of the samples you output change from high to low (and back). If you ignore a channel's volume/amplitude/envelope register, and just use a fixed value, you will generally still be able to produce the notes of the melody. You need to keep counters for how many high/low samples you've outputted depending on the frequency (and wave duty) of the channel.
bcrew1375 said:
Dark Stalker, I noticed your emulator has one of the same problems with Donkey Kong as mine. It shows a white blank area at the bottom where the status screen should be when you complete a level. Any idea what might be causing it? Also, I'm surprised that you already have the sound down. I've noticed a few jerks in it, but other than that it sounds great.
No, I haven't tested that game. Thanks for letting me know. What kind of sound jerks? Some of them are supposed to be there...
