From 106922c94796317c7cc8370791ab611b801ec883 Mon Sep 17 00:00:00 2001 From: gretchen Date: Sat, 16 Nov 2019 15:59:03 -0800 Subject: Use musicutil --- intervals.lua | 9 ++------- 1 file 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) -- cgit v1.2.1