gamercade-io / gamercade_console

A Neo-Retro Fantasy Console. Make WASM-powered, networked multiplayer games.
https://gamercade.io
Apache License 2.0
166 stars 10 forks source link

Auto-Detection of Sample frequences #49

Open RobDavenport opened 1 year ago

RobDavenport commented 1 year ago

When loading a sample in the editor, users have to either select None for the frequency, or know the frequency of the sample file itself. There are algorithms which can be used to give a best guess of the frequency.

This should be exposed as a button that the user can click, so if for some reason the algorithm results in a wrong value, they can use another method to get it.

VegaDeftwing commented 1 year ago

This will need to be aware of the .wav (or whatever format) sample rate clearly. I would caution against using a basic FFT and looking for the first peak, as some instruments will have an octave below what is supposed to be the fundamental. At the most basic and avoiding DSP a UI with draggable bars to let the user select one period of a wave would work.

RobDavenport commented 1 year ago

We are already able to gather information about the .wav's sample rate (and playback correctly related to systems sample rate). I'm also quite familiar with the fact that frequency detection is still a difficult problem. Even if we provide a method which is close enough, the user can still manually enter the correct frequency as an escape hatch should the algorithm be wrong (such as in the instrument you mentioned).