jtothebell / fake-08

A Pico-8 player/emulator for console homebrew
Other
563 stars 49 forks source link

Custom instruments #172

Closed fringd closed 1 year ago

fringd commented 1 year ago

This adds support for custom instruments. They clip really badly so I had to added some cross-fading like on the real pico8. Happy to split that out into a followup PR if need be.

fringd commented 1 year ago

i realize this is probably a lot to look at. to give you some insight into the crossfade... when pico 8 moves from one note to another it does a very fast short crossfade to keep clicking out of the sound. here you can see the curves as a channel switches notes before this pr, after this pr, and in pico8 actual: image note the vertical discontinuity in the first sample. this will sound like a loud click.

and here are the wav files if you want to listen to them. this is the same baseline played pre-patch post-patch and on pico8: audio.zip

the custom instruments support (also called sfx instruments) basically extracts the logic for getting sfx samples from the logic for getting channel samples so that it can recurse (once only). Any music that uses custom instruments is very wrong without this support.