Musical notes in SketchUp


#1

Today a friend of mine who is very interested in music and composes own progressive metal/rock songs visited me. We started discussing some music theory and trying to define basic concepts, like notes. I think the problem I had understanding this in school was that it was never described in a physical/scientific way, but more of in a “here’s a bunch of concepts that we’ll be using but never define; just accept it” sort of way, like so often happens in school.

Anyhow, lacking Math lab or a similar program I started using SketchUp to visualize frequencies as points along a line and graphically compare their differences. Then I also used SketchUp to play notes, and experimenting what it would sounds like if you divide an octave not into 12 half-tones, but into any other number of them.

Here’s the code (Windows only!) and the output sound. Sorry for mixing Swedish and English!

Gem.install('win32-sound')
require 'win32/sound'

grundton = 440
notes_per_octave = 12 # Change this number for other note "bases".
notes_per_octave.times do |n|
  f = 2 ** (Math.log2(grundton) + n.to_f / notes_per_octave)
  p f
  Win32::Sound.beep(f, 500)
end

Though no one had used SketchUp for this before :stuck_out_tongue: .


#2

Interesting. Never saw that type of presentation of sound “notes” before. Helps me understand CD’s and DVD’s, etc. that we listen to with our devices. Now if anyone can tell me why the same disc played on a CD player sounds muffled when played on a DVD player . . . ? Already know why the difference in records to CDs. But then I digress here to tonal properties rather than the notes themselves. Pardon.