-- |
-- Module      :  DobutokO.Sound.Uniq
-- Copyright   :  (c) OleksandrZhabenko 2020, 2024
-- License     :  MIT
-- Stability   :  Experimental
-- 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.

{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -threaded #-}

module DobutokO.Sound.Uniq (
  -- * Library and executable functions
  -- ** For the unique for the String structure timbre
  uniqOvertonesV
  , uniqOverSoXSynth
  , uniqOverSoXSynthN
  -- *** For the unique for the String structure timbre with different signs for harmonics coefficients
  , uniqOvertonesV2
  , uniqOverSoXSynth2
  , uniqOverSoXSynthN3
  , uniqOverSoXSynthN4
  -- *** Use a file for information
  , uniqOverSoXSynthNGen
  , uniqOverSoXSynthNGen3
  , uniqOverSoXSynthNGen4
  -- * Extended generation using enky functionality
 -- ** With usage of additional information in the Ukrainian text
  , uniqOverSoXSynthNGenE
  , uniqOverSoXSynthNGen3E
  , uniqOverSoXSynthNGen4E
  -- * New 4G functions to work with Durations
  , uniqOverSoXSynthN4G
  , uniqOverSoXSynthN34G
  , uniqOverSoXSynthN44G
  , uniqOverSoXSynthNGenE4G
  , uniqOverSoXSynthNGen3E4G
  , uniqOverSoXSynthNGen4E4G
  -- ** 4G with speech-like composition
  , uniqOverSoXSynthN4GS
  , uniqOverSoXSynthN34GS
  , uniqOverSoXSynthN44GS
  , uniqOverSoXSynthNGenE4GS
  , uniqOverSoXSynthNGen3E4GS
  , uniqOverSoXSynthNGen4E4GS
  -- * New 5G functions to work also with Intervals
  , uniqOverSoXSynthN45G
  , uniqOverSoXSynthNGen4E5G
  -- ** 5G with obtained from the text arbitraty length Intervals
  , uniqOverSoXSynthN45GS
  , uniqOverSoXSynthNGen4E5GS
  -- * New 6G function to work also with Strengths
  , uniqOverSoXSynthNGen4E6G
  -- ** 6G with obtained from the text arbitrary length Strengths
  , uniqOverSoXSynthN46GS
  , uniqOverSoXSynthN46GSu
  , uniqOverSoXSynthNGen4E6GS
  , uniqOverSoXSynthNGen4E6GSu
  -- ** With overtones obtained from the additional Ukrainian text
  , uniqOverSoXSynthNGenEPar
  , uniqOverSoXSynthNGenE4GSPar
  , uniqOverSoXSynthNGenE4GPar
  , uniqOverSoXSynthNGen3EPar
  , uniqOverSoXSynthNGen3E4GSPar
  , uniqOverSoXSynthNGen3E4GPar
  , uniqOverSoXSynthNGen4EPar
  , uniqOverSoXSynthNGen4E4GSPar
  , uniqOverSoXSynthNGen4E4GPar
  , uniqOverSoXSynthNGen4E5GPar
  , uniqOverSoXSynthNGen4E5GSPar
  , uniqOverSoXSynthNGen4E6GPar
  , uniqOverSoXSynthNGen4E6GSPar
  , uniqOverSoXSynthNGen4E6GSuPar
) where

import Numeric (showFFloat)
import Data.Maybe (isNothing,fromJust)
import qualified Data.Vector as V
import System.Process
import EndOfExe2 (showE)
import Aftovolio.UniquenessPeriodsG
import Aftovolio.Ukrainian.Melodics
import DobutokO.Sound.Functional.Basics
import DobutokO.Sound.Functional.Params
import DobutokO.Sound.DIS5G6G

-- | For the given frequency of the note it generates a 'V.Vector' of the tuples, each one of which contains the harmonics' frequency and amplitude. For every given
-- 'String' structure of the uniqueness (see the documentation for @mmsyn7s@ and @uniqueness-periods@ packages) it produces the unique timbre.
uniqOvertonesV :: Float -> String -> OvertonesO
uniqOvertonesV :: Float -> String -> OvertonesO
uniqOvertonesV Float
note String
xs =
  let ys :: [Int]
ys = (Int16 -> Int) -> [Int16] -> [Int]
forall a b. (a -> b) -> [a] -> [b]
map Int16 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Int16] -> [Int]) -> (String -> [Int16]) -> String -> [Int]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Int8] -> [Int8] -> [Int16]
forall (t1 :: * -> *) (t2 :: * -> *).
(Foldable t1, Foldable t2) =>
t1 Int8 -> t2 Int8 -> [Int16]
uniquenessPeriodsGI8 [Int8
100,Int8
101,Int8
102] ([Int8] -> [Int16]) -> (String -> [Int8]) -> String -> [Int16]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [Int8]
convertToProperUkrainianI8 (String -> [Int]) -> String -> [Int]
forall a b. (a -> b) -> a -> b
$ String
xs :: [Int]
      z :: Int
z  = [Int] -> Int
forall a. Num a => [a] -> a
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum [Int]
ys
      v :: Vector Float
v  = [Float] -> Vector Float
forall a. [a] -> Vector a
V.fromList ([Float] -> Vector Float)
-> ([Int] -> [Float]) -> [Int] -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> [Int] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Int
y -> Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
z) ([Int] -> Vector Float) -> [Int] -> Vector Float
forall a b. (a -> b) -> a -> b
$ [Int]
ys
      z2 :: Int
z2 = Vector Float -> Int
forall a. Vector a -> Int
V.length Vector Float
v
      v2 :: Vector Float
v2 = Int -> (Int -> Float) -> Vector Float
forall a. Int -> (Int -> a) -> Vector a
V.generate Int
z2 (\Int
i -> Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v Int
i Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)) in
        ((Float, Float) -> Bool) -> OvertonesO -> OvertonesO
forall a. (a -> Bool) -> Vector a -> Vector a
V.takeWhile (\(!Float
u,!Float
z) -> Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare Float
u (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
notes Int
107) Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
GT Bool -> Bool -> Bool
&& Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
z) Float
0.001 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT) (OvertonesO -> OvertonesO)
-> (Vector Float -> OvertonesO) -> Vector Float -> OvertonesO
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> OvertonesO -> OvertonesO
forall a. Int -> Int -> Vector a -> Vector a
V.unsafeSlice Int
1 (Int
z2 Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) (OvertonesO -> OvertonesO)
-> (Vector Float -> OvertonesO) -> Vector Float -> OvertonesO
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
          Vector Float -> Vector Float -> OvertonesO
forall a b. Vector a -> Vector b -> Vector (a, b)
V.zip (Int -> (Int -> Float) -> Vector Float
forall a. Int -> (Int -> a) -> Vector a
V.generate Int
z2 (\Int
i -> Float
note Float -> Float -> Float
forall a. Num a => a -> a -> a
* Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1))) (Vector Float -> OvertonesO) -> Vector Float -> OvertonesO
forall a b. (a -> b) -> a -> b
$ Vector Float
v2

-- | For the given frequency of the note it generates a 'V.Vector' of the tuples, each one of which contains the harmonics' frequency and amplitude. For every given
-- first 'String' argument structure of the uniqueness (see the documentation for @mmsyn7s@ and @uniqueness-periods@ packages) it produces the unique timbre.
-- The second 'String' is used to produce the signs for harmonics coefficients.
uniqOvertonesV2 :: Float -> String -> String -> OvertonesO
uniqOvertonesV2 :: Float -> String -> String -> OvertonesO
uniqOvertonesV2 Float
note String
xs String
ts = 
  let ys :: [Int]
ys = (Int16 -> Int) -> [Int16] -> [Int]
forall a b. (a -> b) -> [a] -> [b]
map Int16 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Int16] -> [Int]) -> (String -> [Int16]) -> String -> [Int]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Int8] -> [Int8] -> [Int16]
forall (t1 :: * -> *) (t2 :: * -> *).
(Foldable t1, Foldable t2) =>
t1 Int8 -> t2 Int8 -> [Int16]
uniquenessPeriodsGI8 [Int8
100,Int8
101,Int8
102] ([Int8] -> [Int16]) -> (String -> [Int8]) -> String -> [Int16]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [Int8]
convertToProperUkrainianI8 (String -> [Int]) -> String -> [Int]
forall a b. (a -> b) -> a -> b
$ String
xs :: [Int]
      z :: Int
z  = [Int] -> Int
forall a. Num a => [a] -> a
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum [Int]
ys
      v :: Vector Float
