module Main (
main
) where
import Data.Maybe (isJust,fromJust)
import System.IO
import System.Environment
import System.Process
import EndOfExe
import Paths_mmsyn6ukr
import Melodics.Ukrainian
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
withBinaryFile (nameOfSoundFile ++ ".raw") AppendMode (appendS16LEFile (convertToProperUkrainian ys))
let ts = showE "sox" in if isJust ts
then callCommand $ fromJust ts ++ " -r22050 -c1 -L -e signed-integer -b16 " ++ nameOfSoundFile ++ ".raw " ++ nameOfSoundFile ++ ".wav"
else do
putStr "You have a resulting file in a raw PCM format with bitrate 22050 Hz and 1 channel (mono) in the .raw 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_.raw_ending_and_with_.wav_ending\""
putStrLn ""
putStrLn "OR you can install SoX executable in the directory mentioned in the variable PATH and then run: "
putStrLn "\"Path_to_the_SoX_executable\" -b16 -r22050 -c1 -e signed-integer -L \"name_of_the_file_in_raw_format_with_new._prefix\" \"name_of_the_file_in_raw_format_with_new._prefix\" in the terminal."