{-# LANGUAGE OverloadedStrings #-}
module Harmonic.Interface.Tidal.Orchestra (
Voice(..), VoiceLines(..), voiceLines, vlGet, voiceOct,
flute, oboe, clarinet, bassoon,
horn, trombone, basstrom,
harp, timpani,
violin1, violin2, viola, cello, contrabass,
bassdrum, tamtam,
pizz, spicc, marc, legg, arco,
Instrument, divisi, divisi2, divisi3,
clip, voiceBase, voiceTier,
) where
import Sound.Tidal.Context hiding (voice, clip)
import qualified Data.Map.Strict as Map
import Harmonic.Interface.Tidal.Bridge (VoiceFunction, arrange, overlapF)
import Harmonic.Interface.Tidal.Arranger (flow, root, grid)
import Harmonic.Interface.Tidal.Form (IK)
import Harmonic.Interface.Tidal.Instruments (ch, vel)
import Harmonic.Interface.Tidal.Utils (oct)
import Harmonic.Rules.Types.ProgressionContext (Layer(..))
data Voice
= Soprano | Alto | Tenor | Bass
| Soprano8va | Alto8va | Tenor8va | Bass8va
| Soprano15va | Alto15va | Tenor15va | Bass15va
| Soprano8vb | Alto8vb | Tenor8vb | Bass8vb
| Soprano15vb | Alto15vb | Tenor15vb | Bass15vb
| Soprano' | Alto' | Tenor' | Bass'
| Soprano8va' | Alto8va' | Tenor8va' | Bass8va'
| Soprano15va' | Alto15va' | Tenor15va' | Bass15va'
| Soprano8vb' | Alto8vb' | Tenor8vb' | Bass8vb'
| Soprano15vb' | Alto15vb' | Tenor15vb' | Bass15vb'
| Soprano'' | Alto'' | Tenor'' | Bass''
| Soprano8va'' | Alto8va'' | Tenor8va'' | Bass8va''
| Soprano15va'' | Alto15va'' | Tenor15va'' | Bass15va''
| Soprano8vb'' | Alto8vb'' | Tenor8vb'' | Bass8vb''
| Soprano15vb'' | Alto15vb'' | Tenor15vb'' | Bass15vb''
deriving (Int -> Voice -> ShowS
[Voice] -> ShowS
Voice -> String
(Int -> Voice -> ShowS)
-> (Voice -> String) -> ([Voice] -> ShowS) -> Show Voice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Voice -> ShowS
showsPrec :: Int -> Voice -> ShowS
$cshow :: Voice -> String
show :: Voice -> String
$cshowList :: [Voice] -> ShowS
showList :: [Voice] -> ShowS
Show, Voice -> Voice -> Bool
(Voice -> Voice -> Bool) -> (Voice -> Voice -> Bool) -> Eq Voice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Voice -> Voice -> Bool
== :: Voice -> Voice -> Bool
$c/= :: Voice -> Voice -> Bool
/= :: Voice -> Voice -> Bool
Eq, Eq Voice
Eq Voice =>
(Voice -> Voice -> Ordering)
-> (Voice -> Voice -> Bool)
-> (Voice -> Voice -> Bool)
-> (Voice -> Voice -> Bool)
-> (Voice -> Voice -> Bool)
-> (Voice -> Voice -> Voice)
-> (Voice -> Voice -> Voice)
-> Ord Voice
Voice -> Voice -> Bool
Voice -> Voice -> Ordering
Voice -> Voice -> Voice
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Voice -> Voice -> Ordering
compare :: Voice -> Voice -> Ordering
$c< :: Voice -> Voice -> Bool
< :: Voice -> Voice -> Bool
$c<= :: Voice -> Voice -> Bool
<= :: Voice -> Voice -> Bool
$c> :: Voice -> Voice -> Bool
> :: Voice -> Voice -> Bool
$c>= :: Voice -> Voice -> Bool
>= :: Voice -> Voice -> Bool
$cmax :: Voice -> Voice -> Voice
max :: Voice -> Voice -> Voice
$cmin :: Voice -> Voice -> Voice
min :: Voice -> Voice -> Voice
Ord, Int -> Voice
Voice -> Int
Voice -> [Voice]
Voice -> Voice
Voice -> Voice -> [Voice]
Voice -> Voice -> Voice -> [Voice]
(Voice -> Voice)
-> (Voice -> Voice)
-> (Int -> Voice)
-> (Voice -> Int)
-> (Voice -> [Voice])
-> (Voice -> Voice -> [Voice])
-> (Voice -> Voice -> [Voice])
-> (Voice -> Voice -> Voice -> [Voice])
-> Enum Voice
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: Voice -> Voice
succ :: Voice -> Voice
$cpred :: Voice -> Voice
pred :: Voice -> Voice
$ctoEnum :: Int -> Voice
toEnum :: Int -> Voice
$cfromEnum :: Voice -> Int
fromEnum :: Voice -> Int
$cenumFrom :: Voice -> [Voice]
enumFrom :: Voice -> [Voice]
$cenumFromThen :: Voice -> Voice -> [Voice]
enumFromThen :: Voice -> Voice -> [Voice]
$cenumFromTo :: Voice -> Voice -> [Voice]
enumFromTo :: Voice -> Voice -> [Voice]
$cenumFromThenTo :: Voice -> Voice -> Voice -> [Voice]
enumFromThenTo :: Voice -> Voice -> Voice -> [Voice]
Enum, Voice
Voice -> Voice -> Bounded Voice
forall a. a -> a -> Bounded a
$cminBound :: Voice
minBound :: Voice
$cmaxBound :: Voice
maxBound :: Voice
Bounded)
data VoiceLines = VoiceLines
{ VoiceLines -> Pattern Int
_vl :: Pattern Int
, VoiceLines -> Pattern Int
soprano :: Pattern Int
, VoiceLines -> Pattern Int
alto :: Pattern Int
, VoiceLines -> Pattern Int
tenor :: Pattern Int
, VoiceLines -> Pattern Int
bass :: Pattern Int
, VoiceLines -> Pattern Int
soprano' :: Pattern Int
, VoiceLines -> Pattern Int
alto' :: Pattern Int
, VoiceLines -> Pattern Int
tenor' :: Pattern Int
, VoiceLines -> Pattern Int
bass' :: Pattern Int
, VoiceLines -> Pattern Int
soprano'':: Pattern Int
, VoiceLines -> Pattern Int
alto'' :: Pattern Int
, VoiceLines -> Pattern Int
tenor'' :: Pattern Int
, VoiceLines -> Pattern Int
bass'' :: Pattern Int
}
voiceLines :: VoiceLines
voiceLines :: VoiceLines
voiceLines = VoiceLines
{ _vl :: Pattern Int
_vl = Pattern Int
"~"
, soprano :: Pattern Int
soprano = Pattern Int
"3"
, alto :: Pattern Int
alto = Pattern Int
"1"
, tenor :: Pattern Int
tenor = Pattern Int
"2"
, bass :: Pattern Int
bass = Pattern Int
"0"
, soprano' :: Pattern Int
soprano' = Pattern Int
"4"
, alto' :: Pattern Int
alto' = Pattern Int
"2"
, tenor' :: Pattern Int
tenor' = Pattern Int
"3"
, bass' :: Pattern Int
bass' = Pattern Int
"1"
, soprano'' :: Pattern Int
soprano''= Pattern Int
"5"
, alto'' :: Pattern Int
alto'' = Pattern Int
"3"
, tenor'' :: Pattern Int
tenor'' = Pattern Int
"4"
, bass'' :: Pattern Int
bass'' = Pattern Int
"2"
}
voiceBase :: Voice -> Voice
voiceBase :: Voice -> Voice
voiceBase = Int -> Voice
forall a. Enum a => Int -> a
toEnum (Int -> Voice) -> (Voice -> Int) -> Voice -> Voice
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Int -> Int
forall a. Integral a => a -> a -> a
`mod` Int
20) (Int -> Int) -> (Voice -> Int) -> Voice -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Voice -> Int
forall a. Enum a => a -> Int
fromEnum
voiceTier :: Voice -> Int
voiceTier :: Voice -> Int
voiceTier = (Int -> Int -> Int
forall a. Integral a => a -> a -> a
`div` Int
20) (Int -> Int) -> (Voice -> Int) -> Voice -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Voice -> Int
forall a. Enum a => a -> Int
fromEnum
data VLetter = LtrS | LtrA | LtrT | LtrB
voiceLetter :: Voice -> VLetter
voiceLetter :: Voice -> VLetter
voiceLetter Voice
v = case Voice -> Voice
voiceBase Voice
v of
Voice
Soprano -> VLetter
LtrS; Voice
Soprano8va -> VLetter
LtrS; Voice
Soprano15va -> VLetter
LtrS; Voice
Soprano8vb -> VLetter
LtrS; Voice
Soprano15vb -> VLetter
LtrS
Voice
Alto -> VLetter
LtrA; Voice
Alto8va -> VLetter
LtrA; Voice
Alto15va -> VLetter
LtrA; Voice
Alto8vb -> VLetter
LtrA; Voice
Alto15vb -> VLetter
LtrA
Voice
Tenor -> VLetter
LtrT; Voice
Tenor8va -> VLetter
LtrT; Voice
Tenor15va -> VLetter
LtrT; Voice
Tenor8vb -> VLetter
LtrT; Voice
Tenor15vb -> VLetter
LtrT
Voice
_ -> VLetter
LtrB
vlGet :: Voice -> VoiceLines -> Pattern Int
vlGet :: Voice -> VoiceLines -> Pattern Int
vlGet Voice
v = case (Voice -> VLetter
voiceLetter Voice
v, Voice -> Int
voiceTier Voice
v) of
(VLetter
LtrS, Int
0) -> VoiceLines -> Pattern Int
soprano; (VLetter
LtrS, Int
1) -> VoiceLines -> Pattern Int
soprano'; (VLetter
LtrS, Int
_) -> VoiceLines -> Pattern Int
soprano''
(VLetter
LtrA, Int
0) -> VoiceLines -> Pattern Int
alto; (VLetter
LtrA, Int
1) -> VoiceLines -> Pattern Int
alto'; (VLetter
LtrA, Int
_) -> VoiceLines -> Pattern Int
alto''
(VLetter
LtrT, Int
0) -> VoiceLines -> Pattern Int
tenor; (VLetter
LtrT, Int
1) -> VoiceLines -> Pattern Int
tenor'; (VLetter
LtrT, Int
_) -> VoiceLines -> Pattern Int
tenor''
(VLetter
LtrB, Int
0) -> VoiceLines -> Pattern Int
bass; (VLetter
LtrB, Int
1) -> VoiceLines -> Pattern Int
bass'; (VLetter
LtrB, Int
_) -> VoiceLines -> Pattern Int
bass''
voiceOct :: Voice -> Int
voiceOct :: Voice -> Int
voiceOct Voice
v = case Voice -> Voice
voiceBase Voice
v of
Voice
Soprano -> Int
0; Voice
Alto -> Int
0; Voice
Tenor -> Int
0; Voice
Bass -> Int
0
Voice
Soprano8va -> Int
1; Voice
Alto8va -> Int
1; Voice
Tenor8va -> Int
1; Voice
Bass8va -> Int
1
Voice
Soprano15va -> Int
2; Voice
Alto15va -> Int
2; Voice
Tenor15va -> Int
2; Voice
Bass15va -> Int
2
Voice
Soprano8vb -> (-Int
1); Voice
Alto8vb -> (-Int
1); Voice
Tenor8vb -> (-Int
1); Voice
Bass8vb -> (-Int
1)
Voice
_ -> (-Int
2)
clip :: (Int, Int) -> ControlPattern -> ControlPattern
clip :: (Int, Int) -> ControlPattern -> ControlPattern
clip (Int
lo, Int
hi) = (ValueMap -> Bool) -> ControlPattern -> ControlPattern
forall a. (a -> Bool) -> Pattern a -> Pattern a
filterValues (\ValueMap
vm ->
case String -> ValueMap -> Maybe Value
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup String
"note" ValueMap
vm of
Just (VF Double
v) -> Double
v Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
>= Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
lo Bool -> Bool -> Bool
&& Double
v Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
<= Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hi
Just (VN Note
n) -> let v :: Double
v = Note -> Double
unNote Note
n in Double
v Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
>= Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
lo Bool -> Bool -> Bool
&& Double
v Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
<= Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hi
Maybe Value
_ -> Bool
True)
instrument :: (Int, Int) -> Int -> Layer -> (Double, Double) -> IK -> VoiceLines -> VoiceFunction -> Voice -> ControlPattern
instrument :: (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (Int, Int)
range Int
channel Layer
lyr (Double, Double)
ki IK
k VoiceLines
vl VoiceFunction
vf Voice
v =
(Int, Int) -> ControlPattern -> ControlPattern
clip (Int, Int)
range (ControlPattern -> ControlPattern)
-> ControlPattern -> ControlPattern
forall a b. (a -> b) -> a -> b
$ (Double, Double)
-> IK
-> (Int, Int)
-> Layer
-> VoiceFunction
-> (Progression -> Progression)
-> [Pattern Int]
-> ControlPattern
arrange (Double, Double)
ki IK
k (-Int
9,Int
9) Layer
lyr VoiceFunction
vf (Int -> Progression -> Progression
overlapF Int
0) [Voice -> VoiceLines -> Pattern Int
vlGet Voice
v VoiceLines
vl] ControlPattern -> ControlPattern -> ControlPattern
forall b. Unionable b => Pattern b -> Pattern b -> Pattern b
# Int -> ControlPattern
ch Int
channel ControlPattern -> ControlPattern -> ControlPattern
forall a. Num a => Pattern a -> Pattern a -> Pattern a
|+ Int -> ControlPattern
oct (Voice -> Int
voiceOct Voice
v)
flute, oboe, clarinet, bassoon :: Layer -> (Double, Double) -> IK -> VoiceLines -> VoiceFunction -> Voice -> ControlPattern
flute :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
flute = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
12, Int
26) Int
1
oboe :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
oboe = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument ( -Int
2, Int
33) Int
2
clarinet :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
clarinet = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
22, Int
34) Int
3
bassoon :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
bassoon = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
28, Int
15) Int
4
horn, trombone, basstrom :: Layer -> (Double, Double) -> IK -> VoiceLines -> VoiceFunction -> Voice -> ControlPattern
horn :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
horn = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
29, Int
17) Int
5
trombone :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
trombone = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
28, Int
17) Int
6
basstrom :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
basstrom = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
39, -Int
5) Int
6
harp :: Layer -> (Double, Double) -> IK -> VoiceLines -> VoiceFunction -> Voice -> ControlPattern
harp :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
harp = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
29, Int
42) Int
7
timpani :: Layer -> (Double, Double) -> IK -> VoiceLines -> VoiceFunction -> Voice -> ControlPattern
timpani :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
timpani = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
22, Int
0) Int
8
violin1, violin2, viola, cello, contrabass :: Layer -> (Double, Double) -> IK -> VoiceLines -> VoiceFunction -> Voice -> ControlPattern
violin1 :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
violin1 = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument ( -Int
5, Int
45) Int
16
violin2 :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
violin2 = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument ( -Int
5, Int
45) Int
16
viola :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
viola = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
12, Int
28) Int
16
cello :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
cello = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
24, Int
24) Int
16
contrabass :: Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
contrabass = (Int, Int)
-> Int
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instrument (-Int
36, Int
0) Int
16
bassdrum :: Pattern Bool -> ControlPattern
bassdrum :: Pattern Bool -> ControlPattern
bassdrum Pattern Bool
pat = Pattern Bool -> ControlPattern -> ControlPattern
forall a. Pattern Bool -> Pattern a -> Pattern a
struct Pattern Bool
pat (ControlPattern -> ControlPattern)
-> ControlPattern -> ControlPattern
forall a b. (a -> b) -> a -> b
$ Pattern Note -> ControlPattern
midinote Pattern Note
36 ControlPattern -> ControlPattern -> ControlPattern
forall b. Unionable b => Pattern b -> Pattern b -> Pattern b
# Int -> ControlPattern
ch Int
9 ControlPattern -> ControlPattern -> ControlPattern
forall b. Unionable b => Pattern b -> Pattern b -> Pattern b
# Pattern Double -> ControlPattern
sustain Pattern Double
0.05
tamtam :: Pattern Bool -> ControlPattern
tamtam :: Pattern Bool -> ControlPattern
tamtam Pattern Bool
pat = Pattern Bool -> ControlPattern -> ControlPattern
forall a. Pattern Bool -> Pattern a -> Pattern a
struct Pattern Bool
pat (ControlPattern -> ControlPattern)
-> ControlPattern -> ControlPattern
forall a b. (a -> b) -> a -> b
$ Pattern Note -> ControlPattern
midinote Pattern Note
31 ControlPattern -> ControlPattern -> ControlPattern
forall b. Unionable b => Pattern b -> Pattern b -> Pattern b
# Int -> ControlPattern
ch Int
11 ControlPattern -> ControlPattern -> ControlPattern
forall b. Unionable b => Pattern b -> Pattern b -> Pattern b
# Pattern Double -> ControlPattern
sustain Pattern Double
0.5
pizz, spicc, marc, legg, arco :: ControlPattern
pizz :: ControlPattern
pizz = Int -> ControlPattern
ch Int
12
spicc :: ControlPattern
spicc = Int -> ControlPattern
ch Int
13
marc :: ControlPattern
marc = Int -> ControlPattern
ch Int
14
legg :: ControlPattern
legg = Int -> ControlPattern
ch Int
15
arco :: ControlPattern
arco = Int -> ControlPattern
ch Int
16
type Instrument =
Layer -> (Double, Double) -> IK -> VoiceLines -> VoiceFunction -> Voice -> ControlPattern
divisi :: Int -> Instrument -> Instrument
divisi :: Int
-> (Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern)
-> Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
divisi Int
n Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instr Layer
lyr (Double, Double)
rng IK
k VoiceLines
vl VoiceFunction
vf Voice
v =
[ControlPattern] -> ControlPattern
forall a. [Pattern a] -> Pattern a
stack [ Layer
-> (Double, Double)
-> IK
-> VoiceLines
-> VoiceFunction
-> Voice
-> ControlPattern
instr Layer
lyr (Double, Double)
rng IK
k VoiceLines
vl VoiceFunction
vf (Int -> Voice -> Voice
forall {c} {a}. (Enum c, Enum a) => Int -> a -> c
primeN Int
i Voice
v) | Int
i <- [Int
0 .. Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1] ]
ControlPattern -> ControlPattern -> ControlPattern
forall a. Num a => Pattern a -> Pattern a -> Pattern a
|* Pattern Double -> ControlPattern
vel (Pattern Double
1 Pattern Double -> Pattern Double -> Pattern Double
forall a. Fractional a => a -> a -> a
/ Pattern Double -> Pattern Double
forall a. Floating a => a -> a
sqrt (Int -> Pattern Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n))
where primeN :: Int -> a -> c
primeN Int
i = Int -> c
forall a. Enum a => Int -> a
toEnum (Int -> c) -> (a -> Int) -> a -> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
20) (Int -> Int) -> (a -> Int) -> a -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Int
forall a. Enum a => a -> Int
fromEnum
divisi2, divisi3 :: ControlPattern
divisi2 :: ControlPattern
divisi2 = Pattern Double -> ControlPattern
vel (Pattern Double
1 Pattern Double -> Pattern Double -> Pattern Double
forall a. Fractional a => a -> a -> a
/ Pattern Double -> Pattern Double
forall a. Floating a => a -> a
sqrt Pattern Double
2)
divisi3 :: ControlPattern
divisi3 = Pattern Double -> ControlPattern
vel (Pattern Double
1 Pattern Double -> Pattern Double -> Pattern Double
forall a. Fractional a => a -> a -> a
/ Pattern Double -> Pattern Double
forall a. Floating a => a -> a
sqrt Pattern Double
3)