v  = [Float] -> Vector Float
forall a. [a] -> Vector a
V.fromList ([Float] -> Vector Float)
-> ([Int] -> [Float]) -> [Int] -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> [Int] -> [Float]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Int
y -> Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
z) ([Int] -> Vector Float) -> [Int] -> Vector Float
forall a b. (a -> b) -> a -> b
$ [Int]
ys
      z2 :: Int
z2 = Vector Float -> Int
forall a. Vector a -> Int
V.length Vector Float
v
      v2 :: Vector Float
v2 = Int -> (Int -> Float) -> Vector Float
forall a. Int -> (Int -> a) -> Vector a
V.generate Int
z2 (\Int
i -> (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex ((Int -> Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> Vector a -> Vector b
V.map Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Int -> Vector Float)
-> (String -> Vector Int) -> String -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> Vector Int
signsFromString Int
z2 (String -> Vector Float) -> String -> Vector Float
forall a b. (a -> b) -> a -> b
$ String
ts) Int
i) Float -> Float -> Float
forall a. Num a => a -> a -> a
* Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v Int
i Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)) in
        ((Float, Float) -> Bool) -> OvertonesO -> OvertonesO
forall a. (a -> Bool) -> Vector a -> Vector a
V.takeWhile (\(!Float
u,!Float
z) -> Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare Float
u (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
notes Int
107) Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
GT Bool -> Bool -> Bool
&& Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
z) Float
0.001 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT) (OvertonesO -> OvertonesO)
-> (Vector Float -> OvertonesO) -> Vector Float -> OvertonesO
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Float, Float) -> Bool) -> OvertonesO -> OvertonesO
forall a. (a -> Bool) -> Vector a -> Vector a
V.filter (\(Float
_, Float
t4) -> Float
t4 Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
/= Float
0.0) (OvertonesO -> OvertonesO)
-> (Vector Float -> OvertonesO) -> Vector Float -> OvertonesO
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
          Int -> Int -> OvertonesO -> OvertonesO
forall a. Int -> Int -> Vector a -> Vector a
V.unsafeSlice Int
1 (Int
z2 Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) (OvertonesO -> OvertonesO)
-> (Vector Float -> OvertonesO) -> Vector Float -> OvertonesO
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector Float -> Vector Float -> OvertonesO
forall a b. Vector a -> Vector b -> Vector (a, b)
V.zip (Int -> (Int -> Float) -> Vector Float
forall a. Int -> (Int -> a) -> Vector a
V.generate Int
z2 (\Int
i -> Float
note Float -> Float -> Float
forall a. Num a => a -> a -> a
* Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1))) (Vector Float -> OvertonesO) -> Vector Float -> OvertonesO
forall a b. (a -> b) -> a -> b
$ Vector Float
v2
  
-- | 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
-- if the uniqueness structure and length are the same for both 'String'. Otherwise, they differs. This gives an opportunity to practically
-- and quickly synthesize differently sounding intervals. The main component of the sound includes the lower pure quint, which can be in
-- the same octave or in the one with the number lower by one. Please, check before executing 
-- whether there is no \"x.wav\", \"test*\", \"result*\" files in the current directory, because they can be overwritten.
uniqOverSoXSynth :: Float -> String -> IO ()
uniqOverSoXSynth :: Float -> String -> IO ()
uniqOverSoXSynth Float
x String
wws = do
  let note0 :: Float
note0 = Float -> Float
closestNote Float
x
      note1 :: Float
note1 = Float -> Float
pureQuintNote Float
note0
      v0 :: OvertonesO
v0    = Float -> String -> OvertonesO
uniqOvertonesV Float
note0 String
wws
      v1 :: OvertonesO
v1    = Float -> String -> OvertonesO
uniqOvertonesV Float
note1 String
wws
  _ <- String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox")) [String
"-r22050", String
"-n", String
"test-.wav", String
"synth", String
"0.5",String
"sine", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
note0 String
"",
     String
"synth", String
"0.5",String
"sine", String
"mix", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
note1 String
"", String
"vol",String
"0.5"] String
""
  uniqOverSoXSynthHelp v0
  uniqOverSoXSynthHelp2 v1
  mixTest

uniqOverSoXSynthHelp1 :: String -> OvertonesO -> IO ()
uniqOverSoXSynthHelp1 :: String -> OvertonesO -> IO ()
uniqOverSoXSynthHelp1 String
xs = (Int -> (Float, Float) -> IO (ExitCode, String, String))
-> OvertonesO -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
i (Float
noteN, !Float
amplN) -> String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox"))
 [String
"-r22050", String
"-n", String
xs String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav", String
"synth", String
"0.5",String
"sine", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
noteN String
"", String
"vol", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
amplN String
""] String
"") 

uniqOverSoXSynthHelp :: OvertonesO -> IO ()
uniqOverSoXSynthHelp :: OvertonesO -> IO ()
uniqOverSoXSynthHelp = String -> OvertonesO -> IO ()
uniqOverSoXSynthHelp1 String
"test0"

uniqOverSoXSynthHelp2 :: OvertonesO -> IO ()
uniqOverSoXSynthHelp2 :: OvertonesO -> IO ()
uniqOverSoXSynthHelp2 = String -> OvertonesO -> IO ()
uniqOverSoXSynthHelp1 String
"test1"

-- | 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
-- if the uniqueness structure and length are the same for both 'String'. Otherwise, they differs. This gives an opportunity to practically
-- and quickly synthesize differently sounding intervals. The main component of the sound includes the lower pure quint, which can be in
-- the same octave or in the one with the number lower by one. Please, check before executing 
-- whether there is no \"x.wav\", \"test*\", \"result*\" files in the current directory, because they can be overwritten.
-- The second 'String' argument is used to define signs for the harmonics coefficients for Overtones.
uniqOverSoXSynth2 :: Float -> String -> String -> IO ()
uniqOverSoXSynth2 :: Float -> String -> String -> IO ()
uniqOverSoXSynth2 Float
x String
wws String
tts = do
  let note0 :: Float
note0 = Float -> Float
closestNote Float
x
      note1 :: Float
note1 = Float -> Float
pureQuintNote Float
note0
      v0 :: OvertonesO
v0    = Float -> String -> String -> OvertonesO
uniqOvertonesV2 Float
note0 String
wws String
tts
      v1 :: OvertonesO
v1    = Float -> String -> String -> OvertonesO
uniqOvertonesV2 Float
note1 String
wws String
tts
  _ <- String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox")) [String
"-r22050", String
"-n", String
"test-.wav", String
"synth", String
"0.5",String
"sine", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
note0 String
"", String
"synth",
     String
"0.5",String
"sine", String
"mix", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
note1 String
"", String
"vol",String
"0.5"] String
""
  uniqOverSoXSynthHelp v0
  uniqOverSoXSynthHelp2 v1
  mixTest

-- | Function to create a melody for the given arguments. The first 'String' is used to provide a rhythm. The second one -- to provide a timbre.
-- The timbre for another given text usually differs, but can be the same. This gives an opportunity to practically and quickly
-- synthesize differently sounding intervals. The first 'Float' 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, otherwise they are multiplied by the parameter and this results in
-- their becoming more silent ones. The main component of the sound is in the given octave with a number given
-- by 'Int' parameter. Besides, another main component of the sound includes the lower pure quint, which can be in the same octave or in the one with
-- the number lower by one. The second 'Float' argument is a basic sound duration. The default one is 0.5 (second). Please, check before executing
-- whether there is no \"x.wav\", \"test*\", \"result*\" files in the current directory, because they can be overwritten.
uniqOverSoXSynthN :: Int -> Float -> Float -> String -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN :: Int -> Float -> Float -> String -> String -> Vector Float -> IO ()
uniqOverSoXSynthN Int
n Float
ampL Float
time3 String
zs = Int -> Float -> Vector Float -> String -> Vector Float -> IO ()
uniqOverSoXSynthN4G Int
n Float
ampL (Int -> String -> Float -> Vector Float
str2DurationsDef Int
n String
zs Float
time3)

-- | Variant of the 'uniqOverSoXSynthN4G' function where 'Durations' are obtained from the 'String' using 'str2Durations' function. Helps to create a speech-like 
-- composition.
uniqOverSoXSynthN4GS :: Int -> Float -> Float -> String -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN4GS :: Int -> Float -> Float -> String -> String -> Vector Float -> IO ()
uniqOverSoXSynthN4GS Int
n Float
ampL Float
time3 String
zs = Int -> Float -> Vector Float -> String -> Vector Float -> IO ()
uniqOverSoXSynthN4G Int
n Float
ampL (String -> Float -> Vector Float
str2Durations String
zs Float
time3)

