Skip to content

Instantly share code, notes, and snippets.

@gustavopsantos
Last active December 21, 2024 19:44
Show Gist options
  • Select an option

  • Save gustavopsantos/d5785ff2c9bcee016c545a4801f6055c to your computer and use it in GitHub Desktop.

Select an option

Save gustavopsantos/d5785ff2c9bcee016c545a4801f6055c to your computer and use it in GitHub Desktop.
Musical note frequency calculator
public static float Calc(float referenceFrequency, float noteOffset) // For instance: Calc(440, 12) = 880 | 440Hz = A4 | 880Hz = A5
{
return (float) (Math.Pow(2, noteOffset / 12) * referenceFrequency);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment