-- |
-- Module : Main
-- Copyright : (c) OleksandrZhabenko 2019
-- License : MIT
--
-- Maintainer : olexandr543@yahoo.com
--
-- A program that can be used as a musical instrument synthesizer or for Ukrainian speech synthesis
-- especially for poets, translators and writers.
--
module Main where
--import Data.Maybe (isJust,fromJust)
import System.IO
import System.Environment
--import System.Process
--import EndOfExe
import Paths_mmsyn6ukr
import Melodics.Ukrainian
{-
-- Inspired by: https://mail.haskell.org/pipermail/beginners/2011-October/008649.html
-}
main :: IO ()
main = do
args <- getArgs
putStrLn "Please, specify the name of the resulting sound file! Please, do NOT use '}' character and space characters!"
nameOfSoundFile <- getLine
xs <- getContents
let ys = take (nSymbols (let zs = take 1 args in if null zs then [] else head zs)) xs in do
withBinaryFile (nameOfSoundFile ++ ".raw") AppendMode (appendS16LEFile (convertToProperUkrainian ys))
putStr "You have a resulting file, which name begins with \"new.\" in a raw PCM format with bitrate 22050 Hz and 1 channel (mono) in the .dat format. "
putStr "You can further process it by yourself manually, otherwise, please, install FFMpeg or LibAV executables in the directory mentioned in the variable PATH"
putStrLn " and then run: "
putStrLn "\"name_of_FFMpeg_or_LibAV_executable\" -f s16le -acodec pcm_s16le -ac 1 -ar 22050 -i \"name_Of_the_sound_file\" \"the_same_name_without_.dat_ending_and_with_.wav_ending\""