-- | 4G generalized variant of the 'uniqOverSoXSynthN' where you specify your own 'Durations'.
uniqOverSoXSynthN4G :: Int -> Float -> Durations -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN4G :: Int -> Float -> Vector Float -> String -> Vector Float -> IO ()
uniqOverSoXSynthN4G Int
n Float
ampL Vector Float
v2 String
wws Vector Float
vec0
 | (Float -> Bool) -> Vector Float -> Bool
forall a. (a -> Bool) -> Vector a -> Bool
V.all (Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
== Float
0.0) Vector Float
v2 = String -> IO ()
putStrLn String
"You provided no valid durations data! "
 | Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
ampL) Float
0.01 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
LT Bool -> Bool -> Bool
&& Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
ampL) Float
1.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
GT =
    let v21 :: Vector Float
v21 = (Float -> Bool) -> Vector Float -> Vector Float
forall a. (a -> Bool) -> Vector a -> Vector a
V.filter (Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
/= Float
0.0) Vector Float
v2
        m :: Int
m     = Vector Float -> Int
forall a. Vector a -> Int
V.length Vector Float
v21
        zeroN :: Int
zeroN = Vector Float -> Int
forall a. Vector a -> Int
numVZeroesPre Vector Float
vec0 in (Int -> Float -> IO ()) -> Vector Float -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
j Float
x -> do   
          let note0 :: Float
note0 = Float -> Float
closestNote Float
x
              note1 :: Float
note1 = Float -> Float
pureQuintNote Float
note0
              v0 :: OvertonesO
v0    = Float -> String -> OvertonesO
uniqOvertonesV Float
note0 String
wws
              v1 :: OvertonesO
v1    = Float -> String -> OvertonesO
uniqOvertonesV Float
note1 String
wws
              uniqOverSoXSynthHelpN :: OvertonesO -> IO ()
uniqOverSoXSynthHelpN = (Int -> (Float, Float) -> IO (ExitCode, String, String))
-> OvertonesO -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
i (Float
noteN, !Float
amplN) -> String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox"))
                [String
"-r22050", String
"-n", String
"test" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> ShowS
prependZeroes Int
zeroN (Int -> String
forall a. Show a => a -> String
show (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",
                   String
"sine", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
noteN String
"", String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT 
                      then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL) String
"" else String
"0"] String
"")
              uniqOverSoXSynthHelpN2 :: OvertonesO -> IO ()
uniqOverSoXSynthHelpN2 = (Int -> (Float, Float) -> IO (ExitCode, String, String))
-> OvertonesO -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
i (Float
noteN, !Float
amplN) -> String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox"))
                [String
"-r22050", String
"-n", String
"testQ" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> ShowS
prependZeroes Int
zeroN (Int -> String
forall a. Show a => a -> String
show (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",
                   String
"sine", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
noteN String
"", String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT 
                      then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL) String
"" else String
"0"] String
"")
              soxSynthHelpMain :: a -> a -> IO (ExitCode, String, String)
soxSynthHelpMain a
note01 a
note02 = String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox")) [String
"-r22050", String
"-n", String
"testA" String -> ShowS
forall a. [a] -> [a] -> [a]
++
                 Int -> ShowS
prependZeroes Int
zeroN String
"1" String -> ShowS
forall a. [a] -> [a] -> [a]
++  String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",String
"sine", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
note01 String
"", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v2 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) String
"",String
"sine", String
"mix", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
note02 String
"", String
"vol",
                    if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then String
"0.5" else String
"0"]  String
""
          _ <- Float -> Float -> IO (ExitCode, String, String)
forall {a} {a}.
(RealFloat a, RealFloat a) =>
a -> a -> IO (ExitCode, String, String)
soxSynthHelpMain Float
note0 Float
note1
          uniqOverSoXSynthHelpN v0
          uniqOverSoXSynthHelpN2 v1
          mixTest2 zeroN j) Vector Float
vec0
 | Bool
otherwise = let ampL1 :: Float
ampL1 = Float
ampL Float -> Float -> Float
forall a. Num a => a -> a -> a
- (Integer -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> Float) -> (Float -> Integer) -> Float -> Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Integer
forall b. Integral b => Float -> b
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Float -> Float) -> Float -> Float
forall a b. (a -> b) -> a -> b
$ Float
ampL) in
    if Float -> Float
forall a. Num a => a -> a
abs Float
ampL1 Float -> Float -> Bool
forall a. Ord a => a -> a -> Bool
< Float
0.01 then Int -> Float -> Vector Float -> String -> Vector Float -> IO ()
uniqOverSoXSynthN4G Int
n Float
0.01 Vector Float
v2 String
wws Vector Float
vec0
    else Int -> Float -> Vector Float -> String -> Vector Float -> IO ()
uniqOverSoXSynthN4G Int
n Float
ampL1 Vector Float
v2 String
wws Vector Float
vec0

-- | Function to create a melody for the given arguments. The first 'String' is used to provide a rhythm. The second one -- to provide a timbre.
-- The timbre for another given text usually differs, but can be the same. This gives an opportunity to practically and quickly
-- synthesize differently sounding intervals. The first 'Float' 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, otherwise they are multiplied by the parameter and this results in
-- their becoming more silent ones. The main component of the sound is in the given octave with a number given
-- by 'Int' parameter. Besides, another main component of the sound includes the lower pure quint, which can be in the same octave or in the one with
-- the number lower by one. The second 'Float' argument is a basic sound duration. The default one is 0.5 (second). Please, check before executing
-- whether there is no \"x.wav\", \"test*\", \"result*\" files in the current directory, because they can be overwritten.
-- The third 'String' argument is used to define signs of the harmonics coefficients in the generated sounds.
uniqOverSoXSynthN3 :: Int -> Float -> Float -> String -> String -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN3 :: Int
-> Float
-> Float
-> String
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN3 Int
n Float
ampL Float
time3 String
zs = Int
-> Float
-> Vector Float
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN34G Int
n Float
ampL (Int -> String -> Float -> Vector Float
str2DurationsDef Int
n String
zs Float
time3)

-- | Variant of the 'uniqOverSoXSynthN34G' where 'Durations' are obtained from the 'String' using 'str2Durations' function. Helps to create a speech-like 
-- composition.
uniqOverSoXSynthN34GS :: Int -> Float -> Float -> String -> String -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN34GS :: Int
-> Float
-> Float
-> String
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN34GS Int
n Float
ampL Float
time3 String
zs = Int
-> Float
-> Vector Float
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN34G Int
n Float
ampL (String -> Float -> Vector Float
str2Durations String
zs Float
time3)

-- | 4G generalized variant of the 'uniqOverSoXSynthN3' where you specify your own 'Durations'. 
uniqOverSoXSynthN34G :: Int -> Float -> Durations -> String -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN34G :: Int
-> Float
-> Vector Float
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN34G Int
n Float
ampL Vector Float
v2 String
wws String
tts Vector Float
vec0
 | (Float -> Bool) -> Vector Float -> Bool
forall a. (a -> Bool) -> Vector a -> Bool
V.all (Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
== Float
0.0) Vector Float
v2 = String -> IO ()
putStrLn String
"You provided no valid durations data! "
 | Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
ampL) Float
0.01 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
LT Bool -> Bool -> Bool
&& Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
ampL) Float
1.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
GT =
    let v21 :: Vector Float
v21 = (Float -> Bool) -> Vector Float -> Vector Float
forall a. (a -> Bool) -> Vector a -> Vector a
V.filter (Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
/=Float
0.0) Vector Float
v2
        m :: Int
m     = Vector Float -> Int
forall a. Vector a -> Int
V.length Vector Float
v2
        zeroN :: Int
zeroN = Vector Float -> Int
forall a. Vector a -> Int
numVZeroesPre Vector Float
vec0 in (Int -> Float -> IO ()) -> Vector Float -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
j Float
x -> do   
          let note0 :: Float
note0 = Float -> Float
closestNote Float
x                         -- zs ? vec0 -- are they related to the one object? No, they are obtained from different sources.
              note1 :: Float
note1 = Float -> Float
pureQuintNote Float
note0
              v0 :: OvertonesO
v0    = Float -> String -> String -> OvertonesO
uniqOvertonesV2 Float
note0 String
wws String
tts
              v1 :: OvertonesO
v1    = Float -> String -> String -> OvertonesO
uniqOvertonesV2 Float
note1 String
wws String
tts
              uniqOverSoXSynthHelpN :: Vector (a, Float) -> IO ()
