dobutokO2 0.44.1.0 → 0.45.0.0
raw patch · 3 files changed
+85/−5 lines, 3 filesdep +quantizerdep ~aftovolioPVP ok
version bump matches the API change (PVP)
Dependencies added: quantizer
Dependency ranges changed: aftovolio
API changes (from Hackage documentation)
- DobutokO.Sound.Functional.Params: instance GHC.Show.Show DobutokO.Sound.Functional.Params.Params
+ DobutokO.Sound.Functional.Params: instance GHC.Internal.Show.Show DobutokO.Sound.Functional.Params.Params
Files
- CHANGELOG.md +4/−0
- DobutokO/Sound/Aftovolio/Ukrainian/Filter.hs +76/−0
- dobutokO2.cabal +5/−5
CHANGELOG.md view
@@ -405,3 +405,7 @@ * Fourty-fourth version revised A. Fixed some issues with ported code. +## 0.45.0.0 -- 2025-02-16++* Fourty-fifth version. Added new module DobutokO.Sound.Aftovolio.Ukrainian.Filter with the function that can be used for creation of the rhythmic patterns from the Ukrainian text.+
+ DobutokO/Sound/Aftovolio/Ukrainian/Filter.hs view
@@ -0,0 +1,76 @@+-- |+-- Module : DobutokO.Sound.Aftovolio.Ukrainian.Filter+-- Copyright : (c) OleksandrZhabenko 2025+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- Provides an easy way to create some rhythmic patterns from a Ukrainian text. +-- Uses aftovolioUkr executable inside from the @aftovolio@ package.++{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}+{-# OPTIONS_GHC -threaded #-}++module DobutokO.Sound.Aftovolio.Ukrainian.Filter (+ -- * Library and executable functions+) where++import System.Exit (ExitCode(..))+import GHC.Base+import GHC.Num ((*),(-))+import GHC.Real (fromIntegral)+import Data.List+import System.IO (FilePath,hPutStrLn,stderr)+import Data.Char (isSpace)+import Data.Maybe (fromJust)+import System.Process (readProcessWithExitCode)+import EndOfExe2 (showE)+import Aftovolio.Halfsplit+import Aftovolio.General.Datatype3+import Aftovolio.Ukrainian.ReadDurations (readSyllableDurations)+import Aftovolio.Ukrainian.Syllable+import Aftovolio.Ukrainian.SyllableWord8+import Aftovolio.Ukrainian.Melodics+import TwoQuantizer (twoQuantizerG)++{-|+ 'quantizeDurationsBasedOnUkrainianText' processes and quantizes syllable durations derived from a Ukrainian text that can be further used by DobutokO modules for creating music and sound patterns or timbre.++ This function performs several steps to produce a list of quantized durations. ++ It reads syllable durations, invoke aftovolioUkr executable with argements, processes and parses output and makes quantization of the result.++ In the event that the external process does not exit successfully, the function writes the error message to stderr+ and returns an empty list. -}+quantizeDurationsBasedOnUkrainianText + :: FilePath -- ^ A 'FilePath' to a file containing syllable durations. If empty, a default set of durations is selected based on @k@ (the 'Int' argument here).+ -> Int -- ^ An 'Int' used to select the specific group of durations from the file (if available) or determine which default list to use.+ -> [Double] -- ^ A list of 'Double' values representing quantization parameters. The resulting list will contain just the values from this list.+ -> String -- ^ A 'String' containing the Ukrainian text to be processed. This text is split into words and passed to the external executable @aftovolioUkr@.+ -> [String] -- ^ A list of additional command-line arguments (['String']) to be forwarded to the @aftovolioUkr@ executable.+ -> [String] -- ^ A list of 'String' values representing selected line numbers or indices to influence the processing of the Ukrainian text. If empty then the whole output is used without selection. If specified in the modes without tests and file single line output changes the output so that just the lines with the specified Int numbers are displayed in the order of the specified numbers. Please, delimit the numbers with spaces. To specify some range, use just dash as here: \'34-250\' meaning that lines with numbers between 34 and 250 inclusively will be displayed. The output preverves music mode additional information as well here.+ -> IO [Double]+quantizeDurationsBasedOnUkrainianText file k quants ukrstrs argss lineNumbersSels = do+ syllableDurationsDs <- readSyllableDurations file+ (code, stdout0, strerr0) <- readProcessWithExitCode (fromJust (showE "aftovolioUkr")) (argss ++ concat [["+nm"], lineNumbersSels, ["-nm"]] ++ words ukrstrs) ""+ if code == ExitSuccess then do+ let basicDurations = map fromIntegral . read3+ (not . null . filter (not . isSpace))+ 1.0+ ( mconcat+ . ( if null file+ then case k of+ 1 -> syllableDurationsD+ 3 -> syllableDurationsD3+ 4 -> syllableDurationsD4+ _ -> syllableDurationsD2+ else+ if length syllableDurationsDs >= k+ then syllableDurationsDs !! (k - 1)+ else syllableDurationsD2+ )+ . createSyllablesUkrS+ ) . unwords . lines $ stdout0+ quantizedDurations = twoQuantizerG False (\x y z -> compare (z*z) (x*y)) quants basicDurations+ return quantizedDurations+ else hPutStrLn stderr strerr0 >> return []
dobutokO2.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dobutokO2-version: 0.44.1.0+version: 0.45.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@@ -18,18 +18,18 @@ cabal-version: >=1.10 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+ 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, DobutokO.Sound.Aftovolio.Ukrainian.Filter -- other-modules: 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+ 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.7.0.0, quantizer ==0.4.0.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-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, DobutokO.Sound.Aftovolio.Ukrainian.Filter 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+ 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.7.0.0, quantizer ==0.4.0.0, mmsyn7l ==0.9.2.0, mmsyn7ukr-array ==0.3.0.0 -- hs-source-dirs: default-language: Haskell2010