dobutokO2 0.37.1.0 → 0.38.0.0
raw patch · 5 files changed
+634/−23 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- DobutokO.Sound: whichOctave :: Double -> Maybe Int
+ DobutokO.Sound: overSoXSynthNGen2E4GPar :: FilePath -> Params -> Double -> Durations -> String -> IO ()
+ DobutokO.Sound: overSoXSynthNGen2E4GSPar :: FilePath -> Params -> Double -> Double -> String -> String -> IO ()
+ DobutokO.Sound: overSoXSynthNGen2EPar :: FilePath -> Params -> Double -> Double -> String -> String -> IO ()
+ DobutokO.Sound: overSoXSynthNGen3E4GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> String -> IO ()
+ DobutokO.Sound: overSoXSynthNGen3E4GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> IO ()
+ DobutokO.Sound: overSoXSynthNGen3E5GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> Intervals -> IO ()
+ DobutokO.Sound: overSoXSynthNGen3E5GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> Intervals -> String -> IO ()
+ DobutokO.Sound: overSoXSynthNGen3E6GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> Intervals -> Strengths -> Double -> IO ()
+ DobutokO.Sound: overSoXSynthNGen3E6GSPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> Intervals -> String -> Double -> IO ()
+ DobutokO.Sound: overSoXSynthNGen3E6GSuPar :: FilePath -> Params -> Double -> Double -> Double -> String -> Intervals -> String -> Double -> IO ()
+ DobutokO.Sound: overSoXSynthNGen3EPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> IO ()
+ DobutokO.Sound: overSoXSynthNGenE4GPar :: FilePath -> Params -> Double -> Durations -> IO ()
+ DobutokO.Sound: overSoXSynthNGenE4GSPar :: FilePath -> Params -> Double -> Double -> String -> IO ()
+ DobutokO.Sound: overSoXSynthNGenEPar :: FilePath -> Params -> Double -> Double -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen3E4GPar :: FilePath -> Params -> Double -> Durations -> String -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen3E4GSPar :: FilePath -> Params -> Double -> Double -> String -> String -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen3EPar :: FilePath -> Params -> Double -> Double -> String -> String -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen4E4GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> String -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen4E4GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen4E5GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> String -> Intervals -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen4E5GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> Intervals -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen4E6GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> String -> Intervals -> Strengths -> Double -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen4E6GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> Intervals -> String -> String -> Double -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen4E6GSuPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> Intervals -> String -> String -> Double -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGen4EPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGenE4GPar :: FilePath -> Params -> Double -> Durations -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGenE4GSPar :: FilePath -> Params -> Double -> Double -> String -> String -> IO ()
+ DobutokO.Sound: uniqOverSoXSynthNGenEPar :: FilePath -> Params -> Double -> Double -> String -> String -> IO ()
+ DobutokO.Sound.Functional: data Params
+ DobutokO.Sound.Functional: elemCloseP :: Double -> Params -> Bool
+ DobutokO.Sound.Functional: elemP :: Double -> Params -> Bool
+ DobutokO.Sound.Functional: filterInParams :: Params -> Maybe (Vector Double)
+ DobutokO.Sound.Functional: instance GHC.Classes.Eq DobutokO.Sound.Functional.Params
+ DobutokO.Sound.Functional: instance GHC.Classes.Ord DobutokO.Sound.Functional.Params
+ DobutokO.Sound.Functional: instance GHC.Show.Show DobutokO.Sound.Functional.Params
+ DobutokO.Sound.Functional: lengthP :: Params -> Int
+ DobutokO.Sound.Functional: liftInParams :: Double -> Params -> Double
+ DobutokO.Sound.Functional: liftInParamsV :: Params -> Vector Double -> Vector Double
+ DobutokO.Sound.Functional: overSoXSynthGen2FDN_SG2GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> String -> String -> ((Double -> OvertonesO) -> (Double, Double) -> Int -> String -> String -> IO ()) -> String -> IO ()
+ DobutokO.Sound.Functional: overSoXSynthGen2FDN_SG4GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> Durations -> String -> ((Double -> OvertonesO) -> (Double, Double) -> Int -> String -> IO ()) -> IO ()
+ DobutokO.Sound.Functional: overSoXSynthGen2FDN_SG6GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> Durations -> String -> ((Double -> OvertonesO) -> (Double, Double) -> Int -> String -> IO ()) -> Strengths -> Double -> IO ()
+ DobutokO.Sound.Functional: overSoXSynthGen2FDN_Sf3G2GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> Double -> String -> String -> ((Double -> OvertonesO) -> (Double, Double, Double) -> Int -> String -> String -> IO ()) -> String -> IO ()
+ DobutokO.Sound.Functional: overSoXSynthGen2FDN_Sf3GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> Double -> String -> String -> ((Double -> OvertonesO) -> (Double, Double, Double) -> Int -> String -> IO ()) -> IO ()
+ DobutokO.Sound.Functional: overSoXSynthGen2FDN_SfPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> String -> String -> IO ()
+ DobutokO.Sound.Functional: showD :: Params -> String
+ DobutokO.Sound.Functional: sortNoDup :: Ord a => [a] -> [a]
+ DobutokO.Sound.Functional: toneD :: Int -> Int -> Int -> [Int] -> Bool
+ DobutokO.Sound.Functional: toneE :: Int -> Int -> Int -> [Int] -> Bool
+ DobutokO.Sound.Functional: whichOctave :: Double -> Maybe Int
+ DobutokO.Sound.Functional: whichOctaveG :: Double -> Maybe Int
Files
- CHANGELOG.md +6/−0
- DobutokO/Sound.hs +298/−20
- DobutokO/Sound/Functional.hs +324/−2
- README.markdown +5/−0
- dobutokO2.cabal +1/−1
CHANGELOG.md view
@@ -347,3 +347,9 @@ ## 0.37.1.0 -- 2020-04-28 * Thirty-seventh version revised A. Fixed issues with the negative argument for the SoX "synth" effect in the DobutokO.Sound module.++## 0.38.0.0 -- 2020-05-02++* Thirty-eigth version. Added new datatype Params to DobutokO.Sound.Functional module. Added new generalized functions to work with Params to +DobutokO.Sound.Functional and DobutokO.Sound modules. They allow to use tonalities in compositions. Although a great part of the already existed +functions in the modules provides very similar behaviour to the some variant of the new ones they still are left in the modules.
DobutokO/Sound.hs view
@@ -43,7 +43,6 @@ -- ** Work with octaves , octaveUp , octaveDown- , whichOctave , liftInOctave , liftInOctaveV -- ** Even more extended@@ -114,6 +113,37 @@ , uniqOverSoXSynthN46GSu , uniqOverSoXSynthNGen4E6GS , uniqOverSoXSynthNGen4E6GSu+ -- * New generalized functions working with Params+ , overSoXSynthNGenEPar+ , overSoXSynthNGenE4GSPar+ , overSoXSynthNGenE4GPar+ , overSoXSynthNGen2EPar+ , overSoXSynthNGen2E4GSPar+ , overSoXSynthNGen2E4GPar+ , overSoXSynthNGen3EPar+ , overSoXSynthNGen3E4GSPar+ , overSoXSynthNGen3E4GPar+ , overSoXSynthNGen3E5GPar+ , overSoXSynthNGen3E5GSPar+ , overSoXSynthNGen3E6GPar+ , overSoXSynthNGen3E6GSPar+ , overSoXSynthNGen3E6GSuPar+ -- ** With overtones obtained from the additional Ukrainian text+ , uniqOverSoXSynthNGenEPar+ , uniqOverSoXSynthNGenE4GSPar+ , uniqOverSoXSynthNGenE4GPar+ , uniqOverSoXSynthNGen3EPar+ , uniqOverSoXSynthNGen3E4GSPar+ , uniqOverSoXSynthNGen3E4GPar+ , uniqOverSoXSynthNGen4EPar+ , uniqOverSoXSynthNGen4E4GSPar+ , uniqOverSoXSynthNGen4E4GPar+ , uniqOverSoXSynthNGen4E5GPar+ , uniqOverSoXSynthNGen4E5GSPar+ , uniqOverSoXSynthNGen4E6GPar+ , uniqOverSoXSynthNGen4E6GSPar+ , uniqOverSoXSynthNGen4E6GSuPar+ ) where import CaseBi (getBFst')@@ -183,19 +213,7 @@ ----------------------------------------------------------------------------------------------------------------------------- --- | Function can be used to determine to which octave (in the American notation for the notes, this is a number in the note written form,--- e. g. for C4 this is 4) the frequency belongs (to be more exact, the closest note for the given frequency -- see 'closestNote' taking into account--- its lower pure quint, which can lay in the lower by 1 octave). If it is not practical to determine the number, then the function returns 'Nothing'.-whichOctave :: Double -> Maybe Int-whichOctave x- | compare (closestNote x) 24.4996 == GT = (\t ->- case isJust t of - True -> fmap (\z ->- case z of- 0 -> z- _ -> z - 1) t- _ -> Just 8) . V.findIndex (\(t1, t2) -> compare (closestNote x) t1 == LT) $ octavesT- | otherwise = Nothing+ -- | Function lifts the given frequency to the given number of the octave (in American notation, from 0 to 8). This number is an 'Int' parameter. -- The function also takes into account the lower pure quint for the closest note.@@ -538,6 +556,13 @@ n <- duration1000 file nGenE4Gi n file m ku ampL (str2DurationsDef n zs time3) +-- | Generalized version of the 'overSoXSynthNGenE' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGenEPar :: FilePath -> Params -> Double -> Double -> String -> IO ()+overSoXSynthNGenEPar file params ampL time3 zs = do+ n <- duration1000 file+ nGenE4GiPar n file params ampL (str2DurationsDef n zs time3)+ -- | Variant of the 'overSoXSynthNGenE4G' where 'Durations' are obtained from the 'String' using 'str2Durations' function. Helps to create a speech-like -- composition. overSoXSynthNGenE4GS :: FilePath -> Int -> Int -> Double -> Double -> String -> IO ()@@ -545,6 +570,13 @@ n <- duration1000 file nGenE4Gi n file m ku ampL (str2Durations zs time3) +-- | Generalized version of the 'overSoXSynthNGenE4GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGenE4GSPar :: FilePath -> Params -> Double -> Double -> String -> IO ()+overSoXSynthNGenE4GSPar file params ampL time3 zs = do+ n <- duration1000 file+ nGenE4GiPar n file params ampL (str2Durations zs time3) + -- | Note that the last two 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The third 'Int' parameter defines that @n@. nGenE4Gi :: Int -> FilePath -> Int -> Int -> Double -> Durations -> IO ()@@ -552,7 +584,16 @@ vecA <- freqsFromFile file n let vecB = liftInEnkuV m ku . V.map fromIntegral . V.filter (/= (11440::Int)) $ vecA overSoXSynthN4G n ampL v2 vecB- endFromResult + endFromResult + +-- | Generalized version of the 'nGenE4Gi' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+nGenE4GiPar :: Int -> FilePath -> Params -> Double -> Durations -> IO ()+nGenE4GiPar n file params ampL v2 = do+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ overSoXSynthN4G n ampL v2 vecB+ endFromResult -- | 4G genaralized version of the 'overSoXSynthNGenE' where you provide your own 'Durations'. overSoXSynthNGenE4G :: FilePath -> Int -> Int -> Double -> Durations -> IO ()@@ -560,6 +601,13 @@ n <- duration1000 file nGenE4Gi n file m ku ampL v2 +-- | Generalized version of the 'overSoXSynthNGenE4G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGenE4GPar :: FilePath -> Params -> Double -> Durations -> IO ()+overSoXSynthNGenE4GPar file params ampL v2 = do+ n <- duration1000 file+ nGenE4GiPar n file params ampL v2 + -- | Similar to 'overSoXSynthN2', but uses a sound file to obtain the information analogous to 'V.Vector' in the latter one. Besides, the function lifts -- the frequencies to the octave with the given by 'Int' parameter number (better to use from the range [1..8]). The first 'Double' argument from -- the range [0.01..1.0] is used as a maximum amplitude for Overtones. If it is set to 1.0 the overTones amplitudes are just maximum ones,@@ -580,6 +628,13 @@ n <- duration1000 file nGen2E4Gi n file m ku ampL (str2DurationsDef n zs time3) tts +-- | Generalized version of the 'overSoXSynthNGen2E' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen2EPar :: FilePath -> Params -> Double -> Double -> String -> String -> IO ()+overSoXSynthNGen2EPar file params ampL time3 zs tts = do+ n <- duration1000 file+ nGen2E4GiPar n file params ampL (str2DurationsDef n zs time3) tts + -- | Variant of the 'overSoXSynthNGen2E4G' where 'Durations' are obtained from the 'String' using 'str2Durations' function. Helps to create a speech-like -- composition. overSoXSynthNGen2E4GS :: FilePath -> Int -> Int -> Double -> Double -> String -> String -> IO ()@@ -587,6 +642,13 @@ n <- duration1000 file nGen2E4Gi n file m ku ampL (str2Durations zs time3) tts +-- | Generalized version of the 'overSoXSynthNGen2E4GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen2E4GSPar :: FilePath -> Params -> Double -> Double -> String -> String -> IO ()+overSoXSynthNGen2E4GSPar file params ampL time3 zs tts = do+ n <- duration1000 file+ nGen2E4GiPar n file params ampL (str2Durations zs time3) tts+ -- | Note that the last two 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The third 'Int' parameter defines that @n@. nGen2E4Gi :: Int -> FilePath -> Int -> Int -> Double -> Durations -> String -> IO ()@@ -595,6 +657,15 @@ let vecB = liftInEnkuV m ku . V.map fromIntegral . V.filter (/= (11440::Int)) $ vecA overSoXSynthN24G n ampL v2 tts vecB endFromResult ++-- | Generalized version of the 'nGen2E4Gi' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+nGen2E4GiPar :: Int -> FilePath -> Params -> Double -> Durations -> String -> IO ()+nGen2E4GiPar n file params ampL v2 tts = do+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ overSoXSynthN24G n ampL v2 tts vecB+ endFromResult -- | 4G genaralized version of the 'overSoXSynthNGen2E' where you provide your own 'Durations'. overSoXSynthNGen2E4G :: FilePath -> Int -> Int -> Double -> Durations -> String -> IO ()@@ -602,6 +673,13 @@ n <- duration1000 file nGen2E4Gi n file m ku ampL v2 tts +-- | Generalized version of the 'overSoXSynthNGen2E4G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen2E4GPar :: FilePath -> Params -> Double -> Durations -> String -> IO ()+overSoXSynthNGen2E4GPar file params ampL v2 tts = do+ n <- duration1000 file+ nGen2E4GiPar n file params ampL v2 tts + -- | Similar to 'overSoXSynthN2', but uses a sound file to obtain the information analogous to 'V.Vector' in the latter one. Besides, the function lifts -- the frequencies to the octave with the given by 'Int' parameter number (better to use from the range [1..8]). The first 'Double' argument from -- the range [0.01..1.0] is used as a maximum amplitude for Overtones. If it is set to 1.0 the overTones amplitudes are just maximum ones,@@ -626,14 +704,28 @@ n <- duration1000 file nGen3E4Gi n file m ku ampL dAmpl (str2DurationsDef n zs time3) tts vs +-- | Generalized version of the 'overSoXSynthNGen3E' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen3EPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> IO ()+overSoXSynthNGen3EPar file params ampL time3 dAmpl zs tts vs = do+ n <- duration1000 file+ nGen3E4GiPar n file params ampL dAmpl (str2DurationsDef n zs time3) tts vs + -- | Variant of the 'overSoXSynthNGen3E4G' where 'Durations' are obtained from the 'String' using 'str2Durations' function. Helps to create a speech-like -- composition. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@. overSoXSynthNGen3E4GS :: FilePath -> Int -> Int -> Double -> Double -> Double -> String -> String -> String -> IO () overSoXSynthNGen3E4GS file m ku ampL time3 dAmpl zs tts vs = do n <- duration1000 file- nGen3E4Gi n file m ku ampL dAmpl (str2Durations zs time3) tts vs + nGen3E4Gi n file m ku ampL dAmpl (str2Durations zs time3) tts vs +-- | Generalized version of the 'overSoXSynthNGen3E4GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen3E4GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> IO ()+overSoXSynthNGen3E4GSPar file params ampL time3 dAmpl zs tts vs = do+ n <- duration1000 file+ nGen3E4GiPar n file params ampL dAmpl (str2Durations zs time3) tts vs + -- | Note that the last two 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The third 'Int' parameter defines that @n@. nGen3E4Gi :: Int -> FilePath -> Int -> Int -> Double -> Double -> Durations -> String -> String -> IO ()@@ -643,6 +735,15 @@ overSoXSynthN34G n ampL dAmpl v2 tts vs vecB endFromResult +-- | Generalized version of the 'nGen3E4Gi' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+nGen3E4GiPar :: Int -> FilePath -> Params -> Double -> Double -> Durations -> String -> String -> IO ()+nGen3E4GiPar n file params ampL dAmpl v2 tts vs = do + vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ overSoXSynthN34G n ampL dAmpl v2 tts vs vecB+ endFromResult + -- | Note that the last two 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The third 'Int' parameter defines that @n@. nGen3E5Gi :: Int -> FilePath -> Int -> Int -> Double -> Double -> Durations -> String -> Intervals -> IO ()@@ -650,7 +751,16 @@ vecA <- freqsFromFile file n let vecB = liftInEnkuV m ku . V.map fromIntegral . V.filter (/= (11440::Int)) $ vecA overSoXSynthN35G n ampL dAmpl v2 tts v3 vecB- endFromResult + endFromResult + +-- | Generalized version of the 'nGen3E5Gi' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+nGen3E5GiPar :: Int -> FilePath -> Params -> Double -> Double -> Durations -> String -> Intervals -> IO ()+nGen3E5GiPar n file params ampL dAmpl v2 tts v3 = do + vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ overSoXSynthN35G n ampL dAmpl v2 tts v3 vecB+ endFromResult -- | 4G generalized function for 'overSoXSynthNGen3E' where you provide your own 'Durations'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@.@@ -659,13 +769,27 @@ n <- duration1000 file nGen3E4Gi n file m ku ampL dAmpl v2 tts vs +-- | Generalized version of the 'overSoXSynthNGen3E4G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen3E4GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> String -> IO ()+overSoXSynthNGen3E4GPar file params ampL dAmpl v2 tts vs = do+ n <- duration1000 file+ nGen3E4GiPar n file params ampL dAmpl v2 tts vs + -- | 5G generalized function for 'overSoXSynthNGen3E4G' where you provide your own 'Intervals'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@. overSoXSynthNGen3E5G :: FilePath -> Int -> Int -> Double -> Double -> Durations -> String -> Intervals -> IO () overSoXSynthNGen3E5G file m ku ampL dAmpl v2 tts v3 = do n <- duration1000 file- nGen3E5Gi n file m ku ampL dAmpl v2 tts v3 + nGen3E5Gi n file m ku ampL dAmpl v2 tts v3 +-- | Generalized version of the 'overSoXSynthNGen3E5G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen3E5GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> Intervals -> IO ()+overSoXSynthNGen3E5GPar file params ampL dAmpl v2 tts v3 = do+ n <- duration1000 file+ nGen3E5GiPar n file params ampL dAmpl v2 tts v3 + -- | Variant of the 'overSoXSynthNGen3E5G' where 'Intervals' are obtained from the basic 'Intervals' with the length no more than 29 and a Ukrainian text -- specified as the last 'String' argument so that you can produce 'Intervals' of the arbitrary length. For more information, please, refer to -- 'intervalsFromStringG' and 'strToIntG'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it @@ -674,6 +798,13 @@ overSoXSynthNGen3E5GS file m ku ampL time3 dAmpl zs tts v3 vs = do n <- duration1000 file nGen3E5Gi n file m ku ampL dAmpl (str2Durations zs time3) tts (intervalsFromStringG v3 vs)++-- | Generalized version of the 'overSoXSynthNGen3E5GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen3E5GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> Intervals -> String -> IO ()+overSoXSynthNGen3E5GSPar file params ampL time3 dAmpl zs tts v3 vs = do+ n <- duration1000 file+ nGen3E5GiPar n file params ampL dAmpl (str2Durations zs time3) tts (intervalsFromStringG v3 vs) -- | 6G generalized function for 'overSoXSynthNGen3E5G' where you provide your own 'Strengths'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@.@@ -681,17 +812,33 @@ overSoXSynthNGen3E6G file m ku ampL dAmpl v2 tts v3 v6 limV = overSoXSynthNGen3E5G file m ku ampL dAmpl v2 tts v3 >> apply6G2 v6 "221w" "result" limV >> endFromResult +-- | Generalized version of the 'overSoXSynthNGen3E6G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen3E6GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> Intervals -> Strengths -> Double -> IO ()+overSoXSynthNGen3E6GPar file params ampL dAmpl v2 tts v3 v6 limV = + overSoXSynthNGen3E5GPar file params ampL dAmpl v2 tts v3 >> apply6G2 v6 "221w" "result" limV >> endFromResult + -- | A variant of 'overSoXSynthNGen3E6G' where 'Strengths' are obtained from a Ukrainian text specified as the last 'String' argument. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@. overSoXSynthNGen3E6GS :: FilePath -> Int -> Int -> Double -> Double -> Durations -> String -> Intervals -> String -> Double -> IO () overSoXSynthNGen3E6GS file m ku ampL dAmpl v2 tts v3 xxs limV = overSoXSynthNGen3E6G file m ku ampL dAmpl v2 tts v3 (str2Volume xxs) limV +-- | Generalized version of the 'overSoXSynthNGen3E6GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen3E6GSPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> Intervals -> String -> Double -> IO ()+overSoXSynthNGen3E6GSPar file params ampL dAmpl v2 tts v3 xxs limV = overSoXSynthNGen3E6GPar file params ampL dAmpl v2 tts v3 (str2Volume xxs) limV+ -- | A variant of 'overSoXSynthNGen3E6GS' where 'Strengths' and 'Durations' are obtained from the same Ukrainian text specified as -- the last 'String' argument. The third 'Double' argument is an average duration of the sounds in seconds. -- Note that 'Int' arguments are used by 'liftInEnku' in that order so it returns a 'Maybe' number (actually frequency) for -- the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@. overSoXSynthNGen3E6GSu :: FilePath -> Int -> Int -> Double -> Double -> Double -> String -> Intervals -> String -> Double -> IO () overSoXSynthNGen3E6GSu file m ku ampL dAmpl time3 tts v3 xxs = overSoXSynthNGen3E6G file m ku ampL dAmpl (str2Durations xxs time3) tts v3 (str2Volume xxs)++-- | Generalized version of the 'overSoXSynthNGen3E6GSu' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthNGen3E6GSuPar :: FilePath -> Params -> Double -> Double -> Double -> String -> Intervals -> String -> Double -> IO ()+overSoXSynthNGen3E6GSuPar file params ampL dAmpl time3 tts v3 xxs = overSoXSynthNGen3E6GPar file params ampL dAmpl (str2Durations xxs time3) tts v3 (str2Volume xxs) -- | For the given frequency and a Ukrainian text it generates a musical sound with the timbre obtained from the Ukrainian text (see the -- documentation for @mmsyn7s@ package). The timbre for another given text usually differs, but can be the same. The last one is only@@ -978,6 +1125,13 @@ n <- duration1000 file unGenNE4Gi n file m ku ampL (str2DurationsDef n zs time3) wws +-- | Generalized version of the 'uniqOverSoXSynthNGenE' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGenEPar :: FilePath -> Params -> Double -> Double -> String -> String -> IO ()+uniqOverSoXSynthNGenEPar file params ampL time3 zs wws = do+ n <- duration1000 file+ unGenNE4GiPar n file params ampL (str2DurationsDef n zs time3) wws + -- | Variant of the 'uniqOverSoXSynthNGenE4G' where 'Durations' are obtained from the 'String' using 'str2Durations' function. Helps to create a speech-like -- composition. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@.@@ -985,6 +1139,13 @@ uniqOverSoXSynthNGenE4GS file m ku ampL time3 zs wws = do n <- duration1000 file unGenNE4Gi n file m ku ampL (str2Durations zs time3) wws+ +-- | Generalized version of the 'uniqOverSoXSynthNGenE4GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGenE4GSPar :: FilePath -> Params -> Double -> Double -> String -> String -> IO ()+uniqOverSoXSynthNGenE4GSPar file params ampL time3 zs wws = do+ n <- duration1000 file+ unGenNE4GiPar n file params ampL (str2Durations zs time3) wws -- | Note that the last two 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The third 'Int' parameter defines that @n@.@@ -995,13 +1156,29 @@ uniqOverSoXSynthN4G n ampL v2 wws vecB endFromResult +-- | Generalized version of the 'unGenNE4Gi' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+unGenNE4GiPar :: Int -> FilePath -> Params -> Double -> Durations -> String -> IO ()+unGenNE4GiPar n file params ampL v2 wws = do+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ uniqOverSoXSynthN4G n ampL v2 wws vecB+ endFromResult + -- | 4G genaralized version of the 'uniqOverSoXSynthNGenE' where you provide your own 'Durations'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@. uniqOverSoXSynthNGenE4G :: FilePath -> Int -> Int -> Double -> Durations -> String -> IO () uniqOverSoXSynthNGenE4G file m ku ampL v2 wws = do n <- duration1000 file- unGenNE4Gi n file m ku ampL v2 wws + unGenNE4Gi n file m ku ampL v2 wws +-- | Generalized version of the 'uniqOverSoXSynthNGenE4G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGenE4GPar :: FilePath -> Params -> Double -> Durations -> String -> IO ()+uniqOverSoXSynthNGenE4GPar file params ampL v2 wws = do+ n <- duration1000 file+ unGenNE4GiPar n file params ampL v2 wws + -- | Similar to 'uniqOverSoXSynthN', but uses a sound file to obtain the information analogous to 'V.Vector' in the latter one. -- Besides, the function lifts the frequencies to the octave with the given by 'Int' parameter number (better to use from the range [1..8]). -- The first 'Double' argument from the range [0.01..1.0] is used as a maximum amplitude for Overtones. If it is set to 1.0 the@@ -1023,6 +1200,13 @@ n <- duration1000 file unGenN3E4Gi n file m ku ampL (str2DurationsDef n zs time3) wws tts +-- | Generalized version of the 'uniqOverSoXSynthNGen3E' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen3EPar :: FilePath -> Params -> Double -> Double -> String -> String -> String -> IO ()+uniqOverSoXSynthNGen3EPar file params ampL time3 zs wws tts = do+ n <- duration1000 file+ unGenN3E4GiPar n file params ampL (str2DurationsDef n zs time3) wws tts + -- | Variant of the 'uniqOverSoXSynthNGen3E4G' where 'Durations' are obtained from the 'String' using 'str2Durations' function. Helps to create a speech-like -- composition. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@.@@ -1031,6 +1215,13 @@ n <- duration1000 file unGenN3E4Gi n file m ku ampL (str2Durations zs time3) wws tts +-- | Generalized version of the 'uniqOverSoXSynthNGen3E4GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen3E4GSPar :: FilePath -> Params -> Double -> Double -> String -> String -> String -> IO ()+uniqOverSoXSynthNGen3E4GSPar file params ampL time3 zs wws tts = do+ n <- duration1000 file+ unGenN3E4GiPar n file params ampL (str2Durations zs time3) wws tts+ -- | Note that the last two 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The third 'Int' parameter defines that @n@. unGenN3E4Gi :: Int -> FilePath -> Int -> Int -> Double -> Durations -> String -> String -> IO ()@@ -1040,12 +1231,28 @@ uniqOverSoXSynthN34G n ampL v2 wws tts vecB endFromResult +-- | Generalized version of the 'unGenN3E4Gi' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+unGenN3E4GiPar :: Int -> FilePath -> Params -> Double -> Durations -> String -> String -> IO ()+unGenN3E4GiPar n file params ampL v2 wws tts = do+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ uniqOverSoXSynthN34G n ampL v2 wws tts vecB+ endFromResult + -- | 4G genaralized version of the 'uniqOverSoXSynthNGen3E' where you provide your own 'Durations'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@. uniqOverSoXSynthNGen3E4G :: FilePath -> Int -> Int -> Double -> Durations -> String -> String -> IO () uniqOverSoXSynthNGen3E4G file m ku ampL v2 wws tts = do n <- duration1000 file- unGenN3E4Gi n file m ku ampL v2 wws tts + unGenN3E4Gi n file m ku ampL v2 wws tts+ +-- | Generalized version of the 'uniqOverSoXSynthNGen3E4G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen3E4GPar :: FilePath -> Params -> Double -> Durations -> String -> String -> IO ()+uniqOverSoXSynthNGen3E4GPar file params ampL v2 wws tts = do+ n <- duration1000 file+ unGenN3E4GiPar n file params ampL v2 wws tts -- | Similar to 'uniqOverSoXSynthN', but uses a sound file to obtain the information analogous to 'V.Vector' in the latter one. -- Besides, the function lifts the frequencies to the octave with the given by 'Int' parameter number (better to use from the range [1..8]).@@ -1072,6 +1279,13 @@ n <- duration1000 file unGenN4E4Gi n file m ku ampL dAmpl (str2DurationsDef n zs time3) wws tts vs +-- | Generalized version of the 'uniqOverSoXSynthNGen4E' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen4EPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> String -> IO ()+uniqOverSoXSynthNGen4EPar file params ampL time3 dAmpl zs wws tts vs = do+ n <- duration1000 file+ unGenN4E4GiPar n file params ampL dAmpl (str2DurationsDef n zs time3) wws tts vs + -- | Variant of the 'uniqOverSoXSynthNGen4E4G' where 'Durations' are obtained from the 'String' using 'str2Durations' function. Helps to create a speech-like -- composition. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@.@@ -1080,6 +1294,13 @@ n <- duration1000 file unGenN4E4Gi n file m ku ampL dAmpl (str2Durations zs time3) wws tts vs +-- | Generalized version of the 'uniqOverSoXSynthNGen4E4GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen4E4GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> String -> IO ()+uniqOverSoXSynthNGen4E4GSPar file params ampL time3 dAmpl zs wws tts vs = do+ n <- duration1000 file+ unGenN4E4GiPar n file params ampL dAmpl (str2Durations zs time3) wws tts vs + -- | Note that the last two 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The third 'Int' parameter defines that @n@. unGenN4E4Gi :: Int -> FilePath -> Int -> Int -> Double -> Double -> Durations -> String -> String -> String -> IO ()@@ -1089,6 +1310,15 @@ uniqOverSoXSynthN44G n ampL dAmpl v2 wws tts vs vecB endFromResult +-- | Generalized version of the 'unGenN4E4Gi' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+unGenN4E4GiPar :: Int -> FilePath -> Params -> Double -> Double -> Durations -> String -> String -> String -> IO ()+unGenN4E4GiPar n file params ampL dAmpl v2 wws tts vs = do+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ uniqOverSoXSynthN44G n ampL dAmpl v2 wws tts vs vecB+ endFromResult + -- | Note that the last two 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The third 'Int' parameter defines that @n@. unGenN4E5Gi :: Int -> FilePath -> Int -> Int -> Double -> Double -> Durations -> String -> String -> Intervals -> IO ()@@ -1097,6 +1327,15 @@ let vecB = liftInEnkuV m ku . V.map fromIntegral . V.filter (/= (11440::Int)) $ vecA uniqOverSoXSynthN45G n ampL dAmpl v2 wws tts v3 vecB endFromResult++-- | Generalized version of the 'unGenN4E5Gi' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+unGenN4E5GiPar :: Int -> FilePath -> Params -> Double -> Double -> Durations -> String -> String -> Intervals -> IO ()+unGenN4E5GiPar n file params ampL dAmpl v2 wws tts v3 = do+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ uniqOverSoXSynthN45G n ampL dAmpl v2 wws tts v3 vecB+ endFromResult -- | 4G genaralized version of the 'uniqOverSoXSynthNGen4E' where you provide your own 'Durations'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@.@@ -1105,6 +1344,13 @@ n <- duration1000 file unGenN4E4Gi n file m ku ampL dAmpl v2 wws tts vs +-- | Generalized version of the 'uniqOverSoXSynthNGen4E4G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen4E4GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> String -> String -> IO ()+uniqOverSoXSynthNGen4E4GPar file params ampL dAmpl v2 wws tts vs = do+ n <- duration1000 file+ unGenN4E4GiPar n file params ampL dAmpl v2 wws tts vs+ -- | 5G genaralized version of the 'uniqOverSoXSynthNGen4E' where you provide your own 'Durations' and 'Intervals'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@. uniqOverSoXSynthNGen4E5G :: FilePath -> Int -> Int -> Double -> Double -> Durations -> String -> String -> Intervals -> IO ()@@ -1112,6 +1358,13 @@ n <- duration1000 file unGenN4E5Gi n file m ku ampL dAmpl v2 wws tts v3 +-- | Generalized version of the 'uniqOverSoXSynthNGen4E5G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen4E5GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> String -> Intervals -> IO ()+uniqOverSoXSynthNGen4E5GPar file params ampL dAmpl v2 wws tts v3 = do+ n <- duration1000 file+ unGenN4E5GiPar n file params ampL dAmpl v2 wws tts v3 + -- | Variant of the 'uniqOverSoXSynthNGen4E5G' where 'Intervals' are obtained from the 'String' using 'intervalsFromStringG' function. Helps to create a speech-like -- composition. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@.@@ -1120,18 +1373,38 @@ n <- duration1000 file unGenN4E5Gi n file m ku ampL dAmpl (str2Durations zs time3) wws tts (intervalsFromStringG v3 vs) +-- | Generalized version of the 'uniqOverSoXSynthNGen4E5GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen4E5GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> Intervals -> String -> IO ()+uniqOverSoXSynthNGen4E5GSPar file params ampL time3 dAmpl zs wws tts v3 vs = do+ n <- duration1000 file+ unGenN4E5GiPar n file params ampL dAmpl (str2Durations zs time3) wws tts (intervalsFromStringG v3 vs) + -- | 6G generalized function for 'uniqOverSoXSynthNGen4E5G' where you provide your own 'Strengths'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@. uniqOverSoXSynthNGen4E6G :: FilePath -> Int -> Int -> Double -> Double -> Durations -> String -> String -> Intervals -> Strengths -> Double -> IO () uniqOverSoXSynthNGen4E6G file m ku ampL dAmpl v2 wws tts v3 v6 limV = uniqOverSoXSynthNGen4E5G file m ku ampL dAmpl v2 wws tts v3 >> apply6G2 v6 "221w" "result" limV >> endFromResult +-- | Generalized version of the 'uniqOverSoXSynthNGen4E6G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen4E6GPar :: FilePath -> Params -> Double -> Double -> Durations -> String -> String -> Intervals -> Strengths -> Double -> IO ()+uniqOverSoXSynthNGen4E6GPar file params ampL dAmpl v2 wws tts v3 v6 limV = + uniqOverSoXSynthNGen4E5GPar file params ampL dAmpl v2 wws tts v3 >> apply6G2 v6 "221w" "result" limV >> endFromResult + -- | A variant of 'uniqOverSoXSynthNGen4E6G' where 'Strengths' are obtained from a Ukrainian text specified as the last 'String' argument. Note that 'Int' arguments are used by 'liftInEnku' in that order so it -- returns a 'Maybe' number (actually frequency) for the n-th elements set of notes (see 'nkyT'). The second 'Int' parameter defines that @n@. uniqOverSoXSynthNGen4E6GS :: FilePath -> Int -> Int -> Double -> Double -> Double -> String -> String -> String -> Intervals -> String -> String -> Double -> IO () uniqOverSoXSynthNGen4E6GS file m ku ampL time3 dAmpl zs wws tts v5 vs xxs limV = uniqOverSoXSynthNGen4E6G file m ku ampL dAmpl (str2Durations zs time3) wws tts (intervalsFromStringG v5 vs) (str2Volume xxs) limV++-- | Generalized version of the 'uniqOverSoXSynthNGen4E6GS' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen4E6GSPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> String -> Intervals -> String -> + String -> Double -> IO ()+uniqOverSoXSynthNGen4E6GSPar file params ampL time3 dAmpl zs wws tts v5 vs xxs limV = + uniqOverSoXSynthNGen4E6GPar file params ampL dAmpl (str2Durations zs time3) wws tts (intervalsFromStringG v5 vs) (str2Volume xxs) limV -- | A variant of 'uniqOverSoXSynthNGen4E6GS' where 'Strengths' and 'Durations' are obtained from the same Ukrainian text specified as -- the last 'String' argument. The second 'Double' argument is an average duration of the sounds in seconds. @@ -1141,3 +1414,8 @@ uniqOverSoXSynthNGen4E6GSu file m ku ampL time3 dAmpl wws tts v5 vs xxs limV = uniqOverSoXSynthNGen4E6G file m ku ampL dAmpl (str2Durations xxs time3) wws tts (intervalsFromStringG v5 vs) (str2Volume xxs) limV +-- | Generalized version of the 'uniqOverSoXSynthNGen4E6GSu' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+uniqOverSoXSynthNGen4E6GSuPar :: FilePath -> Params -> Double -> Double -> Double -> String -> String -> Intervals -> String -> String -> Double -> IO ()+uniqOverSoXSynthNGen4E6GSuPar file params ampL time3 dAmpl wws tts v5 vs xxs limV = + uniqOverSoXSynthNGen4E6GPar file params ampL dAmpl (str2Durations xxs time3) wws tts (intervalsFromStringG v5 vs) (str2Volume xxs) limV
DobutokO/Sound/Functional.hs view
@@ -12,8 +12,9 @@ {-# OPTIONS_GHC -threaded #-} module DobutokO.Sound.Functional (+ Params -- * Type synonyms with different semantics- SoundsO+ , SoundsO , OvertonesO , NotePairs , Durations@@ -28,6 +29,8 @@ , overTones -- * Work with enky (extension to octaves functionality) , nkyT+ , whichOctave+ , whichOctaveG , whichEnka , enkuUp , enkuDown @@ -192,6 +195,24 @@ , strengthdB2ampl , strengths2dB , strengthsDb2ampl+ -- * New generalizations for scales and modes with Params+ , filterInParams+ , sortNoDup+ , toneD+ , toneE+ , liftInParams+ , liftInParamsV+ , lengthP+ , elemP+ , elemCloseP+ , showD+ -- ** Application of the Params+ , overSoXSynthGen2FDN_SG4GPar+ , overSoXSynthGen2FDN_SG6GPar+ , overSoXSynthGen2FDN_SG2GPar+ , overSoXSynthGen2FDN_SfPar+ , overSoXSynthGen2FDN_Sf3GPar+ , overSoXSynthGen2FDN_Sf3G2GPar ) where import Text.Read (readMaybe)@@ -210,6 +231,13 @@ import MMSyn7.Syllable import DobutokO.Sound.IntermediateF +-- | Representation of the scales and modes for the notes. Can be extended further, but for a lot of situations the following realization is sufficient. +-- See, for example, 'filterInParams' and so on. 'String' is (are) used as a general classification name, for some of them there are provided two +-- 'String' to classify. Lists are used to specify remainders in some meaning. See also, 'liftInParams' and 'toneE' ('toneD') functions, 'elemP' and +-- 'elemCloseP', 'lengthP' and 'showD'.+data Params = P2 Int Int | P2s Int Int String | P3sf Int Int Int String | P4lsf Int Int Int [Int] String | P32sf Int Int Int String String + | P3lf Int Int [Int] deriving (Eq, Ord, Show)+ -- | Is used to represent a sequence of intervals, each note being a 'Double' value (its frequency in Hz). type SoundsO = V.Vector (Double, Double) @@ -780,6 +808,19 @@ renameFile "result.wav" $ "result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav") vecB endFromResult +-- | Generalized version of the 'overSoXSynthGen2FDN_SG4G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthGen2FDN_SG4GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> Durations -> String -> + ((Double -> OvertonesO) -> (Double, Double) -> Int -> String -> IO ()) -> IO ()+overSoXSynthGen2FDN_SG4GPar file params f y v2 wws h = do+ n <- duration1000 file+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ zeroN = numVZeroesPre vecB in V.imapM_ (\j x -> do+ h f (x, (V.unsafeIndex v2 (j `rem` (V.length v2)))) j wws+ renameFile "result.wav" $ "result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav") vecB+ endFromResult + -- | Auxiliary function to get from a sound file specified a duration parameter @n@ that can be used further. duration1000 :: FilePath -> IO Int duration1000 file = fmap (\t -> truncate (t / 0.001)) . durationA $ file@@ -809,6 +850,22 @@ apply6GSilentFile ("result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav") limV (V.unsafeIndex v6 (j `rem` V.length v6))) vecB endFromResult +-- | Generalized version of the 'overSoXSynthGen2FDN_SG6G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthGen2FDN_SG6GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> Durations -> String -> + ((Double -> OvertonesO) -> (Double, Double) -> Int -> String -> IO ()) -> Strengths -> Double -> IO ()+overSoXSynthGen2FDN_SG6GPar file params f y v2 wws h v6 limV+ | V.null v6 = putStrLn "You did not provide a volume adjustments vector! "+ | otherwise = do+ n <- duration1000 file+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ zeroN = numVZeroesPre vecB in V.imapM_ (\j x -> do+ h f (x, (V.unsafeIndex v2 (j `rem` (V.length v2)))) j wws+ renameFile "result.wav" $ "result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav"+ apply6GSilentFile ("result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav") limV (V.unsafeIndex v6 (j `rem` V.length v6))) vecB+ endFromResult + -- | A variant of the 'overSoXSynthGen2FDN_SG6G' where 'Strengths' are obtained from a Ukrainian text and 'str2Volume'. overSoXSynthGen2FDN_SG6GS :: FilePath -> Int -> Int -> (Double -> OvertonesO) -> Double -> String -> String -> ((Double -> OvertonesO) -> (Double, Double) -> Int -> String -> IO ()) -> String -> Double -> IO ()@@ -844,6 +901,21 @@ if drop 3 ys == "f" then ".flac" else ".wav") vecB endFromResult2G ys +-- | Generalized version of the 'overSoXSynthGen2FDN_SG2G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthGen2FDN_SG2GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> String -> String -> ((Double -> OvertonesO) ->+ (Double, Double) -> Int -> String -> String -> IO ()) -> String -> IO ()+overSoXSynthGen2FDN_SG2GPar file params f y zs wws h ys = do+ n <- duration1000 file+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ zeroN = numVZeroesPre vecB+ v2 = str2DurationsDef n zs y in V.imapM_ (\j x -> do+ h f (x, (V.unsafeIndex v2 (j `rem` (V.length v2)))) j wws ys+ renameFile ("result." ++ if drop 3 ys == "f" then "flac" else "wav") $ "result0" ++ prependZeroes zeroN (show (j + 1)) +++ if drop 3 ys == "f" then ".flac" else ".wav") vecB+ endFromResult2G ys + -- | Similar to 'overSoXSynthGen2FDN', but instead of 'overSoXSynth2FDN' uses 'overSoXSynth2FDN_S' function. overSoXSynthGen2FDN_S :: FilePath -> Int -> Int -> (Double -> OvertonesO) -> Double -> String -> String -> IO () overSoXSynthGen2FDN_S file m ku f y zs wws = overSoXSynthGen2FDN_SG file m ku f y zs wws overSoXSynth2FDN_S@@ -880,7 +952,20 @@ v2 = str2DurationsDef n zs y in V.imapM_ (\j x -> do overSoXSynth2FDN_Sf f (x, (V.unsafeIndex v2 (j `rem` (V.length v2)))) j wws renameFile "result.wav" $ "result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav") vecB- endFromResult + endFromResult + +-- | Generalized version of the 'overSoXSynthGen2FDN_Sf' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthGen2FDN_SfPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> String -> String -> IO ()+overSoXSynthGen2FDN_SfPar file params f y zs wws = do+ n <- duration1000 file+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ zeroN = numVZeroesPre vecB+ v2 = str2DurationsDef n zs y in V.imapM_ (\j x -> do+ overSoXSynth2FDN_Sf f (x, (V.unsafeIndex v2 (j `rem` (V.length v2)))) j wws+ renameFile "result.wav" $ "result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav") vecB+ endFromResult -- | Similar to 'overSoXSynth2FDN_S' but additionally the program filters out from the resulting 'V.Vector' after \"f\" application values that are smaller -- than the third 'Double' parameter by an absolute value in the triple of @Double@'s. An 'Int' parameter is used to define an interval. To obtain compatible@@ -997,6 +1082,20 @@ renameFile "result.wav" $ "result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav") vecB endFromResult +-- | Generalized version of the 'overSoXSynthGen2FDN_Sf3G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthGen2FDN_Sf3GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> Double -> String -> String ->+ ((Double -> OvertonesO) -> (Double, Double, Double) -> Int -> String -> IO ()) -> IO ()+overSoXSynthGen2FDN_Sf3GPar file params f y t0 zs wws h = do+ n <- duration1000 file+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ zeroN = numVZeroesPre vecB+ v2 = str2DurationsDef n zs y in V.imapM_ (\j x -> do+ h f (x, (V.unsafeIndex v2 (j `rem` (V.length v2))), t0) j wws+ renameFile "result.wav" $ "result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav") vecB+ endFromResult + -- | Generalized variant of the 'ovorSoXSynthGen2FDN_Sf3G' with a possibility to specify sound quality with the third 'String' argument. -- Besides, the second from the end argument (a function) needs to be one more argument -- just also 'String'. -- For more information, please, refer to 'soxBasicParams'. Note that 'Int' arguments are used by 'liftInEnku' in that order so it @@ -1014,6 +1113,21 @@ then ".flac" else ".wav") vecB endFromResult2G ys +-- | Generalized version of the 'overSoXSynthGen2FDN_Sf3G2G' where instead of lifting with 'liftInEnkuV' 'liftInParamsV' is used. It allows e. g. to +-- use some tonality. For more information, please, refer to 'filterInParams'.+overSoXSynthGen2FDN_Sf3G2GPar :: FilePath -> Params -> (Double -> OvertonesO) -> Double -> Double -> String -> String ->+ ((Double -> OvertonesO) -> (Double, Double, Double) -> Int -> String -> String -> IO ()) -> String -> IO ()+overSoXSynthGen2FDN_Sf3G2GPar file params f y t0 zs wws h ys = do+ n <- duration1000 file+ vecA <- freqsFromFile file n+ let vecB = liftInParamsV params . V.map fromIntegral $ vecA+ zeroN = numVZeroesPre vecB+ v2 = str2DurationsDef n zs y in V.imapM_ (\j x -> do+ h f (x, (V.unsafeIndex v2 (j `rem` (V.length v2))), t0) j wws ys+ renameFile ("result." ++ if drop 3 ys == "f" then "flac" else "wav") $ "result0" ++ prependZeroes zeroN (show (j + 1)) ++ if drop 3 ys == "f"+ then ".flac" else ".wav") vecB+ endFromResult2G ys + -- | Function to get from the number of semi-tones and a note a 'Maybe' note for the second lower note in the interval if any. If there is -- no need to obtain such a note, then the result is 'Nothing'. dNote :: Int -> Double -> Maybe Double@@ -1723,4 +1837,212 @@ -- | Concatenates a 'V.Vector' of 'OvertonesO' into a single 'OvertonesO'. Can be easily used with 'splitO'. overConcat :: V.Vector OvertonesO -> OvertonesO overConcat = V.concat . V.toList++------------------------------------------------------------------------------------------------------------------++-- | Function can be used to determine to which octave (in the American notation for the notes, this is a number in the note written form,+-- e. g. for C4 this is 4) the frequency belongs (to be more exact, the closest note for the given frequency -- see 'closestNote' taking into account+-- its lower pure quint, which can lay in the lower by 1 octave). If it is not practical to determine the number, then the function returns 'Nothing'.+whichOctave :: Double -> Maybe Int+whichOctave x+ | compare (closestNote x) 24.4996 == GT = (\t ->+ case isJust t of + True -> fmap (\z ->+ case z of+ 0 -> z+ _ -> z - 1) t+ _ -> Just 8) . V.findIndex (\(t1, t2) -> compare (closestNote x) t1 == LT) $ octavesT+ | otherwise = Nothing++-- | Generalized version of the 'whichOctave'.+whichOctaveG :: Double -> Maybe Int+whichOctaveG x + | compare (closestNote x) (V.unsafeIndex notes 0) == GT && compare x (V.unsafeIndex notes 107) /= GT = (\t ->+ case isJust t of + True -> fmap (\z ->+ case z of+ 0 -> z+ _ -> z - 1) t+ _ -> Just 8) . V.findIndex (\(t1, t2) -> compare (closestNote x) t1 == LT) $ octavesT+ | otherwise = Nothing++-- | A way to get from a 'Params' a corresponding 'V.Vector' of 'Double' (if any) and so to work with them further. May contain some issues +-- so please, before production usage check thoroughly. +-- For information there were used the following: +-- +-- https://en.wikipedia.org/wiki/Mode_(music)+-- +-- https://en.wikipedia.org/wiki/Ukrainian_Dorian_scale+-- +-- https://en.wikipedia.org/wiki/List_of_musical_scales_and_modes+-- +-- https://en.wikipedia.org/wiki/Octatonic_scale+-- +-- several other articles in the English Wikipedia +-- +-- and in Ukrainian: +-- Смаглій Г., Маловик Л. Теорія музики : Підруч. для навч. закл. освіти, культури і мистецтв / Г.А. Смаглій. -- Х. : Вид-во \"Ранок\", 2013. -- 392 с. +-- ISBN 978-617-09-1294-7+-- +filterInParams :: Params -> Maybe (V.Vector Double)+filterInParams (P3lf n2 nL zs) -- generalized sound series, e. g. the chromatic ones etc.+ | all (\n -> compare n 0 /= LT) ([nL,107 - nL - n2,n2 - 2] ++ zs) = + if V.null . V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (sortNoDup . filter (< n2) $ zs) $ replicate n2 True) i) $ + (V.unsafeSlice nL n2 notes)+ then Nothing+ else Just (V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (sortNoDup . filter (< n2) $ zs) $ replicate n2 True) i) + (V.unsafeSlice nL n2 notes))+ | otherwise = Nothing+filterInParams (P32sf nT n2 nL xs ys) -- dur and moll in various their modifications+ | all (\n -> compare n 0 /= LT) [107 - nL - n2,nT,nL,nT - nL,nL + n2 - nT,n2 - 12] = + case xs of + "dur" -> getBFst' (Nothing,V.fromList . zip ["DoubleH","H","Full","Full moll","M","N"] $ fmap Just + [V.ifilter (\i _ -> toneD i nL nT [2,3,6,8,10]) (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneD i nL nT [1,3,5,9,10]) + (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> ((nL + i - nT + (((nT - nL) `quot` 12) + 1) * 12) `rem` 12) `notElem` [1,3,5]) + (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> ((nL + i - nT + (((nT - nL) `quot` 12) + 1) * 12) `rem` 12) `notElem` [1,6]) + (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneD i nL nT [1,3,5,9,11]) (V.unsafeSlice nL n2 notes), + V.ifilter (\i _ -> toneD i nL nT [1,3,5,8,10]) (V.unsafeSlice nL n2 notes)]) ys+ "moll" -> getBFst' (Nothing,V.fromList . zip ["DoubleH1","H","Full","Full dur","M","N"] $ fmap Just + [V.ifilter (\i _ -> toneD i nL nT [1,4,5,9,10]) (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneD i nL nT [1,4,6,9,10]) + (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> ((nL + i - nT + (((nT - nL) `quot` 12) + 1) * 12) `rem` 12) `notElem` [1,4,6]) + (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> ((nL + i - nT + (((nT - nL) `quot` 12) + 1) * 12) `rem` 12) `notElem` [1,6]) + (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneD i nL nT [1,4,6,8,10]) (V.unsafeSlice nL n2 notes), + V.ifilter (\i _ -> toneD i nL nT [1,4,6,9,11]) (V.unsafeSlice nL n2 notes)]) ys+ _ -> Nothing+ | otherwise = Nothing+filterInParams (P4lsf nT n2 nL zs xs) + | all (\n -> compare n 0 /= LT) ([107 - nL - n2,nT,nL,nT - nL,nL + n2 - nT,n2 - 2] ++ zs) = + case xs of+ "ditonic" -> + if (V.length . V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (sortNoDup . filter (< n2) $ zs) $ replicate n2 True) + i) $ (V.unsafeSlice nL n2 notes)) /= 2 + then Nothing+ else + if (V.unsafeIndex notes nT) `V.elem` (V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (take 2 . sortNoDup . filter (< n2) $ zs) $ + replicate n2 True) i) (V.unsafeSlice nL n2 notes))+ then Just (V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (take 2 . sortNoDup . filter (< n2) $ zs) $ replicate n2 True) + i) (V.unsafeSlice nL n2 notes))+ else Nothing+ "tritonic" -> + if (V.length . V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (sortNoDup . filter (< n2) $ zs) $ replicate n2 True) + i) $ (V.unsafeSlice nL n2 notes)) /= 3 + then Nothing+ else + if (V.unsafeIndex notes nT) `V.elem` (V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (take 3 . sortNoDup . filter (< n2) $ zs) $ + replicate n2 True) i) (V.unsafeSlice nL n2 notes))+ then Just (V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (take 3 . sortNoDup . filter (< n2) $ zs) $ replicate n2 True) + i) (V.unsafeSlice nL n2 notes))+ else Nothing+ "tetratonic" -> + if (V.length . V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (sortNoDup . filter (< n2) $ zs) $ replicate n2 True) + i) $ (V.unsafeSlice nL n2 notes)) /= 4 + then Nothing+ else + if (V.unsafeIndex notes nT) `V.elem` (V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (take 4 . sortNoDup . filter (< n2) $ zs) $ + replicate n2 True) i) (V.unsafeSlice nL n2 notes))+ then Just (V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (take 4 . sortNoDup . filter (< n2) $ zs) $ replicate n2 True) + i) (V.unsafeSlice nL n2 notes))+ else Nothing+ "octatonic" -> + if (V.length . V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (sortNoDup . filter (< n2) $ zs) $ replicate n2 True) + i) $ (V.unsafeSlice nL n2 notes)) /= 8 + then Nothing+ else + if (V.unsafeIndex notes nT) `V.elem` (V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (take 8 . sortNoDup . filter (< n2) $ zs) $ + replicate n2 True) i) (V.unsafeSlice nL n2 notes))+ then Just (V.ifilter (\i _ -> getBFst' (False,V.fromList . zip (take 8 . sortNoDup . filter (< n2) $ zs) $ replicate n2 True) + i) (V.unsafeSlice nL n2 notes))+ else Nothing+ _ -> Nothing+ | compare nL 0 /= LT && compare nL 107 /= GT && n2 == 1 && xs == "monotonic" = Just (V.singleton (V.unsafeIndex notes nL))+ | otherwise = Nothing+filterInParams (P2 nL n2) + | all (\n -> compare n 0 /= LT) [107 - nL - n2,nL,n2 - 2] = Just (V.unsafeSlice nL n2 notes) + | otherwise = Nothing+filterInParams (P2s nL n2 xs) + | all (\n -> compare n 0 /= LT) [107 - nL - n2,nL,n2 - 12] = + getBFst' (Nothing,V.fromList . zip ["Egyptian pentatonic", "Prometheus hexatonic scale", "Ukrainian Dorian scale", "augmented hexatonic scale", + "blues major pentatonic", "blues minor pentatonic", "blues scale", "major hexatonic scale", "major pentatonic", "minor hexatonic scale", + "minor pentatonic", "tritone hexatonic scale", "two-semitone tritone hexatonic scale", "whole tone scale"] $ map Just + [V.ifilter (\i _ -> toneE i nL nL [0,2,5,7,10]) (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneE i nL nL [0,2,4,6,9,10]) (V.unsafeSlice nL n2 notes), + V.ifilter (\i _ -> toneE i nL nL [0,2,3,6,7,9,10]) (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneE i nL nL [0,3,4,7,8,11]) (V.unsafeSlice nL n2 notes), + V.ifilter (\i _ -> toneE i nL nL [0,2,5,7,9]) (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneE i nL nL [0,3,5,8,10]) (V.unsafeSlice nL n2 notes), + V.ifilter (\i _ -> toneE i nL nL [0,3,5,6,7,10]) (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneE i nL nL [0,3,5,6,7,10]) (V.unsafeSlice nL n2 notes), + V.ifilter (\i _ -> toneE i nL nL [0,2,4,5,7,9]) (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneE i nL nL [0,2,4,7,9]) (V.unsafeSlice nL n2 notes), + V.ifilter (\i _ -> toneE i nL nL [0,2,3,5,7,10]) (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneE i nL nL [0,3,5,7,10]) (V.unsafeSlice nL n2 notes), + V.ifilter (\i _ -> toneE i nL nL [0,1,4,6,7,10]) (V.unsafeSlice nL n2 notes), V.ifilter (\i _ -> toneE i nL nL [0,1,3,7,8,9]) (V.unsafeSlice nL n2 notes), + V.ifilter (\i _ -> toneE i nL nL [0,2,4,6,8,10]) (V.unsafeSlice nL n2 notes)]) xs+ | otherwise = Nothing+filterInParams (P3sf nT nL n2 xs) + | all (\n -> compare n 0 /= LT) [101 - nL,nT,nL,nT - nL,nL + 6 - nT] && n2 == 6 = + case xs of + "Dorian tetrachord" -> + if (nT - nL) `elem` [0,1,3,5] then Just (V.ifilter (\i _ -> toneE i nL nT [0,1,3,5]) (V.unsafeSlice nL 6 notes)) else Nothing+ "Phrygian tetrachord" -> + if (nT - nL) `elem` [0,2,3,5] then Just (V.ifilter (\i _ -> toneE i nL nT [0,2,3,5]) (V.unsafeSlice nL 6 notes)) else Nothing+ "Lydian tetrachord" -> + if (nT - nL) `elem` [0,2,4,5] then Just (V.ifilter (\i _ -> toneE i nL nT [0,2,4,5]) (V.unsafeSlice nL 6 notes)) else Nothing+ _ -> Nothing+ | all (\n -> compare n 0 /= LT) [94 - nL,nT,nL,nT - nL,nL + 13 - nT] && n2 == 13 = + getBFst' (Nothing, V.fromList . zip ["modern Aeolian mode", "modern Dorian mode", "modern Ionian mode", "modern Locrian mode", + "modern Lydian mode", "modern Mixolydian mode", "modern Phrygian mode"] $ fmap (h3 nT n2 nL) [[1,4,6,9,11], [1,4,6,8,11], [1,3,6,8,10], + [2,4,7,9,11], [1,3,5,8,10], [1,3,6,8,11], [2,4,6,9,11]]) xs+ | otherwise = Nothing++h3 :: Int -> Int -> Int -> [Int] -> Maybe (V.Vector Double)+h3 nT n2 nL zs + | nT == nL = Just (V.ifilter (\i _ -> toneD i nL nT zs) (V.unsafeSlice nL n2 notes))+ | otherwise = Nothing++-- | For the list of @a@ from the @Ord@ class it builds a sorted in the ascending order list without duplicates.+-- +-- > sortNoDup [2,1,4,5,6,78,7,7,5,4,3,2,5,4,2,4,54,3,5,65,4,3,54,56,43,5,2] = [1,2,3,4,5,6,7,43,54,56,65,78]+-- +sortNoDup :: Ord a => [a] -> [a]+sortNoDup = sortNoDup' . sort+ where sortNoDup' (x:x1@(y:_)) + | x == y = sortNoDup' x1+ | otherwise = x:sortNoDup' x1+ sortNoDup' (x:_) = [x]+ sortNoDup' _ = []++-- | Checks whether its first 'Int' argument does not belong to those ones that are included into the list argument on the reminders basis. +-- The opposite to 'toneE' with the same arguments.+toneD :: Int -> Int -> Int -> [Int] -> Bool+toneD i nL nT zs = getBFst' (True,V.fromList . zip zs $ replicate 12 False) ((nL + i - nT + (((nT - nL) `quot` 12) + 1) * 12) `rem` 12)++-- | Checks whether its first 'Int' argument does belong to those ones that are included into the list argument on the reminders basis. +-- The opposite to 'toneD' with the same arguments.+toneE :: Int -> Int -> Int -> [Int] -> Bool+toneE i nL nT zs = getBFst' (False,V.fromList . zip zs $ replicate 12 True) ((nL + i - nT + (((nT - nL) `quot` 12) + 1) * 12) `rem` 12)++-- | Analogous to 'liftInEnku' lifts a frequency into a tonality (or something that can be treated alike one) specified by 'Params'. If not +-- reasonably one exists then the result is 11440 (Hz).+liftInParams :: Double -> Params -> Double+liftInParams x params + | lengthP params == 0 || (isNothing . whichOctaveG $ x) = 11440.0 + | otherwise = + V.unsafeIndex (fromJust . filterInParams $ params) (V.minIndex . V.map (abs . log . (\t -> t / x)) . V.generate (lengthP params) $ + (\i -> V.unsafeIndex notes (12 * fromJust (whichOctaveG x)) * 2 ** (fromIntegral i / fromIntegral (lengthP params))))++-- | Application of the 'liftInParams' to a 'V.Vector'. +liftInParamsV :: Params -> V.Vector Double -> V.Vector Double+liftInParamsV params = V.filter (/= 11440.0) . V.map (\x -> liftInParams x params)++-- | Gets a length of the 'V.Vector' of 'Double' being represented as 'Params'. This is a number of the notes contained in the 'Params'.+lengthP :: Params -> Int+lengthP = fromMaybe 0 . fmap V.length . filterInParams++-- | Check whether a given 'Double' value (frequency of a note) is in the vector of Doubles that corresponds to the given 'Params'.+elemP :: Double -> Params -> Bool+elemP note = fromMaybe False . fmap (note `V.elem`) . filterInParams++-- | Check whether a given 'Double' value (frequency of the closest note to the given frequency) is in the vector of Doubles that +-- corresponds to the given 'Params'.+elemCloseP :: Double -> Params -> Bool+elemCloseP note = fromMaybe False . fmap (closestNote note `V.elem`) . filterInParams++-- | A way to show not the (somewhat algebraic) structure of the 'Params' (as the usual 'show' does), but the contained frequencies in it. +showD :: Params -> String+showD = show . filterInParams
README.markdown view
@@ -245,6 +245,11 @@ to generate speech-like music with most of parameters obtained from the Ukrainian language texts. +Since the 0.38.0.0 version the library includes new datatype Params in the +DobutokO.Sound.Functional module and various functions to work with it. It +allows to use tonalities or something close to them. For more information, +please, refer to DobutokO.Sound.Functional and DobutokO.Sound modules.+ ** Note: * Better to execute in the RAM. Need rather a lot of space on the disk for
dobutokO2.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dobutokO2-version: 0.37.1.0+version: 0.38.0.0 synopsis: Helps to create experimental music from a file (or its part) and a Ukrainian text. description: It can also generate a timbre for the notes. Uses SoX inside. homepage: https://hackage.haskell.org/package/dobutokO2