uniqOverSoXSynthHelpN Vector (a, Float)
vec = (Int -> (a, Float) -> IO (ExitCode, String, String))
-> Vector (a, Float) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
i (a
noteN, !Float
amplN) -> String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox"))
                [String
"-r22050", String
"-n", String
"test" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> ShowS
prependZeroes Int
zeroN (Int -> String
forall a. Show a => a -> String
show (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",
                   String
"sine", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
noteN String
"", String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL) String
"" else String
"0"] String
"") Vector (a, Float)
vec
              uniqOverSoXSynthHelpN2 :: Vector (a, Float) -> IO ()
uniqOverSoXSynthHelpN2 Vector (a, Float)
vec = (Int -> (a, Float) -> IO (ExitCode, String, String))
-> Vector (a, Float) -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
i (a
noteN, !Float
amplN) -> String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox"))
                [String
"-r22050", String
"-n", String
"testQ" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> ShowS
prependZeroes Int
zeroN (Int -> String
forall a. Show a => a -> String
show (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",
                   String
"sine", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
noteN String
"", String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL) String
"" else String
"0"] String
"") Vector (a, Float)
vec 
              soxSynthHelpMain :: a -> a -> IO (ExitCode, String, String)
soxSynthHelpMain a
note01 a
note02 = String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox")) [String
"-r22050", String
"-n", String
"testA" String -> ShowS
forall a. [a] -> [a] -> [a]
++
                Int -> ShowS
prependZeroes Int
zeroN String
"1" String -> ShowS
forall a. [a] -> [a] -> [a]
++  String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",String
"sine", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
note01 String
"",
                  String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",String
"sine", String
"mix", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
note02 String
"", String
"vol",
                    if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then String
"0.5" else String
"0"] String
""
          _ <- Float -> Float -> IO (ExitCode, String, String)
forall {a} {a}.
(RealFloat a, RealFloat a) =>
a -> a -> IO (ExitCode, String, String)
soxSynthHelpMain Float
note0 Float
note1
          uniqOverSoXSynthHelpN v0
          uniqOverSoXSynthHelpN2 v1
          mixTest2 zeroN j) Vector Float
vec0
 | Bool
otherwise = let ampL1 :: Float
ampL1 = Float
ampL Float -> Float -> Float
forall a. Num a => a -> a -> a
- (Integer -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> Float) -> (Float -> Integer) -> Float -> Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Integer
forall b. Integral b => Float -> b
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Float -> Float) -> Float -> Float
forall a b. (a -> b) -> a -> b
$ Float
ampL) in
    if Float -> Float
forall a. Num a => a -> a
abs Float
ampL1 Float -> Float -> Bool
forall a. Ord a => a -> a -> Bool
< Float
0.01 then Int
-> Float
-> Vector Float
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN34G Int
n Float
0.01 Vector Float
v2 String
wws String
tts Vector Float
vec0
    else Int
-> Float
-> Vector Float
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN34G Int
n Float
ampL1 Vector Float
v2 String
wws String
tts Vector Float
vec0    

-- | Function to create a melody for the given arguments. The first 'String' is used to provide a rhythm. The second one -- to provide a timbre.
-- The timbre for another given text usually differs, but can be the same. This gives an opportunity to practically and quickly
-- synthesize differently sounding intervals. The first 'Float' 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, otherwise they are multiplied by the parameter and this results in
-- their becoming more silent ones. The main component of the sound is in the given octave with a number given
-- by 'Int' parameter. Besides, another main component of the sound includes the lower pure quint, which can be in the same octave or in the one with
-- the number lower by one. The second 'Float' argument is a basic sound duration. The default one is 0.5 (second). Please, check before executing
-- whether there is no \"x.wav\", \"test*\", \"result*\" files in the current directory, because they can be overwritten.
-- The third 'String' argument is used to define signs of the harmonics coefficients in the generated sounds.
-- The fourth 'String' argument is used to define the intervals for the notes if any.
-- The third 'Float' parameter basically is used to define in how many times the volume for the second lower note is less than the volume of
-- the main note. If it is rather great, it can signal that the volume for the second note overTones are greater than for the main note obetones.
-- The last one is experimental feature.
uniqOverSoXSynthN4 :: Int -> Float -> Float -> Float -> String -> String -> String -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN4 :: Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN4 Int
n Float
ampL Float
time3 Float
dAmpl String
zs = Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN44G Int
n Float
ampL Float
dAmpl (Int -> String -> Float -> Vector Float
str2DurationsDef Int
n String
zs Float
time3)

-- | Variant of the 'uniqOverSoXSynthN44G' where 'Durations' are obtained from the 'String' using 'str2Durations' function. Helps to create a speech-like 
-- composition.
uniqOverSoXSynthN44GS :: Int -> Float -> Float -> Float -> String -> String -> String -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN44GS :: Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN44GS Int
n Float
ampL Float
time3 Float
dAmpl String
zs = Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN44G Int
n Float
ampL Float
dAmpl (String -> Float -> Vector Float
str2Durations String
zs Float
time3)

-- | 4G generalized variant of the 'uniqOverSoXSynthN4' where you specify your own 'Durations'. 
uniqOverSoXSynthN44G :: Int -> Float -> Float -> Durations -> String -> String -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN44G :: Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN44G Int
n Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts String
vs = Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> IO ()
uniqOverSoXSynthN45G Int
n Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts (String -> Vector Int
intervalsFromString String
vs)
 
-- | 5G generalized variant of the 'uniqOverSoXSynthN44G' where you specify your own 'Intervals'. 
uniqOverSoXSynthN45G :: Int -> Float -> Float -> Durations -> String -> String -> Intervals -> V.Vector Float -> IO ()
uniqOverSoXSynthN45G :: Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> IO ()
uniqOverSoXSynthN45G Int
n Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 Vector Float
vec0
 | (Float -> Bool) -> Vector Float -> Bool
forall a. (a -> Bool) -> Vector a -> Bool
V.all (Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
== Float
0.0) Vector Float
v2 = String -> IO ()
putStrLn String
"You provided no valid durations data! "
 | Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
ampL) Float
0.01 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
LT Bool -> Bool -> Bool
&& Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
ampL) Float
1.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
GT =
    let v21 :: Vector Float
v21 = (Float -> Bool) -> Vector Float -> Vector Float
forall a. (a -> Bool) -> Vector a -> Vector a
V.filter (Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
/=Float
0.0) Vector Float
v2
        m :: Int
m     = Vector Float -> Int
forall a. Vector a -> Int
V.length Vector Float
v2
        zeroN :: Int
zeroN = Vector Float -> Int
forall a. Vector a -> Int
numVZeroesPre Vector Float
vec0
        l :: Int
l     = Vector Int -> Int
forall a. Vector a -> Int
V.length Vector Int
v3 in (Int -> Float -> IO ()) -> Vector Float -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
j Float
x -> do   
          let note0 :: Float
note0 = Float -> Float
closestNote Float
x
              note1 :: Maybe Float
note1 = Int -> Float -> Maybe Float
dNote (Vector Int -> Int -> Int
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Int
v3 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
l)) Float
note0
              v0 :: OvertonesO
v0    = Float -> String -> String -> OvertonesO
uniqOvertonesV2 Float
note0 String
wws String
tts
              v1 :: OvertonesO
v1    = if Maybe Float -> Bool
forall a. Maybe a -> Bool
isNothing Maybe Float
note1 then OvertonesO
forall a. Vector a
V.empty
                      else Float -> String -> String -> OvertonesO
uniqOvertonesV2 (Maybe Float -> Float
forall a. HasCallStack => Maybe a -> a
fromJust Maybe Float
note1) String
wws String
tts
              uniqOverSoXSynthHelpN :: OvertonesO -> IO ()
uniqOverSoXSynthHelpN = (Int -> (Float, Float) -> IO (ExitCode, String, String))
-> OvertonesO -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
i (Float
noteN, !Float
amplN) -> String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox"))
                [String
"-r22050", String
"-n", String
"test" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> ShowS
prependZeroes Int
zeroN (Int -> String
forall a. Show a => a -> String
show (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",
                  String
"sine",Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
noteN String
"", String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL) String
"" else String
"0"] String
"") 
              uniqOverSoXSynthHelpN2 :: OvertonesO -> IO ()
