Skip to content

Instantly share code, notes, and snippets.

@datramt
Created April 13, 2019 14:08
Show Gist options
  • Save datramt/00a9c4f3e9de2f499513487058b8a291 to your computer and use it in GitHub Desktop.
Save datramt/00a9c4f3e9de2f499513487058b8a291 to your computer and use it in GitHub Desktop.
calculate the frequency of the Perseus cluster black hole with [limited] info provided by nasa.gov article
# from music tech class APRIL 11 2019 at Virginia Tech
# https://www.nasa.gov/centers/goddard/universe/black_hole_sound.html
##| formula for midi note 57 octaves below middle C (assuming the starting point is the B-flat below middle C)
bh_midi_note = 60-2-12*57.0
puts bh_midi_note #=> -626.0
##| formula to convert midi to frequency
bh_frequency = 2**((bh_midi_note-69)/12)*440
puts bh_frequency #=> 1.6173304415101714e-15
# or
##| divide B-flat in half 57 times
b_flat_freq = 233.08
57.times do
b_flat_freq *= 0.5
end
bh_freq = b_flat_freq
puts bh_freq #=> 1.617317391126969e-15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment