aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)