uniqOverSoXSynthHelpN2 = (Int -> (Float, Float) -> IO (ExitCode, String, String))
-> OvertonesO -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
i (Float
noteN, Float
amplN) -> String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox"))
                [String
"-r22050", String
"-n", String
"testQ" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> ShowS
prependZeroes Int
zeroN (Int -> String
forall a. Show a => a -> String
show (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",
                   String
"sine", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
noteN String
"", String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (if Float
dAmpl Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL Float -> Float -> Bool
forall a. Ord a => a -> a -> Bool
> Float
1.0 then Float
1.0
                      else Float
dAmpl Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL) String
"" else String
"0"] String
"") 
              soxSynthHelpMain0 :: a -> IO (ExitCode, String, String)
soxSynthHelpMain0 a
note01 = String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox")) [String
"-r22050", String
"-n", String
"testA" String -> ShowS
forall a. [a] -> [a] -> [a]
++
                 Int -> ShowS
prependZeroes Int
zeroN String
"1" String -> ShowS
forall a. [a] -> [a] -> [a]
++  String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",String
"sine", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
note01 String
"",
                   String
"vol",if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then String
"0.5" else String
"0"] String
""
              soxSynthHelpMain1 :: a -> IO (ExitCode, String, String)
soxSynthHelpMain1 a
note02 = String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox")) [String
"-r22050", String
"-n", String
"testB" String -> ShowS
forall a. [a] -> [a] -> [a]
++
                 Int -> ShowS
prependZeroes Int
zeroN String
"1" String -> ShowS
forall a. [a] -> [a] -> [a]
++  String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",String
"sine", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
note02 String
"",
                    String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (if Float
dAmpl Float -> Float -> Bool
forall a. Ord a => a -> a -> Bool
> Float
0.5 then Float
0.5 else Float
dAmpl Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
2) String
"" else String
"0"] String
""
          if Maybe Float -> Bool
forall a. Maybe a -> Bool
isNothing Maybe Float
note1 then do { _ <- Float -> IO (ExitCode, String, String)
forall {a}. RealFloat a => a -> IO (ExitCode, String, String)
soxSynthHelpMain0 Float
note0
                                     ; uniqOverSoXSynthHelpN v0 }
          else do { _ <- Float -> IO (ExitCode, String, String)
forall {a}. RealFloat a => a -> IO (ExitCode, String, String)
soxSynthHelpMain0 Float
note0
                  ; _ <- soxSynthHelpMain1 (fromJust note1)
                  ; uniqOverSoXSynthHelpN v0
                  ; uniqOverSoXSynthHelpN2 v1}
          Int -> Int -> IO ()
mixTest2 Int
zeroN Int
j) Vector Float
vec0
 | Bool
otherwise = let ampL1 :: Float
ampL1 = Float
ampL Float -> Float -> Float
forall a. Num a => a -> a -> a
- (Integer -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> Float) -> (Float -> Integer) -> Float -> Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Integer
forall b. Integral b => Float -> b
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Float -> Float) -> Float -> Float
forall a b. (a -> b) -> a -> b
$ Float
ampL) in
    if Float -> Float
forall a. Num a => a -> a
abs Float
ampL1 Float -> Float -> Bool
forall a. Ord a => a -> a -> Bool
< Float
0.01 then Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> IO ()
uniqOverSoXSynthN45G Int
n Float
0.01 Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 Vector Float
vec0
    else Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> IO ()
uniqOverSoXSynthN45G Int
n Float
ampL1 Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 Vector Float
vec0    

-- | 6G generalized variant of the 'uniqOverSoXSynthN45G' where you specify your own 'Strengths' and a limit (as the last 'Float') when less volume level 
-- sound files are treated as a silent ones and are not adjusted. 
uniqOverSoXSynthN46G :: Int -> Float -> Float -> Durations -> String -> String -> Intervals -> V.Vector Float -> Strengths -> Float -> IO ()
uniqOverSoXSynthN46G :: Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthN46G Int
n Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 Vector Float
vec0 Vector Float
v6 Float
limV
 | (Float -> Bool) -> Vector Float -> Bool
forall a. (a -> Bool) -> Vector a -> Bool
V.all (Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
== Float
0.0) Vector Float
v2 = String -> IO ()
putStrLn String
"You provided no valid durations data! "
 | Vector Float -> Bool
forall a. Vector a -> Bool
V.null Vector Float
v6 = String -> IO ()
putStrLn String
"You did not provide a volume adjustments vector! "
 | Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
ampL) Float
0.01 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
LT Bool -> Bool -> Bool
&& Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Float -> Float
forall a. Num a => a -> a
abs Float
ampL) Float
1.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
/= Ordering
GT =
    let v21 :: Vector Float
v21 = (Float -> Bool) -> Vector Float -> Vector Float
forall a. (a -> Bool) -> Vector a -> Vector a
V.filter (Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
/=Float
0.0) Vector Float
v2
        m :: Int
m     = Vector Float -> Int
forall a. Vector a -> Int
V.length Vector Float
v2
        zeroN :: Int
zeroN = Vector Float -> Int
forall a. Vector a -> Int
numVZeroesPre Vector Float
vec0
        l :: Int
l     = Vector Int -> Int
forall a. Vector a -> Int
V.length Vector Int
v3 in (Int -> Float -> IO ()) -> Vector Float -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
j Float
x -> do   
          let note0 :: Float
note0 = Float -> Float
closestNote Float
x
              note1 :: Maybe Float
note1 = Int -> Float -> Maybe Float
dNote (Vector Int -> Int -> Int
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Int
v3 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
l)) Float
note0
              v0 :: OvertonesO
v0    = Float -> String -> String -> OvertonesO
uniqOvertonesV2 Float
note0 String
wws String
tts
              v1 :: OvertonesO
v1    = if Maybe Float -> Bool
forall a. Maybe a -> Bool
isNothing Maybe Float
note1 then OvertonesO
forall a. Vector a
V.empty
                      else Float -> String -> String -> OvertonesO
uniqOvertonesV2 (Maybe Float -> Float
forall a. HasCallStack => Maybe a -> a
fromJust Maybe Float
note1) String
wws String
tts
              uniqOverSoXSynthHelpN :: OvertonesO -> IO ()
uniqOverSoXSynthHelpN = (Int -> (Float, Float) -> IO (ExitCode, String, String))
-> OvertonesO -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
i (Float
noteN, !Float
amplN) -> String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox"))
                [String
"-r22050", String
"-n", String
"test" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> ShowS
prependZeroes Int
zeroN (Int -> String
forall a. Show a => a -> String
show (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",
                  String
"sine",Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
noteN String
"", String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL) String
"" else String
"0"] String
"") 
              uniqOverSoXSynthHelpN2 :: OvertonesO -> IO ()
uniqOverSoXSynthHelpN2 = (Int -> (Float, Float) -> IO (ExitCode, String, String))
-> OvertonesO -> IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
V.imapM_ (\Int
i (Float
noteN, Float
amplN) -> String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox"))
                [String
"-r22050", String
"-n", String
"testQ" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> ShowS
prependZeroes Int
zeroN (Int -> String
forall a. Show a => a -> String
show (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
2)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",
                   String
"sine", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) Float
noteN String
"", String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (if Float
dAmpl Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL Float -> Float -> Bool
forall a. Ord a => a -> a -> Bool
> Float
1.0 then Float
1.0
                      else Float
dAmpl Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
amplN Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float
ampL) String
"" else String
"0"] String
"") 
              soxSynthHelpMain0 :: a -> IO (ExitCode, String, String)
soxSynthHelpMain0 a
note01 = String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox")) [String
"-r22050", String
"-n", String
"testA" String -> ShowS
forall a. [a] -> [a] -> [a]
++
                 Int -> ShowS
prependZeroes Int
zeroN String
"1" String -> ShowS
forall a. [a] -> [a] -> [a]
++  String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",String
"sine", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
note01 String
"",
                   String
"vol",if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then String
"0.5" else String
"0"] String
""
              soxSynthHelpMain1 :: a -> IO (ExitCode, String, String)
soxSynthHelpMain1 a
note02 = String -> [String] -> String -> IO (ExitCode, String, String)
readProcessWithExitCode (Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust (String -> Maybe String
showE String
"sox")) [String
"-r22050", String
"-n", String
"testB" String -> ShowS
forall a. [a] -> [a] -> [a]
++
                 Int -> ShowS
prependZeroes Int
zeroN String
"1" String -> ShowS
forall a. [a] -> [a] -> [a]
++  String
".wav", String
"synth", Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (Float -> Float
forall a. Num a => a -> a
abs (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m))) String
"",String
"sine", Maybe Int -> a -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) a
note02 String
"",
                    String
