aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgretchen <gretchen@gnar.cool>2019-11-16 15:59:03 -0800
committergretchen <gretchen@gnar.cool>2019-11-16 15:59:03 -0800
commit106922c94796317c7cc8370791ab611b801ec883 (patch)
tree8fb9500f3221d6b58ec0cf079491ae6cf5d6f671
parent7a51bbcd05960bb45cc9d5487b504cbe84633467 (diff)
downloadintervals-106922c94796317c7cc8370791ab611b801ec883.tar.gz
intervals-106922c94796317c7cc8370791ab611b801ec883.zip
Use musicutil
-rw-r--r--intervals.lua9
1 files changed, 2 insertions, 7 deletions
diff --git a/intervals.lua b/intervals.lua
index a70dab1..2b402d5 100644
--- a/intervals.lua
+++ b/intervals.lua
@@ -14,14 +14,9 @@
-- 5) play from input
local ControlSpec = require "controlspec"
--- TODO use MusicUtil
+local MusicUtil = require "musicutil"
-- graphics and audio utilities
-function midi_to_hz(note)
- local hz = (440 / 32) * (2 ^ ((note - 9) / 12))
- return hz
-end
-
function interval_name(base, interval)
t = {
"unison",
@@ -463,7 +458,7 @@ engine.name = 'PolyPerc'
function play_start(note, vel)
if intervals_state.play_audio then
-- TODO use velocity here, too
- engine.hz(midi_to_hz(note))
+ engine.hz(MusicUtil.note_num_to_freq(note))
end
if intervals_state.play_midi then
intervals_state.midi_out:note_on(note, vel or intervals_state.note_vel)