hsc3-0.21: Haskell SuperCollider
Safe HaskellSafe-Inferred
LanguageHaskell2010

Sound.Sc3.Ugen.Name

Description

Functions to normalise Ugen names.

Sc3 Ugen names are capitalised at word boundaries. hsc3 cannot use these names for Ugen constructor functions. Haskell names are given by lower-casing until the first word edge. Lisp names are given by lower-casing everything and adding hyphens before edges.

Synopsis

Documentation

sc3_name_edges_plain :: String -> [Bool] Source #

Find all Sc3 name edges. Edges occur at non lower-case letters. This rule is very simple but is coherent and predictable and works well for .hs names.

sc3_name_edges :: String -> [Bool] Source #

Find non-initial Sc3 name edges.

>>> sc3_name_edges "SinOsc"
[False,False,False,True,False,False]
>>> sc3_name_edges "FFT"
[False,False,False]
>>> sc3_name_edges "DFM1"
[False,False,False,False]
>>> sc3_name_edges "PV_Add"
[False,False,False,True,False,False]
>>> sc3_name_edges "A2K"
[False,False,False]
>>> sc3_name_edges "Lag2UD"
[False,False,False,True,True,True]
>>> sc3_name_edges "PeakEQ"
[False,False,False,False,True,True]

sc3_name_to_hs_name :: String -> String Source #

Convert from ScLang (class) name to Haskell (function) name.

>>> let f = unwords . map sc3_name_to_hs_name . words
>>> f "SinOsc LFSaw FFT PV_Add AllpassN BHiPass BinaryOpUGen HPZ1 RLPF"
"sinOsc lfSaw fft pv_Add allpassN bHiPass binaryOpUGen hpz1 rlpf"
>>> f "TGrains DFM1 FBSineC A2K Lag2UD IIRFilter FMGrainB Pan2 PeakEQ RIRandN"
"tGrains dfm1 fbSineC a2k lag2UD iirFilter fmGrainB pan2 peakEQ riRandN"

sc3_name_to_lisp_name :: String -> String Source #

Convert from Sc3 name to Lisp style name.

>>> let f = unwords . map sc3_name_to_lisp_name . words
>>> f "SinOsc LFSaw FFT PV_Add AllpassN BHiPass BinaryOpUGen HPZ1 RLPF TGrains DFM1 BPeakEQ Pan2 RIRandN"
"sin-osc lf-saw fft pv-add allpass-n b-hi-pass binary-op-u-gen hpz1 rlpf t-grains dfm1 b-peak-e-q pan-2 ri-rand-n"

sc3_ugen_name_sep :: String -> Maybe (String, Maybe Rate) Source #

Sc3 Ugen names are given with rate suffixes if oscillators, without if filters.

>>> map sc3_ugen_name_sep (words "SinOsc.ar LPF *")
[Just ("SinOsc",Just AudioRate),Just ("LPF",Nothing),Just ("*",Nothing)]