"vol", if Float -> Float -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v21 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Int
m)) Float
0.0 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
GT then Maybe Int -> Float -> ShowS
forall a. RealFloat a => Maybe Int -> a -> ShowS
showFFloat (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4) (if Float
dAmpl Float -> Float -> Bool
forall a. Ord a => a -> a -> Bool
> Float
0.5 then Float
0.5 else Float
dAmpl Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
2) String
"" else String
"0"] String
""
          if Maybe Float -> Bool
forall a. Maybe a -> Bool
isNothing Maybe Float
note1 then do { _ <- Float -> IO (ExitCode, String, String)
forall {a}. RealFloat a => a -> IO (ExitCode, String, String)
soxSynthHelpMain0 Float
note0
                                     ; uniqOverSoXSynthHelpN v0 }
          else do { _ <- Float -> IO (ExitCode, String, String)
forall {a}. RealFloat a => a -> IO (ExitCode, String, String)
soxSynthHelpMain0 Float
note0
                  ; _ <- soxSynthHelpMain1 (fromJust note1)
                  ; uniqOverSoXSynthHelpN v0
                  ; uniqOverSoXSynthHelpN2 v1}
          Int -> Int -> IO ()
mixTest2 Int
zeroN Int
j
          String -> Float -> Float -> IO ()
apply6GSilentFile (String
"result" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> ShowS
prependZeroes Int
zeroN (Int -> String
forall a. Show a => a -> String
show Int
j) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
".wav") Float
limV (Vector Float -> Int -> Float
forall a. Vector a -> Int -> a
V.unsafeIndex Vector Float
v6 (Int
j Int -> Int -> Int
forall a. Integral a => a -> a -> a
`rem` Vector Float -> Int
forall a. Vector a -> Int
V.length Vector Float
v6))) Vector Float
vec0
 | Bool
otherwise = let ampL1 :: Float
ampL1 = Float
ampL Float -> Float -> Float
forall a. Num a => a -> a -> a
- (Integer -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Integer -> Float) -> (Float -> Integer) -> Float -> Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> Integer
forall b. Integral b => Float -> b
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Float -> Float) -> Float -> Float
forall a b. (a -> b) -> a -> b
$ Float
ampL) in
    if Float -> Float
forall a. Num a => a -> a
abs Float
ampL1 Float -> Float -> Bool
forall a. Ord a => a -> a -> Bool
< Float
0.01 then Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthN46G Int
n Float
0.01 Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 Vector Float
vec0 Vector Float
v6 Float
limV
    else Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthN46G Int
n Float
ampL1 Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 Vector Float
vec0 Vector Float
v6 Float
limV

-- | Variant of the 'uniqOverSoXSynthN45G' where 'Intervals' are obtained from the 'String' using 'intervalsFromStringG' function. Helps to create a speech-like 
-- composition.
uniqOverSoXSynthN45GS :: Int -> Float -> Float -> Float -> String -> String -> String -> Intervals -> String -> V.Vector Float -> IO ()
uniqOverSoXSynthN45GS :: Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> Vector Int
-> String
-> Vector Float
-> IO ()
uniqOverSoXSynthN45GS Int
n Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts Vector Int
v3 String
vs = Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> IO ()
uniqOverSoXSynthN45G Int
n Float
ampL Float
dAmpl (String -> Float -> Vector Float
str2Durations String
zs Float
time3) String
wws String
tts (Vector Int -> String -> Vector Int
intervalsFromStringG Vector Int
v3 String
vs) 

-- | Variant of the 'uniqOverSoXSynthN46G' where 'Strengths' are obtained from the 'String' using 'str2Volume' function. Helps to create a speech-like 
-- composition.
uniqOverSoXSynthN46GS :: Int -> Float -> Float -> Float -> String -> String -> String -> Intervals -> String -> V.Vector Float -> String ->
  Float -> IO ()
uniqOverSoXSynthN46GS :: Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> Vector Int
-> String
-> Vector Float
-> String
-> Float
-> IO ()
uniqOverSoXSynthN46GS Int
n Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts Vector Int
v3 String
vs Vector Float
vec0 String
xxs Float
limV = Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthN46G Int
n Float
ampL Float
dAmpl (String -> Float -> Vector Float
str2Durations String
zs Float
time3) String
wws String
tts 
  (Vector Int -> String -> Vector Int
intervalsFromStringG Vector Int
v3 String
vs) Vector Float
vec0 (String -> Vector Float
str2Volume String
xxs) Float
limV

-- | A variant of 'uniqOverSoXSynthN46GS' where 'Strengths' and 'Durations' are obtained from the same Ukrainian text specified as 
-- the last 'String' argument. The second 'Float' 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@.
uniqOverSoXSynthN46GSu :: Int -> Float -> Float -> Float -> String -> String -> Intervals -> String -> V.Vector Float -> String -> Float -> IO ()
uniqOverSoXSynthN46GSu :: Int
-> Float
-> Float
-> Float
-> String
-> String
-> Vector Int
-> String
-> Vector Float
-> String
-> Float
-> IO ()
uniqOverSoXSynthN46GSu Int
n Float
ampL Float
time3 Float
dAmpl String
wws String
tts Vector Int
v5 String
vs Vector Float
vec0 String
xxs Float
limV = 
 Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthN46G Int
n Float
ampL Float
dAmpl (String -> Float -> Vector Float
str2Durations String
xxs Float
time3) String
wws String
tts (Vector Int -> String -> Vector Int
intervalsFromStringG Vector Int
v5 String
vs) Vector Float
vec0 (String -> Vector Float
str2Volume String
xxs) Float
limV

-- | 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 'Float' 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 the maximum ones, otherwise they are multiplied by the parameter and this results in their becoming more silent ones.
-- The second 'Float' argument is a basic sound duration. The default one is 0.5 (second). Please, check before executing
-- whether there is no \"x.wav\", \"test*\", \"result*\" and \"end.wav\" files in the current directory, because they can be overwritten.
--
-- For better usage the 'FilePath' should be a filepath for the .wav file.
uniqOverSoXSynthNGen :: FilePath -> Int -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGen :: String -> Int -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGen String
file Int
m = String -> Int -> Int -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGenE String
file Int
m Int
12

-- | Similar to 'uniqOverSoXSynthNGen', but uses additional second 'Int' parameter. It defines, to which n-th elements set (see 'nkyT') belongs the obtained
-- higher notes in the intervals. If that parameter equals to 12, then the function is practically equivalent to 'uniqOverSoXSynthNGen'. To obtain
-- its modifications, please, use 2, 3, 4, 6, or 9. 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@.
uniqOverSoXSynthNGenE :: FilePath -> Int -> Int -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGenE :: String -> Int -> Int -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGenE String
file Int
m Int
ku Float
ampL Float
time3 String
zs String
wws = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGenEPar :: String -> Params -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGenEPar String
file Params
params Float
ampL Float
time3 String
zs String
wws = do
  n <- String -> IO Int
duration1000 String
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@.
uniqOverSoXSynthNGenE4GS :: FilePath -> Int -> Int -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGenE4GS :: String -> Int -> Int -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGenE4GS String
file Int
m Int
ku Float
ampL Float
time3 String
zs String
wws = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGenE4GSPar :: String -> Params -> Float -> Float -> String -> String -> IO ()
uniqOverSoXSynthNGenE4GSPar String
file Params
params Float
ampL Float
time3 String
zs String
wws = do
  n <- String -> IO Int
duration1000 String
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@.
unGenNE4Gi :: Int -> FilePath -> Int -> Int -> Float -> Durations -> String -> IO ()
unGenNE4Gi :: Int
-> String -> Int -> Int -> Float -> Vector Float -> String -> IO ()
unGenNE4Gi Int
n String
file Int
m Int
ku Float
ampL Vector Float
v2 String
wws = do
  vecA <- String -> Int -> IO (Vector Int)
freqsFromFile String
file Int
n
  let vecB = Int -> Int -> Vector Float -> Vector Float
