dobutokO2 0.43.0.0 → 0.44.0.0
raw patch · 20 files changed
+162/−144 lines, 20 filesdep +aftovoliodep +end-of-exedep +mmsyn2-arraydep −mmsyn2dep −mmsyn3dep −mmsyn6ukrdep ~basedep ~mmsyn7lPVP ok
version bump matches the API change (PVP)
Dependencies added: aftovolio, end-of-exe, mmsyn2-array, mmsyn7ukr-array, mmsyn7ukr-common
Dependencies removed: mmsyn2, mmsyn3, mmsyn6ukr, mmsyn7s, mmsyn7ukr, uniqueness-periods
Dependency ranges changed: base, mmsyn7l
API changes (from Hackage documentation)
+ DobutokO.Sound.Functional.Params: convertToProperUkrainian :: String -> Vector String
+ DobutokO.Sound.Functional.Params: newRepresentation :: [Int8] -> Vector String
Files
- CHANGELOG.md +4/−0
- DobutokO/Sound/DIS5G6G.hs +11/−11
- DobutokO/Sound/Decibel.hs +2/−2
- DobutokO/Sound/Executable.hs +5/−5
- DobutokO/Sound/Extended.hs +2/−2
- DobutokO/Sound/FunctionF.hs +2/−2
- DobutokO/Sound/Functional.hs +11/−11
- DobutokO/Sound/Functional/Basics.hs +11/−10
- DobutokO/Sound/Functional/Elements.hs +2/−2
- DobutokO/Sound/Functional/Params.hs +52/−44
- DobutokO/Sound/Functional/Split.hs +7/−7
- DobutokO/Sound/IntermediateF.hs +11/−10
- DobutokO/Sound/Keyboard.hs +7/−6
- DobutokO/Sound/Octaves.hs +2/−2
- DobutokO/Sound/Overtones.hs +5/−5
- DobutokO/Sound/ParseList.hs +2/−2
- DobutokO/Sound/Process.hs +9/−8
- DobutokO/Sound/Uniq.hs +7/−6
- Main.hs +2/−2
- dobutokO2.cabal +8/−7
CHANGELOG.md view
@@ -397,3 +397,7 @@ * Fourty-third version. Added a new dependecy uniqueness-periods with more efficient calculations of the uniquenessPeriods function. Changed the dependencies boundaries. +## 0.44.0.0 -- 2024-12-19++* Fourty-fourth version. Added github repository and bug reporting. Updated the dependencies, so that now there is aftovolio included. Some minor code improvements.+
DobutokO/Sound/DIS5G6G.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.DIS5G6G--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.@@ -36,13 +36,13 @@ , apply6GS2 ) where -import CaseBi (getBFst')+import CaseBi.Arr (getBFstLSorted') import Numeric import Data.Maybe (fromJust) import qualified Data.Vector as V import System.Process-import EndOfExe-import Melodics.Ukrainian (convertToProperUkrainian)+import EndOfExe2+import Aftovolio.Ukrainian.Melodics (convertToProperUkrainianI8) import MMSyn7l import DobutokO.Sound.IntermediateF import DobutokO.Sound.Functional.Params@@ -101,27 +101,27 @@ -- | A conversion to the 'Float' that is used inside 'str2Durations'. str2Durat1 :: String -> Float-str2Durat1 = getBFst' ((-0.153016), V.fromList [("-", (-0.101995)), ("0", (-0.051020)), ("1", (-0.153016)), ("а", 0.138231), ("б", 0.057143), +str2Durat1 = getBFstLSorted' (-0.153016) [("-", (-0.101995)), ("0", (-0.051020)), ("1", (-0.153016)), ("а", 0.138231), ("б", 0.057143), ("в", 0.082268), ("г", 0.076825), ("д", 0.072063), ("дж", 0.048934), ("дз", 0.055601), ("е", 0.093605), ("ж", 0.070658), ("з", 0.056054), ("и", 0.099955), ("й", 0.057143), ("к", 0.045351), ("л", 0.064036), ("м", 0.077370), ("н", 0.074240), ("о", 0.116463), ("п", 0.134830), ("р", 0.049206), ("с", 0.074603), ("сь", 0.074558), ("т", 0.110658), ("у", 0.109070), ("ф", 0.062268), ("х", 0.077188), ("ц", 0.053061), - ("ць", 0.089342), ("ч", 0.057596), ("ш", 0.066077), ("ь", 0.020227), ("і", 0.094150), ("ґ", 0.062948)])+ ("ць", 0.089342), ("ч", 0.057596), ("ш", 0.066077), ("ь", 0.020227), ("і", 0.094150), ("ґ", 0.062948)] -- | A full conversion to the 'Strengths' from a Ukrainian text. str2Volume :: String -> Strengths-str2Volume = V.map (getBFst' (0.0, V.fromList [("а", 0.890533), ("б", 0.211334), ("в", (-0.630859)), ("г", (-0.757599)), ("д", 0.884613), ("дж", 0.768127), +str2Volume = V.map (getBFstLSorted' 0.0 [("а", 0.890533), ("б", 0.211334), ("в", (-0.630859)), ("г", (-0.757599)), ("д", 0.884613), ("дж", 0.768127), ("дз", (-0.731262)), ("е", (-0.742523)), ("ж", (-0.588959)), ("з", (-0.528870)), ("и", 0.770935), ("й", (-0.708008)), ("к", (-0.443085)), ("л", 0.572632), ("м", (-0.782349)), ("н", (-0.797607)), ("о", (-0.579559)), ("п", 0.124908), ("р", 0.647369), ("с", 0.155640), ("сь", (-0.207764)), ("т", -0.304443), ("у", 0.718262), ("ф", (-0.374359)), ("х", (-0.251160)), ("ц", (-0.392365)), ("ць", 0.381348), ("ч", (-0.189240)), - ("ш", 0.251221), ("ь", 0.495483), ("і", (-0.682709)), ("ґ", 0.557098)])) . convertToProperUkrainian+ ("ш", 0.251221), ("ь", 0.495483), ("і", (-0.682709)), ("ґ", 0.557098)]) . convertToProperUkrainian -- | A conversion to the 'Float' that is used inside 'str2Volume'. str2Vol1 :: String -> Float-str2Vol1 = getBFst' (0.0, V.fromList [("а", 0.890533), ("б", 0.211334), ("в", (-0.630859)), ("г", (-0.757599)), ("д", 0.884613), ("дж", 0.768127), +str2Vol1 = getBFstLSorted' 0.0 [("а", 0.890533), ("б", 0.211334), ("в", (-0.630859)), ("г", (-0.757599)), ("д", 0.884613), ("дж", 0.768127), ("дз", (-0.731262)), ("е", (-0.742523)), ("ж", (-0.588959)), ("з", (-0.528870)), ("и", 0.770935), ("й", (-0.708008)), ("к", (-0.443085)), ("л", 0.572632), ("м", (-0.782349)), ("н", (-0.797607)), ("о", (-0.579559)), ("п", 0.124908), ("р", 0.647369), ("с", 0.155640), ("сь", (-0.207764)), ("т", -0.304443), ("у", 0.718262), ("ф", (-0.374359)), ("х", (-0.251160)), ("ц", (-0.392365)), ("ць", 0.381348), ("ч", (-0.189240)), - ("ш", 0.251221), ("ь", 0.495483), ("і", (-0.682709)), ("ґ", 0.557098)]) . V.unsafeHead . convertToProperUkrainian+ ("ш", 0.251221), ("ь", 0.495483), ("і", (-0.682709)), ("ґ", 0.557098)] . V.unsafeHead . convertToProperUkrainian -- | For the given non-existing 'FilePath' for a sound file supported by SoX generates a silence of the specified duration and quality (see, -- 'soxBasicParams').
DobutokO/Sound/Decibel.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Decibel--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.
DobutokO/Sound/Executable.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Executable--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.@@ -23,13 +23,13 @@ import Control.Monad (void) import System.Exit (ExitCode (ExitSuccess)) import qualified Data.List as L (groupBy,sort)-import CaseBi (getBFst')+import CaseBi.Arr (getBFstLSorted') import Control.Exception (onException) import System.Environment (getArgs) import Data.List (isPrefixOf) import Data.Maybe (fromJust,fromMaybe) import System.Process-import EndOfExe (showE)+import EndOfExe2 (showE) import qualified Data.Vector as V (Vector,generate,fromList,length,imapM_,snoc,toList,unsafeSlice,mapM_,unsafeIndex) import System.Directory import DobutokO.Sound.Overtones@@ -48,7 +48,7 @@ args = unwords . drop 2 $ arggs argss = drop 1 arggs exist2 <- doesFileExist file- getBFst' (dobutokO2H exist2 args file, V.fromList . fmap (\(xs, f) -> (xs,f exist2 args file)) $ [("0",o2help),("00",dobutokO2H00),+ getBFstLSorted' (dobutokO2H exist2 args file) (fmap (\(xs, f) -> (xs,f exist2 args file)) $ [("0",o2help),("00",dobutokO2H00), ("002",dobutokO2H002),("1",dobutokO2H1),("11",dobutokO2H11),("2",dobutokO2H2),("21",dobutokO2H21),("3",dobutokO2H3),("31",dobutokO2H31), ("4",dobutokO2H4),("41",dobutokO2H41),("5",dobutokO2H5),("51",dobutokO2H51),("61",dobutokO2H61),("7",dobutokO2H7),("8",dobutokO2H8), ("80",dobutokO2H80),("82",dobutokO2H82),("820",dobutokO2H820),("9",dobutokO2H9),("92",dobutokO2H92),("99",dobutokO2H99 argss),
DobutokO/Sound/Extended.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Extended--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.
DobutokO/Sound/FunctionF.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.FunctionF--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.
DobutokO/Sound/Functional.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Functional--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.@@ -75,9 +75,9 @@ import Data.Maybe (isNothing,fromJust,fromMaybe,maybe) import qualified Data.Vector as V import System.Process-import EndOfExe+import EndOfExe2 import System.Directory-import Melodics.Ukrainian (convertToProperUkrainian)+import Aftovolio.Ukrainian.Melodics (convertToProperUkrainianI8) import DobutokO.Sound.IntermediateF import DobutokO.Sound.Functional.Basics import DobutokO.Sound.Functional.Params@@ -105,7 +105,7 @@ -- (please, see 'soxBasicParams'). Since version 0.36.0.0 the function supports generation of the pauses. overSoXSynth2FDN2G :: (Float -> OvertonesO) -> (Float, Float) -> Int -> String -> V.Vector Float -> String -> IO () overSoXSynth2FDN2G f (x, y) j zs vdB ys- | V.null . convertToProperUkrainian $ zs = overSoXSynth x+ | null . convertToProperUkrainianI8 $ zs = overSoXSynth x | otherwise = do let note0 = closestNote (if x /= 0.0 then abs x else V.unsafeIndex notes 0) l0 = length zs@@ -203,7 +203,7 @@ -- | A variant of the 'overSoXSynth2FDN6G' where volume adjustment is obtained from a Ukrainian text. overSoXSynth2FDN6GS :: (Float -> OvertonesO) -> (Float, Float) -> Int -> Intervals -> String -> V.Vector Float -> String -> String -> IO () overSoXSynth2FDN6GS f (x, y) j v5 xs vdB ys xxs - | V.null . convertToProperUkrainian $ xxs = putStrLn "You provided no information to obtain volume adjustment! "+ | null . convertToProperUkrainianI8 $ xxs = putStrLn "You provided no information to obtain volume adjustment! " | otherwise = overSoXSynth2FDN6G f (x, y) j (intervalsFromStringG v5 xs) vdB ys (str2Vol1 xxs) -- | Uses additional 'Int' parameters. The first one is a number of enka (see 'nkyT'). The second one defines, to which n-th elements set@@ -243,7 +243,7 @@ -- argument. For more information, please, refer to 'soxBasicParams'. overSoXSynth2FDN_B2G :: (Float -> OvertonesO) -> (Float, Float, Float) -> Int -> String -> V.Vector Float -> String -> IO () overSoXSynth2FDN_B2G f (x, y, limB) j zs vdB ys- | V.null . convertToProperUkrainian $ zs = overSoXSynth x+ | null . convertToProperUkrainianI8 $ zs = overSoXSynth x | otherwise = do let limA0 = abs ((limB / 10) - (fromIntegral . truncate $ (limB / 10))) * 10 limA = if compare limA0 0.1 == LT then 0.1 else limA0@@ -353,7 +353,7 @@ -- | A variant of the 'overSoXSynth2FDN_B6G' where volume adjustment is obtained from a Ukrainian text. overSoXSynth2FDN_B6GS :: (Float -> OvertonesO) -> (Float, Float, Float) -> Int -> Intervals -> String -> V.Vector Float -> String -> String -> IO () overSoXSynth2FDN_B6GS f (x, y, limB) j v5 xs vdB ys xxs- | V.null . convertToProperUkrainian $ xxs = putStrLn "You provided no information to obtain volume adjustment! "+ | null . convertToProperUkrainianI8 $ xxs = putStrLn "You provided no information to obtain volume adjustment! " | otherwise = overSoXSynth2FDN_B6G f (x, y, limB) j (intervalsFromStringG v5 xs) vdB ys (str2Vol1 xxs) -- | Uses additional 'Int' parameters. The first one is a number of enka (see 'nkyT'). The second one defines, to which n-th elements set@@ -384,7 +384,7 @@ -- For more information, please, refer to 'soxBasicParams'. overSoXSynth2FDN_S2G :: (Float -> OvertonesO) -> (Float, Float) -> Int -> String -> V.Vector Float -> String -> IO () overSoXSynth2FDN_S2G f (x, y) j zs vdB ys- | V.null . convertToProperUkrainian $ zs = overSoXSynth x+ | null . convertToProperUkrainianI8 $ zs = overSoXSynth x | otherwise = do let note0 = closestNote (if x /= 0.0 then abs x else V.unsafeIndex notes 0) l0 = length zs@@ -449,7 +449,7 @@ -- | A variant of the 'overSoXSynth2FDN_S6G' where volume adjustment is obtained from a Ukrainian text. overSoXSynth2FDN_S6GS :: (Float -> OvertonesO) -> (Float, Float) -> Int -> Intervals -> String -> V.Vector Float -> String -> String -> IO () overSoXSynth2FDN_S6GS f (x, y) j v5 xs vdB ys xxs- | V.null . convertToProperUkrainian $ xxs = putStrLn "You provided no information to obtain volume adjustment! "+ | null . convertToProperUkrainianI8 $ xxs = putStrLn "You provided no information to obtain volume adjustment! " | otherwise = overSoXSynth2FDN_S6G f (x, y) j (intervalsFromStringG v5 xs) vdB ys (str2Vol1 xxs) -- | Similar to 'overSoXSynthGen2FDN', but instead of 'overSoXSynth2FDN' uses 'overSoXSynth2FDN_S' function. Note that the first 'Int' arguments are used by 'liftInEnku' in that order so it @@ -589,7 +589,7 @@ -- | A variant of the 'overSoXSynth2FDN_Sf36G' where volume adjustment is obtained from a Ukrainian text. overSoXSynth2FDN_Sf36GS :: (Float -> OvertonesO) -> (Float, Float, Float) -> Int -> Intervals -> String -> V.Vector Float -> String -> String -> IO () overSoXSynth2FDN_Sf36GS f (x, y, t0) j v5 xs vdB ys xxs- | V.null . convertToProperUkrainian $ xxs = putStrLn "You provided no information to obtain volume adjustment! "+ | null . convertToProperUkrainian $ xxs = putStrLn "You provided no information to obtain volume adjustment! " | otherwise = overSoXSynth2FDN_Sf36G f (x, y, t0) j (intervalsFromStringG v5 xs) vdB ys (str2Vol1 xxs) -- | Can generate multiple notes with their respective overtones that are played simultaneously (e. g. it can be just one note with overtones,
DobutokO/Sound/Functional/Basics.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Functional.Basics--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside. Is more complicated than@@ -59,16 +59,17 @@ , adjust_dbVol ) where -import CaseBi (getBFst')+import GHC.Arr+import CaseBi.Arr (getBFst') import Data.Char (isDigit) import System.Exit (ExitCode( ExitSuccess )) import Numeric import Data.List (isPrefixOf,sort) import Data.Maybe (fromJust,isJust,fromMaybe) import qualified Data.Vector as V-import SoXBasics (durationA)+import Sound.SoXBasics (durationA) import System.Process-import EndOfExe+import EndOfExe2 import System.Directory import DobutokO.Sound.IntermediateF @@ -263,7 +264,7 @@ liftInEnku :: Int -> Int -> Float -> Maybe Float liftInEnku n ku x | compare n 0 == LT || compare n ((108 `quot` ku) - 1) == GT = Nothing- | getBFst' (False, V.fromList . zip [2,3,4,6,9,12] $ repeat True) ku && compare (closestNote x) 24.4996 == GT =+ | getBFst' (False, listArray (0,5) . zip [2,3,4,6,9,12] $ repeat True) ku && compare (closestNote x) 24.4996 == GT = case compare (fromJust . whichEnka ku $ x) n of EQ -> Just (closestNote x) LT -> let z = logBase 2.0 (V.unsafeIndex notes (n * ku) / closestNote x)@@ -282,7 +283,7 @@ -- An 'Int' parameter defines that @n@. whichEnka :: Int -> Float -> Maybe Int whichEnka n x- | getBFst' (False,V.fromList . zip [2,3,4,6,9,12] $ repeat True) n && compare (closestNote x) 24.4996 == GT = (\t ->+ | getBFst' (False,listArray (0,5) . zip [2,3,4,6,9,12] $ repeat True) n && compare (closestNote x) 24.4996 == GT = (\t -> case isJust t of True -> fmap (\z -> case z of@@ -294,14 +295,14 @@ -- | Returns an analogous note in the higher n-th elements set (its frequency in Hz) (see 'nkyT'). An 'Int' parameter defines this @n@. enkuUp :: Int -> Float -> Float enkuUp n x- | getBFst' (False, V.fromList . zip [2..11] $ repeat True) n = 2 ** (fromIntegral n / 12) * x+ | getBFst' (False, listArray (0,9) . zip [2..11] $ repeat True) n = 2 ** (fromIntegral n / 12) * x | otherwise = 2 * x {-# INLINE enkuUp #-} -- | Returns an analogous note in the lower n-th elements set (its frequency in Hz) (see 'nkyT'). An 'Int' parameter defines this @n@. enkuDown :: Int -> Float -> Float enkuDown n x- | getBFst' (False, V.fromList . zip [2..11] $ repeat True) n = 2 ** (fromIntegral (-n) / 12) * x+ | getBFst' (False, listArray (0,9) . zip [2..11] $ repeat True) n = 2 ** (fromIntegral (-n) / 12) * x | otherwise = x / 2 {-# INLINE enkuDown #-} @@ -311,7 +312,7 @@ -- their respective lowest and highest frequencies. nkyT :: Int -> NotePairs nkyT n- | getBFst' (False,V.fromList . zip [2,3,4,6,9,12] $ repeat True) n = V.generate (108 `quot` n) (\i -> (V.unsafeIndex notes (i * n),+ | getBFst' (False,listArray (0,5) . zip [2,3,4,6,9,12] $ repeat True) n = V.generate (108 `quot` n) (\i -> (V.unsafeIndex notes (i * n), V.unsafeIndex notes (i * n + (n - 1)))) | otherwise = octavesT
DobutokO/Sound/Functional/Elements.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Functional.Elements--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.
DobutokO/Sound/Functional/Params.hs view
@@ -1,15 +1,15 @@ -- | -- Module : DobutokO.Sound.Functional.Params--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside. Is more complicated than -- dobutokO2 and uses its functionality. -{-# LANGUAGE BangPatterns, LambdaCase #-}+{-# LANGUAGE BangPatterns, MultiWayIf #-} {-# OPTIONS_GHC -threaded #-} module DobutokO.Sound.Functional.Params (@@ -56,24 +56,36 @@ , soundGenF32G , helpF0 , helpF1+ , convertToProperUkrainian+ , newRepresentation , doubleVecFromVecOfFloat ) where -import CaseBi (getBFst')+import CaseBi.Arr +import GHC.Arr import Numeric import Data.List (sort) import Data.Maybe (isNothing,fromJust,isJust,fromMaybe) import qualified Data.Vector as V import System.Process-import EndOfExe+import EndOfExe2 import System.Directory-import Melodics.Ukrainian (convertToProperUkrainian)-import SoXBasics (upperBnd,selMaxAbs)+import Aftovolio.Ukrainian.Melodics (convertToProperUkrainianI8)+import Sound.SoXBasics (upperBnd,selMaxAbs) import MMSyn7l-import MMSyn7.Syllable +import GHC.Int (Int8)+import Aftovolio.Ukrainian.Syllable import DobutokO.Sound.IntermediateF import DobutokO.Sound.Functional.Basics +convertToProperUkrainian :: String -> V.Vector String+convertToProperUkrainian = newRepresentation . convertToProperUkrainianI8+{-# INLINE convertToProperUkrainian #-}++newRepresentation :: [Int8] -> V.Vector String+newRepresentation = V.fromList . map f+ where f = getBFstLSorted' "" [(1,"\1072"),(2,"\1077"),(3,"\1086"),(4,"\1091"),(5,"\1080"),(6,"\1110"),(7,"\1100"),(8,"\1076\1079"),(10,"\1078"),(15,"\1073"),(17,"\1076"),(19,"\1075"),(21,"\1169"),(23,"\1076\1078"),(25,"\1079"),(27,"\1081"),(28,"\1083"),(30,"\1084"),(32,"\1085"),(34,"\1088"),(36,"\1074"),(38,"\1094"),(39,"\1095"),(41,"\1096"),(43,"\1092"),(45,"\1082"),(47,"\1087"),(49,"\1089"),(50,"\1090"),(52,"\1093"),(54,"\1089\1100"),(66,"\1094\1100"),(100,"0"),(101,"1")]+ -- | 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 @@ -96,15 +108,12 @@ -- and sonorous consonants gives \"-\" sign (-1). Voiceless2 gives "0". Other symbols are not taken into account. signsFromString :: Int -> String -> V.Vector Int signsFromString n1 =- V.take n1 . V.fromList . concatMap (fmap (\case- Vowel _ -> 1- Voiced _ -> 1- VoicedP _ -> 1- Voiceless _ -> (-1)- VoicelessP _ -> (-1)- Sonorous _ -> (-1)- SonorousP _ -> (-1)- _ -> 0) . concatMap representProlonged) . syllablesUkrP . take (3 * n1) . cycle + V.take n1 . V.fromList . concatMap (fmap (\x -> if + | isVowel1 x -> 1+ | isVoicedC1 x -> 1+ | isVoicelessC1 x -> (-1)+ | isSonorous1 x -> (-1)+ | otherwise -> 0) . concatMap representProlonged) . createSyllablesUkrS . take (3 * n1) . cycle -- | 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'.@@ -213,22 +222,22 @@ filterInParams :: Params -> Maybe (V.Vector Float) 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) $ + if V.null . V.ifilter (\i _ -> getBFstLSorted' False (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) + else Just (V.ifilter (\i _ -> getBFstLSorted' False (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 ["FloatH","H","Full","Full moll","M","N"] $ fmap Just + "dur" -> getBFst' (Nothing,listArray (0,5) . zip ["FloatH","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 ["FloatH1","H","Full","Full dur","M","N"] $ fmap Just + "moll" -> getBFst' (Nothing,listArray (0,5) . zip ["FloatH1","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]) @@ -240,43 +249,43 @@ | 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) + if (V.length . V.ifilter (\i _ -> getBFstLSorted' False (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) $ + if (V.unsafeIndex notes nT) `V.elem` (V.ifilter (\i _ -> getBFstLSorted' False (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) + then Just (V.ifilter (\i _ -> getBFstLSorted' False (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) + if (V.length . V.ifilter (\i _ -> getBFstLSorted' False (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) $ + if (V.unsafeIndex notes nT) `V.elem` (V.ifilter (\i _ -> getBFstLSorted' False (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) + then Just (V.ifilter (\i _ -> getBFstLSorted' False (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) + if (V.length . V.ifilter (\i _ -> getBFstLSorted' False (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) $ + if (V.unsafeIndex notes nT) `V.elem` (V.ifilter (\i _ -> getBFstLSorted' False (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) + then Just (V.ifilter (\i _ -> getBFstLSorted' False (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) + if (V.length . V.ifilter (\i _ -> getBFstLSorted' False (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) $ + if (V.unsafeIndex notes nT) `V.elem` (V.ifilter (\i _ -> getBFstLSorted' False (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) + then Just (V.ifilter (\i _ -> getBFstLSorted' False (zip (take 8 . sortNoDup . filter (< n2) $ zs) $ replicate n2 True) i) (V.unsafeSlice nL n2 notes)) else Nothing _ -> Nothing@@ -287,7 +296,7 @@ | 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", + getBFstLSorted' Nothing (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), @@ -310,7 +319,7 @@ 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", + getBFstLSorted' Nothing (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@@ -335,12 +344,12 @@ -- | 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)+toneD i nL nT zs = ((nL + i - nT + (((nT - nL) `quot` 12) + 1) * 12) `rem` 12) `notElem` zs -- | 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)+toneE i nL nT zs = ((nL + i - nT + (((nT - nL) `quot` 12) + 1) * 12) `rem` 12) `elem` zs -- | 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).@@ -441,8 +450,8 @@ -- | Function is used to generate a rhythm of the resulting file \'end.wav\' from the Ukrainian text and a number of sounds either in the syllables or in the words without vowels. syllableStr :: Int -> String -> [Int] syllableStr n xs =- let ps = take n . cycle . concat . sylLengthsP2 . syllablesUkrP $ xs- y = sum ps in+ let ps = map fromIntegral . take n . cycle . concat . concat . createSyllablesUkrS $ xs+ y = sum . map fromIntegral $ ps in case y of 0 -> [0] _ -> y:ps @@ -473,7 +482,7 @@ -- For more information, please, refer to 'soxBasicParams'. overSoXSynth2FDN_Sf32G :: (Float -> OvertonesO) -> (Float, Float, Float) -> Int -> String -> V.Vector Float -> String -> IO () overSoXSynth2FDN_Sf32G f (x, y, t0) j zs vdB ys- | V.null . convertToProperUkrainian $ zs = overSoXSynth x+ | null . convertToProperUkrainianI8 $ zs = overSoXSynth x | otherwise = do let l0 = length zs soundGenF32G (V.fromList [\x2 -> closestNote (if x2 /= 0.0 then abs x2 else V.unsafeIndex notes 0),\x2 -> fromMaybe (V.unsafeIndex notes 0)@@ -483,7 +492,7 @@ -- | Function is used to get numbers of intervals from a Ukrainian 'String'. It is used internally in the 'uniqOverSoXSynthN4' function. intervalsFromString :: String -> Intervals-intervalsFromString = vStrToVIntG defInt . convertToProperUkrainian+intervalsFromString = vStrToVIntG defInt . newRepresentation . convertToProperUkrainianI8 -- | Generatlized version of the 'vStrToVInt' with a possibility to specify your own 'Intervals'. vStrToVIntG :: Intervals -> V.Vector String -> Intervals@@ -497,8 +506,7 @@ -- | Generatlized version of the 'strToInt' with a possibility to specify your own 'Intervals'. strToIntG :: Intervals -> String -> Int strToIntG v =- getBFst' (0, V.zip (V.fromList ["а","б","в","г","д","дж","дз","е","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш",- "і","ґ"]) v)+ getBFst' (0, listArray (0,28) . zip (["а","б","в","г","д","дж","дз","е","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","і","ґ"]) . V.toList $ v) {-# INLINE strToIntG #-} -- | Generalized variant of the 'soundGenF31G' with a possibility to specify sound quality using the 'String' argument. For more information,@@ -518,7 +526,7 @@ helpF0 :: Int -> String helpF0 =- getBFst' ("ZZ0",V.fromList . zip [0..] $ (map (:[]) "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ++ concatMap (\z -> map ((z:) . (:[])) "ABCDEFGHIJKLMNOPQRSTUVWXYZ")+ getBFstLSorted' "ZZ0" (zip [0..] $ (map (:[]) "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ++ concatMap (\z -> map ((z:) . (:[])) "ABCDEFGHIJKLMNOPQRSTUVWXYZ") "ABCDEFGHIJKLMNOPQRSTUVWXYZ")) helpF1 :: V.Vector (Float -> Float) -> V.Vector Float -> V.Vector Int -> V.Vector (Maybe Float)
DobutokO/Sound/Functional/Split.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Functional.Split--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.@@ -26,7 +26,7 @@ , splitOG22S ) where -import CaseBi (getBFst')+import CaseBi.Arr (getBFstLSorted') import Data.Char (isAsciiLower) import Data.List (sortBy) import qualified Data.Vector as V@@ -128,7 +128,7 @@ | compare (V.length v0) (n + 1) == GT && not (V.null vf) = let c1s = filter isAsciiLower $ xs v1 = V.fromList . sortBy (\(x1,_) (x2,_) -> compare (abs x2) (abs x1)) . V.toList $ v0- (x0, y0) = V.unsafeIndex v1 0 in let (k1,k2,k3,k4) = getBFst' ((x1,x2,x3,x4),V.map (\(ys,g) -> (ys,g n v1)) vf) c1s in + (x0, y0) = V.unsafeIndex v1 0 in let (k1,k2,k3,k4) = getBFstLSorted' (x1,x2,x3,x4) (V.toList . V.map (\(ys,g) -> (ys,g n v1)) $ vf) c1s in splitHelp1 k1 k2 k3 k4 v1 (x0,y0) | otherwise = V.singleton v0 @@ -140,7 +140,7 @@ let c1s = filter isAsciiLower $ xs v1 = V.fromList . sortBy (\(x1,_) (x2,_) -> compare (abs x2) (abs x1)) . V.toList $ v0 v2 = V.fromList . sortBy (\(x1s,_) (x2s,_) -> compare x1s x2s) . V.toList $ vf- (x0, y0) = V.unsafeIndex v1 0 in let (k1,k2,k3,k4) = getBFst' ((x1,x2,x3,x4),V.map (\(ys,g) -> (ys,g n v1)) v2) c1s in + (x0, y0) = V.unsafeIndex v1 0 in let (k1,k2,k3,k4) = getBFstLSorted' (x1,x2,x3,x4) (V.toList . V.map (\(ys,g) -> (ys,g n v1)) $ v2) c1s in splitHelp1 k1 k2 k3 k4 v1 (x0,y0) | otherwise = V.singleton v0 @@ -153,7 +153,7 @@ | compare (V.length v0) (n + 1) == GT && not (V.null vf) = let c1s = filter isAsciiLower $ xs v1 = V.fromList . sortBy (\(x1,_) (x2,_) -> compare (abs x2) (abs x1)) . V.toList $ v0- (x0, y0) = V.unsafeIndex v1 0 in let (k1,k2,k3,k4) = getBFst' ((x1,x2,x3,x4),V.map (\(ys,g) -> (ys,g n v1)) vf) c1s in + (x0, y0) = V.unsafeIndex v1 0 in let (k1,k2,k3,k4) = getBFstLSorted' (x1,x2,x3,x4) (V.toList . V.map (\(ys,g) -> (ys,g n v1)) $ vf) c1s in splitHelp2 h k1 k2 k3 k4 v1 (x0,y0) | otherwise = V.singleton v0 @@ -166,7 +166,7 @@ let c1s = filter isAsciiLower $ xs v1 = V.fromList . sortBy (\(x1,_) (x2,_) -> compare (abs x2) (abs x1)) . V.toList $ v0 v2 = V.fromList . sortBy (\(x1s,_) (x2s,_) -> compare x1s x2s) . V.toList $ vf- (x0, y0) = V.unsafeIndex v1 0 in let (k1,k2,k3,k4) = getBFst' ((x1,x2,x3,x4),V.map (\(ys,g) -> (ys,g n v1)) v2) c1s in + (x0, y0) = V.unsafeIndex v1 0 in let (k1,k2,k3,k4) = getBFstLSorted' (x1,x2,x3,x4) (V.toList . V.map (\(ys,g) -> (ys,g n v1)) $ v2) c1s in splitHelp2 h k1 k2 k3 k4 v1 (x0,y0) | otherwise = V.singleton v0
DobutokO/Sound/IntermediateF.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.IntermediateF--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Måintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.@@ -106,19 +106,20 @@ , soxREA1 ) where +import GHC.Arr import Numeric (showFFloat)-import CaseBi (getBFst')+import CaseBi.Arr (getBFst') import Control.Monad (void) import Control.Concurrent (myThreadId,forkIO,threadDelay,killThread) import qualified Data.List as L (sort) import Control.Exception (onException)-import Control.Exception.FinalException (FinalException (NotRecorded,ExecutableNotProperlyInstalled),catchEnd)+import Sound.Control.Exception.FinalException (FinalException (NotRecorded,ExecutableNotProperlyInstalled),catchEnd) import Data.List (isPrefixOf,isSuffixOf,(\\),maximum,minimum) import qualified Data.Vector as V import System.Directory-import SoXBasics (playA,durationA)+import Sound.SoXBasics (playA, durationA) import MMSyn7l-import EndOfExe (showE)+import EndOfExe2 (showE) import System.Process (readProcessWithExitCode) import Data.Maybe (fromJust,isJust) import System.Exit (ExitCode (ExitSuccess))@@ -530,7 +531,7 @@ soxBasicParams ys xss | null xss = [] | otherwise =- let (ts,zs) = splitAt 2 . init $ ys in (getBFst' ("-r22050",V.fromList . zip ["11","16", "17", "19", "32", "44", "48", "80", "96"] $+ let (ts,zs) = splitAt 2 . init $ ys in (getBFst' ("-r22050",listArray (0,8) . zip ["11","16", "17", "19", "32", "44", "48", "80", "96"] $ ["-r11025","-r16000","-r176400","-r192000","-r32000","-r44100","-r48000","-r8000","-r96000"]) ts) : (if zs == "2" then "-b24" else "-b16") : ((if drop 3 ys == "f" then map (\xs -> if drop (length xs - 4) xs == ".wav" then take (length xs - 4) xs ++ ".flac" else xs) else id) . tail $ xss) @@ -572,7 +573,7 @@ -- sent to SoX rec or something equivalent as its arguments after the filename. If you plan just afterwards to produce mono audio, it's simpler to use -- 'rec1E' function instead. Please, check by yourself whether you have enough permissions to read and write to the 'FilePath'-specified -- file and to the containing it directory. The function is not intended to be used in otherwise cases.--- Function is adopted and changed 'SoXBasics.recA' function.+-- Function is adopted and changed 'Sound.SoXBasics.recA' function. recE :: FilePath -> [String] -> IO () recE file arggs | isJust (showE "sox") && take 5 os == "mingw" = do (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) (["-t","waveaudio","-d", file] ++ arggs)""@@ -609,7 +610,7 @@ -- | Function takes a 'FilePath' for the new recorded file (if it already exists then it is overwritten) and a list of 'String'. The last one is -- sent to SoX rec or something equivalent as its arguments after the filename. Please, check by yourself whether you have enough permissions -- to read and write to the 'FilePath'-specified file and to the containing it directory. The function is not intended to be used in otherwise cases.--- Function is adopted and changed 'SoXBasics.recA' function.+-- Function is adopted and changed 'Sound.SoXBasics.recA' function. rec1E :: FilePath -> [String] -> IO () rec1E file arggs | isJust (showE "sox") && take 5 os == "mingw" = do (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) (["-t","waveaudio","-d", file] ++ arggs ++ ["channels","1"])""@@ -647,7 +648,7 @@ -- some SoX effects and only then to use 'soxE' or some similar functions to actually apply them. -- Please, check by yourself whether you have enough permissions to read the 'FilePath'-specified -- file and the containing it directory. The function is not intended to be used in otherwise cases.--- Function is adopted and changed 'SoXBasics.playA' function.+-- Function is adopted and changed 'Sound.SoXBasics.playA' function. playE :: FilePath -> [String] -> IO () playE file arggs | take 5 os == "mingw" = if isJust (showE "sox")
DobutokO/Sound/Keyboard.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Keyboard--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.@@ -35,7 +35,8 @@ , convH ) where -import CaseBi (getBFst')+import GHC.Arr+import CaseBi.Arr (getBFst') import Data.Char (isAsciiLower) import qualified Data.Vector as V import GHC.Int (Int64)@@ -47,15 +48,15 @@ -- | Converts a string of lowercase ASCII letters being typed on the QWERTY keyboard layout into corresponding Dvorak keyboard layout. qwerty2dvorak :: BL.ByteString -> BL.ByteString-qwerty2dvorak = BL.map (getBFst' (' ',V.fromList . zip ("/;<>" ++ ['a'..'z']) $ "wvszaxje.uidchtnmbrl'poygk,qf;"))+qwerty2dvorak = BL.map (getBFst' (' ',listArray (0,29) . zip ("/;<>" ++ ['a'..'z']) $ "wvszaxje.uidchtnmbrl'poygk,qf;")) -- | Vice versa to 'qwerty2dvorak'. dvorak2qwerty :: BL.ByteString -> BL.ByteString-dvorak2qwerty = BL.map (getBFst' (' ',V.fromList . zip ("',.;" ++ ['a'..'z']) $ "qwezanihdyujgcvpmlsrxo;kf.,bt/"))+dvorak2qwerty = BL.map (getBFst' (' ',listArray (0,29) . zip ("',.;" ++ ['a'..'z']) $ "qwezanihdyujgcvpmlsrxo;kf.,bt/")) -- | Hashes two lower case ascii characters. Is used for controlling frequencies and operators. hashStr2 :: Char -> Char -> Int-hashStr2 x y = getBFst' (57, V.fromList . zip ['a'..'z'] . map (\t -> getBFst' (26 * t + 18, V.fromList . zip ['a'..'z'] $ [(26 * t + 4)..]) y) . +hashStr2 x y = getBFst' (57, listArray (0,25) . zip ['a'..'z'] . map (\t -> getBFst' (26 * t + 18, listArray (0,25) . zip ['a'..'z'] $ [(26 * t + 4)..]) y) . concat $ [[0],[6..8],[1],[9..11],[4],[12..16],[2],[17..21],[3],[22..24],[5,25]]) x -- 679 is the greatest value ~ \"zz\"; there are 572 effectful val. -- | Get contents into lazy 'BL.ByteString' with filtering of all characters that are not a lower case ascii letters.
DobutokO/Sound/Octaves.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Octaves--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.
DobutokO/Sound/Overtones.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Overtones--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.@@ -79,9 +79,9 @@ import Data.Maybe (isNothing,fromJust,maybe) import qualified Data.Vector as V import System.Process-import EndOfExe (showE)+import EndOfExe2 (showE) import System.Directory-import Melodics.Ukrainian (convertToProperUkrainian)+import Aftovolio.Ukrainian.Melodics (convertToProperUkrainianI8) import DobutokO.Sound.Functional.Basics import DobutokO.Sound.Functional.Params import DobutokO.Sound.DIS5G6G@@ -104,7 +104,7 @@ -- it is equal to 0.5. overSoXSynth2DN :: Float -> Float -> String -> IO () overSoXSynth2DN x y zs- | V.null . convertToProperUkrainian $ zs = overSoXSynth x+ | null . convertToProperUkrainianI8 $ zs = overSoXSynth x | otherwise = do let note0 = closestNote x note1 = dNote (V.unsafeIndex (intervalsFromString zs) 0) note0
DobutokO/Sound/ParseList.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.ParseList--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.
DobutokO/Sound/Process.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Process--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.@@ -24,24 +24,25 @@ ) where import Data.List (isPrefixOf)-import CaseBi (getBFst')+import CaseBi.Arr (getBFstLSorted') import Numeric (showFFloat) import Control.Exception (onException) import Data.Maybe (fromJust) import Data.Char (isDigit,isSpace) import System.Process-import EndOfExe (showE)+import EndOfExe2 (showE) import qualified Data.Vector as V (fromList) import System.Directory-import SoXBasics-import Processing_mmsyn7ukr+import Sound.SoXBasics+import SoXBasics.Arr (recA)+import Processing_mmsyn7ukr_array -- | Function records and processes the sound data needed to generate the \"end.wav\" file in the 'dobutokO2' function. Please, check before executing -- whether there is no \"x.wav\" file in the current directory, because it can be overwritten. recAndProcess :: FilePath -> Int -> IO String recAndProcess file =- getBFst' (processD, V.fromList [(0,processD0 file),(1,processD1),(2,processD2 file),(3,processD3),(4,processD4),(5,processD5),(7,processD7),- (8,processD8),(9,processD9),(11,processD_1),(99,processD99),(999,processD99)])+ getBFstLSorted' processD [(0,processD0 file),(1,processD1),(2,processD2 file),(3,processD3),(4,processD4),(5,processD5),(7,processD7),+ (8,processD8),(9,processD9),(11,processD_1),(99,processD99),(999,processD99)] processD_1 :: IO String processD_1 = onException (do
DobutokO/Sound/Uniq.hs view
@@ -1,9 +1,9 @@ -- | -- Module : DobutokO.Sound.Uniq--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- Helps to create experimental music from a file (or its part) and a Ukrainian text. -- It can also generate a timbre for the notes. Uses SoX inside.@@ -79,8 +79,9 @@ import Data.Maybe (isNothing,fromJust) import qualified Data.Vector as V import System.Process-import EndOfExe (showE)-import String.Ukrainian.UniquenessPeriods+import EndOfExe2 (showE)+import Aftovolio.UniquenessPeriodsG+import Aftovolio.Ukrainian.Melodics import DobutokO.Sound.Functional.Basics import DobutokO.Sound.Functional.Params import DobutokO.Sound.DIS5G6G@@ -89,7 +90,7 @@ -- 'String' structure of the uniqueness (see the documentation for @mmsyn7s@ and @uniqueness-periods@ packages) it produces the unique timbre. uniqOvertonesV :: Float -> String -> OvertonesO uniqOvertonesV note xs =- let ys = uniquenessPeriods xs+ let ys = uniquenessPeriodsGI8 [100,101,102] . convertToProperUkrainianI8 $ xs z = sum ys v = V.fromList . fmap (\y -> fromIntegral y / fromIntegral z) $ ys z2 = V.length v@@ -102,7 +103,7 @@ -- The second 'String' is used to produce the signs for harmonics coefficients. uniqOvertonesV2 :: Float -> String -> String -> OvertonesO uniqOvertonesV2 note xs ts = - let ys = uniquenessPeriods xs+ let ys = uniquenessPeriodsGI8 [100,101,102] . convertToProperUkrainianI8 $ xs z = sum ys v = V.fromList . fmap (\y -> fromIntegral y / fromIntegral z) $ ys z2 = V.length v
Main.hs view
@@ -1,9 +1,9 @@ -- | -- Module : Main--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020, 2024 -- License : MIT -- Stability : Experimental--- Maintainer : olexandr543@yahoo.com+-- Maintainer : oleksandr.zhabenko@yahoo.com -- -- A program and a library to create experimental music -- from a mono audio and a Ukrainian text.
dobutokO2.cabal view
@@ -2,16 +2,17 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dobutokO2-version: 0.43.0.0+version: 0.44.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 license: MIT license-file: LICENSE author: OleksandrZhabenko-maintainer: olexandr543@yahoo.com--- copyright:+maintainer: olexandr.zhabenko@yahoo.com+copyright: Oleksandr Zhabenko category: Sound, Music, Language+bug-reports: https://github.com/Oleksandr-Zhabenko/dobutokO2/issues build-type: Simple extra-source-files: CHANGELOG.md, README.markdown, text.dat.txt cabal-version: >=1.10@@ -19,16 +20,16 @@ library exposed-modules: Main, DobutokO.Sound.Overtones, DobutokO.Sound.Uniq, DobutokO.Sound.Functional, DobutokO.Sound.Process, DobutokO.Sound.Executable, DobutokO.Sound.IntermediateF, DobutokO.Sound.ParseList, DobutokO.Sound.Keyboard, DobutokO.Sound.Functional.Basics, DobutokO.Sound.Functional.Params, DobutokO.Sound.Functional.Split, DobutokO.Sound.DIS5G6G, DobutokO.Sound.Functional.Elements, DobutokO.Sound.Decibel, DobutokO.Sound.Extended, DobutokO.Sound.Octaves, DobutokO.Sound.FunctionF -- other-modules:- -- other-extensions:- build-depends: base >=4.7 && <4.15, bytestring >= 0.10.6 && <1, vector >=0.11 && <0.14, process >=1.4 && <1.9, mmsyn3 >=0.1.5 && <1, mmsyn7s >=0.8 && <1, directory >=1.2.7 && <1.7, mmsyn7ukr >=0.17 && <1, mmsyn2 >=0.1.8 && <1, mmsyn6ukr >=0.8 && <1, mmsyn7l >=0.8 && <1, uniqueness-periods >=0.1 && <1+ other-extensions: MultiWayIf+ build-depends: base >=4.13 && <5, bytestring >= 0.10.6 && <1, vector >=0.11 && <0.14, process >=1.4 && <1.9, end-of-exe ==0.1.2.0, mmsyn7ukr-common ==0.3.1.0, directory >=1.2.7 && <1.7, mmsyn2-array ==0.3.1.1, aftovolio ==0.6.2.0, mmsyn7l ==0.9.2.0, mmsyn7ukr-array ==0.3.0.0 -- hs-source-dirs: default-language: Haskell2010 executable dobutokO2 main-is: Main.hs other-modules: DobutokO.Sound.Overtones, DobutokO.Sound.Uniq, DobutokO.Sound.Functional, DobutokO.Sound.Process, DobutokO.Sound.Executable, DobutokO.Sound.IntermediateF, DobutokO.Sound.ParseList, DobutokO.Sound.Keyboard, DobutokO.Sound.Functional.Basics, DobutokO.Sound.Functional.Params, DobutokO.Sound.Functional.Split, DobutokO.Sound.DIS5G6G, DobutokO.Sound.Functional.Elements, DobutokO.Sound.Decibel, DobutokO.Sound.Extended, DobutokO.Sound.Octaves, DobutokO.Sound.FunctionF- -- other-extensions:- build-depends: base >=4.7 && <4.15, bytestring >= 0.10.6 && <1, vector >=0.11 && <0.14, process >=1.4 && <1.9, mmsyn3 >=0.1.5 && <1, mmsyn7s >=0.8 && <1, directory >=1.2.7 && <1.7, mmsyn7ukr >=0.17 && <1, mmsyn2 >=0.1.8 && <1, mmsyn6ukr >=0.8 && <1, mmsyn7l >=0.8 && <1, uniqueness-periods >=0.1 && <1+ other-extensions: MultiWayIf+ build-depends: base >=4.13 && <5, bytestring >= 0.10.6 && <1, vector >=0.11 && <0.14, process >=1.4 && <1.9, end-of-exe ==0.1.2.0, mmsyn7ukr-common ==0.3.1.0, directory >=1.2.7 && <1.7, mmsyn2-array ==0.3.1.1, aftovolio ==0.6.2.0, mmsyn7l ==0.9.2.0, mmsyn7ukr-array ==0.3.0.0 -- hs-source-dirs: default-language: Haskell2010