-- |
-- Module      :  Main
-- Copyright   :  (c) OleksandrZhabenko 2019-2020
-- License     :  MIT
-- Maintainer  :  olexandr543@yahoo.com
--
-- A program and a library that can be used as a musical instrument synthesizer or for Ukrainian speech synthesis
-- especially for poets, translators and writers.
--

module Main where

import System.Environment (getArgs)
import Melodics.Executable.Arr

{-
-- Inspired by: https://mail.haskell.org/pipermail/beginners/2011-October/008649.html
-}

-- | The function creates a raw PCM sound file with bitrate 22050 Hz 1 mono channel 16-bit signed-integer encoding
-- and tries to automatically convert it to the .wav, .ogg, or .flac file with the same parameters specified by the first command line argument
-- (for more details see: 'genControl' function) using the system binary SoX (this is done for one circle of running, afterwards it is repeated
-- with the same command line arguments. To stop execution, please, interrupt the program e. g. with Ctrl + C on many Unix platforms).
-- So actually, it can create multiple sound files, all in the same format options specified by the first command line argument accordingly to
-- the 'genControl' function.
--
-- If SoX binaries are not installed properly, the program makes ending informational message for the user.
--
-- The command line argument is described in more details in the documentation for the 'Melodics.Ukrainian.nSymbols' function.
--
-- The best comression ratio is with the .ogg files, but they lose some quality so be careful if you need it.
main :: IO ()
main = do
  zs <- fmap (concat . take 1) getArgs
  circle zs