liftInEnkuV Int
m Int
ku (Vector Float -> Vector Float)
-> (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> Vector a -> Vector b
V.map Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Int -> Vector Float)
-> (Vector Int -> Vector Int) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Bool) -> Vector Int -> Vector Int
forall a. (a -> Bool) -> Vector a -> Vector a
V.filter (Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
/= (Int
11440::Int)) (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> a -> b
$ Vector Int
vecA
  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 -> Float -> Durations -> String -> IO ()
unGenNE4GiPar :: Int -> String -> Params -> Float -> Vector Float -> String -> IO ()
unGenNE4GiPar Int
n String
file Params
params Float
ampL Vector Float
v2 String
wws = do
  vecA <- String -> Int -> IO (Vector Int)
freqsFromFile String
file Int
n
  let vecB = Params -> Vector Float -> Vector Float
liftInParamsV Params
params (Vector Float -> Vector Float)
-> (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> Vector a -> Vector b
V.map Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> a -> b
$ Vector Int
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 -> Float -> Durations -> String -> IO ()
uniqOverSoXSynthNGenE4G :: String -> Int -> Int -> Float -> Vector Float -> String -> IO ()
uniqOverSoXSynthNGenE4G String
file Int
m Int
ku Float
ampL Vector Float
v2 String
wws = do
  n <- String -> IO Int
duration1000 String
file
  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 -> Float -> Durations -> String -> IO ()
uniqOverSoXSynthNGenE4GPar :: String -> Params -> Float -> Vector Float -> String -> IO ()
uniqOverSoXSynthNGenE4GPar String
file Params
params Float
ampL Vector Float
v2 String
wws = do
  n <- String -> IO Int
duration1000 String
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 'Float' 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 the maximum ones, otherwise they are multiplied by the parameter and this results in their becoming more silent ones.
-- The second 'Float' argument is a basic sound duration. The default one is 0.5 (second). Please, check before executing
-- whether there is no \"x.wav\", \"test*\", \"result*\" and \"end.wav\" files in the current directory, because they can be overwritten.
--
-- For better usage the 'FilePath' should be a filepath for the .wav file.
-- The third 'String' argument is used to define signs of the harmonics coefficients in the generated sounds.
uniqOverSoXSynthNGen3 :: FilePath -> Int -> Float -> Float -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen3 :: String
-> Int -> Float -> Float -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen3 String
file Int
m = String
-> Int
-> Int
-> Float
-> Float
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen3E String
file Int
m Int
12

-- | Similar to 'uniqOverSoXSynthNGen3', but uses additional second 'Int' parameter. It defines, to which n-th elements set (see 'nkyT') belongs the obtained
-- higher notes in the intervals. If that parameter equals to 12, then the function is practically equivalent to 'uniqOverSoXSynthNGen3'. To obtain
-- its modifications, please, use 2, 3, 4, 6, or 9. 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@.
uniqOverSoXSynthNGen3E :: FilePath -> Int -> Int -> Float -> Float -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen3E :: String
-> Int
-> Int
-> Float
-> Float
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen3E String
file Int
m Int
ku Float
ampL Float
time3 String
zs String
wws String
tts = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen3EPar :: String
-> Params -> Float -> Float -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen3EPar String
file Params
params Float
ampL Float
time3 String
zs String
wws String
tts = do
  n <- String -> IO Int
duration1000 String
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@.
uniqOverSoXSynthNGen3E4GS :: FilePath -> Int -> Int -> Float -> Float -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen3E4GS :: String
-> Int
-> Int
-> Float
-> Float
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen3E4GS String
file Int
m Int
ku Float
ampL Float
time3 String
zs String
wws String
tts = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen3E4GSPar :: String
-> Params -> Float -> Float -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen3E4GSPar String
file Params
params Float
ampL Float
time3 String
zs String
wws String
tts = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Durations -> String -> String -> IO ()
unGenN3E4Gi :: Int
-> String
-> Int
-> Int
-> Float
-> Vector Float
-> String
-> String
-> IO ()
unGenN3E4Gi Int
n String
file Int
m Int
ku Float
ampL Vector Float
v2 String
wws String
tts = do
  vecA <- String -> Int -> IO (Vector Int)
freqsFromFile String
file Int
n
  let vecB = Int -> Int -> Vector Float -> Vector Float
liftInEnkuV Int
m Int
ku (Vector Float -> Vector Float)
-> (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> Vector a -> Vector b
V.map Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Int -> Vector Float)
-> (Vector Int -> Vector Int) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Bool) -> Vector Int -> Vector Int
forall a. (a -> Bool) -> Vector a -> Vector a
V.filter (Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
/= (Int
11440::Int)) (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> a -> b
$ Vector Int
vecA
  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 -> Float -> Durations -> String -> String -> IO ()
unGenN3E4GiPar :: Int
-> String
-> Params
-> Float
-> Vector Float
-> String
-> String
-> IO ()
unGenN3E4GiPar Int
n String
file Params
params Float
ampL Vector Float
v2 String
wws String
tts = do
  vecA <- String -> Int -> IO (Vector Int)
freqsFromFile String
file Int
n
  let vecB = Params -> Vector Float -> Vector Float
liftInParamsV Params
params (Vector Float -> Vector Float)
-> (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> Vector a -> Vector b
V.map Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> a -> b
$ Vector Int
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 -> Float -> Durations -> String -> String -> IO ()
uniqOverSoXSynthNGen3E4G :: String
-> Int -> Int -> Float -> Vector Float -> String -> String -> IO ()
uniqOverSoXSynthNGen3E4G String
file Int
m Int
ku Float
ampL Vector Float
v2 String
wws String
tts = do
  n <- String -> IO Int
duration1000 String
file
  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 -> Float -> Durations -> String -> String -> IO ()
uniqOverSoXSynthNGen3E4GPar :: String
-> Params -> Float -> Vector Float -> String -> String -> IO ()
uniqOverSoXSynthNGen3E4GPar String
file Params
params Float
ampL Vector Float
v2 String
wws String
tts = do
  n <- String -> IO Int
duration1000 String
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]).
-- The first 'Float' 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 the maximum ones, otherwise they are multiplied by the parameter and this results in their becoming more silent ones.
-- The second 'Float' argument is a basic sound duration. The default one is 0.5 (second). Please, check before executing
-- whether there is no \"x.wav\", \"test*\", \"result*\" and \"end.wav\" files in the current directory, because they can be overwritten.
--
-- For better usage the 'FilePath' should be a filepath for the .wav file.
-- The third 'String' argument is used to define signs of the harmonics coefficients in the generated sounds.
-- The fourth 'String' argument is used to define the intervals for the notes if any.
-- The third 'Float' parameter basically is used to define in how many times the volume for the second lower note is less than the volume of
-- the main note. If it is rather great, it can signal that the volume for the second note overTones are greater than for the main note obetones.
-- The last one is an experimental feature.
uniqOverSoXSynthNGen4 :: FilePath -> Int -> Float -> Float -> Float -> String -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen4 :: String
-> Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen4 String
file Int
m = String
-> Int
-> Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen4E String
file Int
m Int
12

-- | Similar to 'uniqOverSoXSynthNGen4', but uses additional second 'Int' parameter. It defines, to which n-th elements set (see 'nkyT') belongs the obtained
-- higher notes in the intervals. If that parameter equals to 12, then the function is practically equivalent to 'uniqOverSoXSynthNGen4'. To obtain
-- its modifications, please, use 2, 3, 4, 6, or 9. 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@.
uniqOverSoXSynthNGen4E :: FilePath -> Int -> Int -> Float -> Float -> Float -> String -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen4E :: String
-> Int
-> Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen4E String
file Int
m Int
ku Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts String
vs = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> Float -> String -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen4EPar :: String
-> Params
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen4EPar String
file Params
params Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts String
vs = do
  n <- String -> IO Int
duration1000 String
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@.
uniqOverSoXSynthNGen4E4GS :: FilePath -> Int -> Int -> Float -> Float -> Float -> String -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen4E4GS :: String
-> Int
-> Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen4E4GS String
file Int
m Int
ku Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts String
vs = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> Float -> String -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen4E4GSPar :: String
-> Params
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen4E4GSPar String
file Params
params Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts String
vs = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> Durations -> String -> String -> String -> IO ()
unGenN4E4Gi :: Int
-> String
-> Int
-> Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> String
-> IO ()
unGenN4E4Gi Int
n String
file Int
m Int
ku Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts String
vs = do
  vecA <- String -> Int -> IO (Vector Int)
freqsFromFile String
file Int
n
  let vecB = Int -> Int -> Vector Float -> Vector Float
liftInEnkuV Int
m Int
ku (Vector Float -> Vector Float)
-> (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> Vector a -> Vector b
V.map Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Int -> Vector Float)
-> (Vector Int -> Vector Int) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Bool) -> Vector Int -> Vector Int
forall a. (a -> Bool) -> Vector a -> Vector a
V.filter (Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
/= (Int
11440::Int)) (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> a -> b
$ Vector Int
vecA
  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 -> Float -> Float -> Durations -> String -> String -> String -> IO ()
unGenN4E4GiPar :: Int
-> String
-> Params
-> Float
-> Float
-> Vector Float
-> String
-> String
-> String
-> IO ()
unGenN4E4GiPar Int
n String
file Params
params Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts String
vs = do
  vecA <- String -> Int -> IO (Vector Int)
freqsFromFile String
file Int
n
  let vecB = Params -> Vector Float -> Vector Float
liftInParamsV Params
params (Vector Float -> Vector Float)
-> (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> Vector a -> Vector b
V.map Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> a -> b
$ Vector Int
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 -> Float -> Float -> Durations -> String -> String -> Intervals -> IO ()
unGenN4E5Gi :: Int
-> String
-> Int
-> Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> IO ()
unGenN4E5Gi Int
n String
file Int
m Int
ku Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 = do
  vecA <- String -> Int -> IO (Vector Int)
freqsFromFile String
file Int
n
  let vecB = Int -> Int -> Vector Float -> Vector Float
liftInEnkuV Int
m Int
ku (Vector Float -> Vector Float)
-> (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> Vector a -> Vector b
V.map Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Int -> Vector Float)
-> (Vector Int -> Vector Int) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Bool) -> Vector Int -> Vector Int
forall a. (a -> Bool) -> Vector a -> Vector a
V.filter (Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
/= (Int
11440::Int)) (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> a -> b
$ Vector 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 -> Float -> Float -> Durations -> String -> String -> Intervals -> IO ()
unGenN4E5GiPar :: Int
-> String
-> Params
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> IO ()
unGenN4E5GiPar Int
n String
file Params
params Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 = do
  vecA <- String -> Int -> IO (Vector Int)
freqsFromFile String
file Int
n
  let vecB = Params -> Vector Float -> Vector Float
liftInParamsV Params
params (Vector Float -> Vector Float)
-> (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> Vector a -> Vector b
V.map Int -> Float
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector Int -> Vector Float) -> Vector Int -> Vector Float
forall a b. (a -> b) -> a -> b
$ Vector Int
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@.
uniqOverSoXSynthNGen4E4G :: FilePath -> Int -> Int -> Float -> Float -> Durations -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen4E4G :: String
-> Int
-> Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen4E4G String
file Int
m Int
ku Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts String
vs = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> Durations -> String -> String -> String -> IO ()
uniqOverSoXSynthNGen4E4GPar :: String
-> Params
-> Float
-> Float
-> Vector Float
-> String
-> String
-> String
-> IO ()
uniqOverSoXSynthNGen4E4GPar String
file Params
params Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts String
vs = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> Durations -> String -> String -> Intervals -> IO ()
uniqOverSoXSynthNGen4E5G :: String
-> Int
-> Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> IO ()
uniqOverSoXSynthNGen4E5G String
file Int
m Int
ku Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> Durations -> String -> String -> Intervals -> IO ()
uniqOverSoXSynthNGen4E5GPar :: String
-> Params
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> IO ()
uniqOverSoXSynthNGen4E5GPar String
file Params
params Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 = do
  n <- String -> IO Int
duration1000 String
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@.
uniqOverSoXSynthNGen4E5GS :: FilePath -> Int -> Int -> Float -> Float -> Float -> String -> String -> String -> Intervals -> String -> IO ()
uniqOverSoXSynthNGen4E5GS :: String
-> Int
-> Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> Vector Int
-> String
-> IO ()
uniqOverSoXSynthNGen4E5GS String
file Int
m Int
ku Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts Vector Int
v3 String
vs = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> Float -> String -> String -> String -> Intervals -> String -> IO ()
uniqOverSoXSynthNGen4E5GSPar :: String
-> Params
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> Vector Int
-> String
-> IO ()
uniqOverSoXSynthNGen4E5GSPar String
file Params
params Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts Vector Int
v3 String
vs = do
  n <- String -> IO Int
duration1000 String
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 -> Float -> Float -> Durations -> String -> String -> Intervals -> Strengths -> Float -> IO ()
uniqOverSoXSynthNGen4E6G :: String
-> Int
-> Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6G String
file Int
m Int
ku Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 Vector Float
v6 Float
limV = 
 String
-> Int
-> Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> IO ()
uniqOverSoXSynthNGen4E5G String
file Int
m Int
ku Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Vector Float -> String -> String -> Float -> IO ()
apply6G2 Vector Float
v6 String
"221w" String
"result" Float
limV IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IO ()
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 -> Float -> Float -> Durations -> String -> String -> Intervals -> Strengths -> Float -> IO ()
uniqOverSoXSynthNGen4E6GPar :: String
-> Params
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6GPar String
file Params
params Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 Vector Float
v6 Float
limV = 
 String
-> Params
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> IO ()
uniqOverSoXSynthNGen4E5GPar String
file Params
params Float
ampL Float
dAmpl Vector Float
v2 String
wws String
tts Vector Int
v3 IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Vector Float -> String -> String -> Float -> IO ()
apply6G2 Vector Float
v6 String
"221w" String
"result" Float
limV IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IO ()
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 -> Float -> Float -> Float -> String -> String -> String -> Intervals -> String -> 
  String -> Float -> IO ()
uniqOverSoXSynthNGen4E6GS :: String
-> Int
-> Int
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> Vector Int
-> String
-> String
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6GS String
file Int
m Int
ku Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts Vector Int
v5 String
vs String
xxs Float
limV = 
 String
-> Int
-> Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6G String
file Int
m Int
ku Float
ampL Float
dAmpl (String -> Float -> Vector Float
str2Durations String
zs Float
time3) String
wws String
tts (Vector Int -> String -> Vector Int
intervalsFromStringG Vector Int
v5 String
vs) (String -> Vector Float
str2Volume String
xxs) Float
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 -> Float -> Float -> Float -> String -> String -> String -> Intervals -> String -> 
  String -> Float -> IO ()
uniqOverSoXSynthNGen4E6GSPar :: String
-> Params
-> Float
-> Float
-> Float
-> String
-> String
-> String
-> Vector Int
-> String
-> String
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6GSPar String
file Params
params Float
ampL Float
time3 Float
dAmpl String
zs String
wws String
tts Vector Int
v5 String
vs String
xxs Float
limV = 
 String
-> Params
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6GPar String
file Params
params Float
ampL Float
dAmpl (String -> Float -> Vector Float
str2Durations String
zs Float
time3) String
wws String
tts (Vector Int -> String -> Vector Int
intervalsFromStringG Vector Int
v5 String
vs) (String -> Vector Float
str2Volume String
xxs) Float
limV 
 
-- | A variant of 'uniqOverSoXSynthNGen4E6GS' where 'Strengths' and 'Durations' are obtained from the same Ukrainian text specified as 
-- the last 'String' argument. The second 'Float' 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@.
uniqOverSoXSynthNGen4E6GSu :: FilePath -> Int -> Int -> Float -> Float -> Float -> String -> String -> Intervals -> String -> String -> Float -> IO ()
uniqOverSoXSynthNGen4E6GSu :: String
-> Int
-> Int
-> Float
-> Float
-> Float
-> String
-> String
-> Vector Int
-> String
-> String
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6GSu String
file Int
m Int
ku Float
ampL Float
time3 Float
dAmpl String
wws String
tts Vector Int
v5 String
vs String
xxs Float
limV = 
 String
-> Int
-> Int
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6G String
file Int
m Int
ku Float
ampL Float
dAmpl (String -> Float -> Vector Float
str2Durations String
xxs Float
time3) String
wws String
tts (Vector Int -> String -> Vector Int
intervalsFromStringG Vector Int
v5 String
vs) (String -> Vector Float
str2Volume String
xxs) Float
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 -> Float -> Float -> Float -> String -> String -> Intervals -> String -> String -> Float -> IO ()
uniqOverSoXSynthNGen4E6GSuPar :: String
-> Params
-> Float
-> Float
-> Float
-> String
-> String
-> Vector Int
-> String
-> String
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6GSuPar String
file Params
params Float
ampL Float
time3 Float
dAmpl String
wws String
tts Vector Int
v5 String
vs String
xxs Float
limV = 
 String
-> Params
-> Float
-> Float
-> Vector Float
-> String
-> String
-> Vector Int
-> Vector Float
-> Float
-> IO ()
uniqOverSoXSynthNGen4E6GPar String
file Params
params Float
ampL Float
dAmpl (String -> Float -> Vector Float
str2Durations String
xxs Float
time3) String
wws String
tts (Vector Int -> String -> Vector Int
intervalsFromStringG Vector Int
v5 String
vs) (String -> Vector Float
str2Volume String
xxs) Float
limV