3 ms·
I know it’s a long shot, but does anyone know of a tutorial for the sound of a game boy emulator? Most of these tutorials never cover that piece and when I try
by droolboy 1y ago
I know it’s a long shot, but does anyone know of a tutorial for the sound of a game boy emulator? Most of these tutorials never cover that piece and when I try it on my own I find it hard to properly implement or even understand the reference material well enough to implement on my own.
- jofzar 1y agohttps://youtu.be/a52p6ji1WZs https://youtu.be/a52p6ji1WZs maybe?
- wez470 1y agohttps://nightshade256.github.io/2021/03/27/gb-sound-emulation.html https://nightshade256.github.io/2021/03/27/gb-sound-emulatio... is pretty good
- t0mek 1y agoNot a tutorial per-se, but here are 2 slides describing how I've done it: https://www.slideshare.net/slideshow/emulating-game-boy-in-java/83928182#21 https://www.slideshare.net/slideshow/emulating-game-boy-in-j... Essentially, there are 4 channels, each providing a number 0-15 on every tick. Emulator should mix them together (arithmetic average), scale up to 0-255 and feed to the sound buffer, adjusting the tick rate (4.19MHz) to the sound output rate (e.g.: 22 kHz) - taking every ~190 value (4.19MHz / 22 kHz) is a good start. Now the 0..15 value that should be produced by each channel depends on its characteristics, but it's well documented: https://gbdev.gg8.se/wiki/articles/Gameboy_sound_hardware https://gbdev.gg8.se/wiki/articles/Gameboy_sound_hardware Channels 1 and 2 produce square waves, so a bunch of low (0) and high (15) values, with optional volume envelope (gradually going down from 15 to 0 on the "high" part of the square) and frequency sweep (alternating 0s and 15s slower or faster). Channel 3 allows an arbitrary waveform, read from the memory. Channel 4 is a random noise, generated by the LSFR. See SoundModeX.java for the reference: https://github.com/trekawek/coffee-gb/tree/master/src/main/java/eu/rekawek/coffeegb/sound https://github.com/trekawek/coffee-gb/tree/master/src/main/j...