module Sound.SC3.Auditor.PF where
import qualified Music.Theory.Pitch as T
import Sound.OSC
import Sound.SC3
import Sound.SC3.Auditor
import System.FilePath
bosendorfer_octpc_to_index :: T.OctPC -> Index
bosendorfer_octpc_to_index (o,pc) = fromIntegral (o * 12 + pc + 12 24)
for_pf :: [(Start_Time,[(T.OctPC,Amplitude)])] -> PP
for_pf = map (to_p (bosendorfer_octpc_to_index.fst,snd))
note_names :: [String]
note_names = ["C", "C#", "D", "D#", "E", "F"
,"F#", "G", "G#", "A", "A#", "B"]
file_names :: [String]
file_names = [(n ++ show o) <.> "aif" | o <- [1::Int .. 7], n <- note_names]
bosendorfer_osc :: FilePath -> (String, Int) -> Message
bosendorfer_osc d (fn,i) = b_allocRead i (d </> fn) 0 0
bosendorfer_set_osc :: FilePath -> [Message]
bosendorfer_set_osc d = map (bosendorfer_osc d) (zip file_names [0..])
bosendorfer_subset_osc :: FilePath -> Sample_Loader
bosendorfer_subset_osc d ix =
let nm = filter ((`elem` ix) . snd) (zip file_names [0..])
in map (bosendorfer_osc d) nm
au_load_bosendorfer_set :: Transport m => FilePath -> m ()
au_load_bosendorfer_set d = mapM_ async (bosendorfer_set_osc d)