Easy Voice Script under Linux

Sound packs for the new audio mods
Post Reply
zector
Posts: 15
Joined: Thu Jan 17, 2013 7:14 pm
Country: -

Easy Voice Script under Linux

Post by zector »

After playing some, I made a script with festival under linux.

Here is the script:

Code: Select all

#!/bin/bash
#

# install festival
# install this nice voice:
#sudo apt-get install festlex-cmu
#cd /usr/share/festival/voices/english/
#sudo wget -c http://www.speech.cs.cmu.edu/cmu_arctic/packed/cmu_us_clb_arctic-0.95-release.tar.bz2
#sudo tar jxf cmu_us_clb_arctic-0.95-release.tar.bz2 
#sudo ln -s cmu_us_clb_arctic cmu_us_clb_arctic_clunits
#sudo cp /etc/festival.scm /etc/festival.scm.backup
#sudo echo "(set! voice_default 'voice_cmu_us_clb_arctic_clunits)" >> /etc/festival.scm
#echo "This is a test." | festival --tts
#rm /usr/share/festival/voices/english/cmu_us_clb_arctic-0.95-release.tar.bz2
# need this for CMU files apt install festlex-cmu
#info from http://ubuntuforums.org/showthread.php?t=677277
# more info http://ubuntuforums.org/showthread.php?t=751169

# Variables

# Available Voices Installed
# cmu_us_slt_arctic_clunits
# us2_mbrola
# en1_mbrola
# us1_mbrola
# cmu_us_bdl_arctic_clunits
# cmu_us_jmk_arctic_clunits
# rab_diphone
# us3_mbrola
# cmu_us_awb_arctic_clunits
# ked_diphone
# kal_diphone
# cmu_us_clb_arctic_clunits
# cmu_us_ksp_arctic_clunits
# cmu_us_rms_arctic_clunits

VOICE="cmu_us_clb_arctic_clunits"

# string used to set voice -eval (voice_XXXXXXXX)
# string used to set volume -scale (1-100)
VOICEVOLUME="4"

VOICESTRING="-eval (voice_"$VOICE") -scale "$VOICEVOLUME

INPUTFILE="phrases.txt"
NEWFOLDER=`date +%F-%H:%M`-$VOICE

#output some info
echo "Creating voices from " $INPUTFILE ", and saving it into a new folder ./" $NEWFOLDER ". Voice list copied to " $NEWFOLDER"/VoiceList.txt"
mkdir $NEWFOLDER
# Put a copy of the phrase file into folder
cp $INPUTFILE $NEWFOLDER/VoiceList.txt
 
# Do some work!
while IFS=$'\t' read -r -a myArray
do
	if [[ ${myArray[0]} && ${myArray[1]} ]]; then
		echo "Creating file - " $NEWFOLDER"/"${myArray[0]}".wav With Text: " ${myArray[1]}
		echo ${myArray[1]} | text2wave $VOICESTRING >$NEWFOLDER"/"${myArray[0]}.wav
	else
		echo "Missing Data for line: " ${myArray[0]}
	fi
done < $INPUTFILE
And here is the phrases.txt, customize away:

Code: Select all

0000	Zero
0001	One
0002	Two
0003	Three
0004	Four
0005	Five
0006	Point zero
0007	Point one
0008	Point two
0009	Point three
0010	Point four
0011	Point five
0012	Point six
0013	Point seven
0014	Point eight
0015	Point nine
0021	Warning
0022	Error
0023	Alert
0024	Feet
0025	Foot
0026	
0027	
0028	Helo Arron. Welcome to ER9X with FR SKY Support. Try not to crash your shiit this time.
0029	Limit
0030	RPM
0031	Flight Battery Low
0032	Radio Voltage
0033	Current
0034	Altitude
0035	Point
0036	Volts
0037	Volt
0038	Minutes
0039	Minute
0040	Pack Voltage
0041	30 Seconds
0042	20 Seconds
0043	10 Seconds
0044	Percent
0045	Inactive ellarm Have you forgotten about me Arron?
0046	Radio Battery Low
0047	Degrees
0048	Degree
0049	Receiver Voltage
0050	Temperature
0051	Amps
0052	Amp
0053	Seconds
0054	Second
0055	DB
0056	Meters
0057	Meter
0058	No Telemetry
0059	
0060	
0061	
0062	
0063	
0064	
0065	
0066	
0067	
0068	
0069	
0070	Recieve Signal Alert
0071	Transmit Signal Alert
0072	
0073	
0074	
0075	
0076	
0077	
0078	
0079	
0080	
0081	
0082	
0083	
0084	
0085	
0086	
0087	
0088	
0089	
0090	
0091	
0092	
0093	
0094	
0095	
0096	
0097	
0098	
0099	
0100	Hundred
0101 	1 Hundred
0102	2 Hundred
0103	3 Hundred
0104	4 Hundred
0105	5 Hundred
0106	6 Hundred
0107	7 Hundred
0108	8 Hundred
0109 	9 Hundred
0110	Thousand
0111	1 Thousand
0112	2 Thousand
0113	3 Thousand
0114	4 Thousand
0115	5 Thousand
0116	6 Thousand
0117	7 Thousand
0118	8 Thousand
0119	9 Thousand
0120	10 Thousand
0121	11 Thousand
0122	12 Thousand
0123	13 Thousand
0124	14 Thousand
0125	15 Thousand
0126	16 Thousand
0127	17 Thousand
0128	18 Thousand
0129	19 Thousand
0130	20 Thousand
0131	
0132	
0133	Throttle-Cut Inactive
0134	Throttle-Cut Active
0135	
0136	Pilot Assist Disabled
0137	Pilot Assist Enabled
0138	Return To Home
0139	Please disable Pilot Assist
0140	
0141	Flaps Up
0142	Flaps Down
0143	
0144	Flaps Up
0145	Flaps 1
0146	Flaps 2
0147	Flaps 1
0148	Throttle Enabled
0149	Throttle Disabled
0150	Gear Up
0151	Gear Down
0152	Lights On
0153	Lights Off
0154	Beacon On
0155	Beacon Off
0156	Strobe On
0157	Strobe Off
0158	Throttle Hold Inactive
0159	Throttle Hold Active
0160	Throttle-Cut Active
0161	Throttle-Cut Inactive
0162	Aileron Rate Low
0163	
0164	Aaleron Rate High
0165	Elevator Rate Low
0166	
0167	Elevator Rate High
0168	
0169	
0170	
0171				
0172	
0173	
0174	
0175	
0176	
0177	
0178	
0179	
0180	
0181	
0182	
0183	
0184	
0185	
0186	
0187	
0188	
0189	
0190	
0191	
0192	
0193	
0194	
0195	
0196	
0197	
0198	
0199	
0200	
0260	Easy Star
0261	Pico Cub
0262	Extra Hypeerion
0263	Tri copter
0264	Extra L E K I
0265	Bixler 2  FPV
0266	Arrons Crazy Hexacopter
0265	
0266	
0267	
0268	
0269	
0270	
0400	0
0401	1
0402	2
0403	3
0404	4
0405	5
0406	6
0407	7
0408	8
0409	9
0410	10
0411	11
0412	12
0413	13
0414	14
0415	15
0416	16
0417	17
0418	18
0419	19
0420	20
0421	21
0422	22
0423	23
0424	24
0425	25
0426	26
0427	27
0428	28
0429	29
0430	30
0431	31
0432	32
0433	33
0434	34
0435	35
0436	36
0437	37
0438	38
0439	39
0440	40
0441	41
0442	42
0443	43
0444	44
0445	45
0446	46
0447	47
0448	48
0449	49
0450	50
0451	51
0452	52
0453	53
0454	54
0455	55
0456	56
0457	57
0458	58
0459	59
0460	60
0461	61
0462	62
0463	63
0464	64
0465	65
0466	66
0467	67
0468	68
0469	69
0470	70
0471	71
0472	72
0473	73
0474	74
0475	75
0476	76
0477	77
0478	78
0479	79
0480	80
0481	81
0482	82
0483	83
0484	84
0485	85
0486	86
0487	87
0488	88
0489	89
0490	90
0491	91
0492	92
0493	93
0494	94
0495	95
0496	96
0497	97
0498	98
0499	99
Works great on my megasound9x. Voice is ok, ive played with some different ones and like this one best. But quick and easy way to make your own voices.

Happy crashing!

User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Easy Voice Script under Linux

Post by jhsa »

Helo Arron. Welcome to ER9X with FR SKY Support. Try not to crash your shiit this time.
:mrgreen: :mrgreen: :mrgreen:
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Easy Voice Script under Linux

Post by jhsa »

Ok, for the common mortal that just started with linux (ubuntu studio) ;) , how do we use this? What do we have to do with that info?

Thanks

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Easy Voice Script under Linux

Post by rperkins »

Cool. So if i understand this correctly. It takes a text file and creates audio samples in a format utilized by our 9x firmware. Can you get it to say ' there goes $20 in spare parts' and ' how many times you gonna drive that heli straight into the ground' :)
zector
Posts: 15
Joined: Thu Jan 17, 2013 7:14 pm
Country: -

Re: Easy Voice Script under Linux

Post by zector »

Yes it will make a sound file named by the first number, then *TAB* the text to sound and save it. There is a bunch of free and easy to install voices.

Under Ubuntu Very simple, make sure you have your updates first:

Code: Select all

sudo apt install festival festlex-cmu festvox-en1 festvox-us1 festvox-us2 festvox-us3 festvox-kallpc16k festvox-kdlpc16k festvox-rablpc16k 
This will give you a bunch of usable voices. To add some more (I like CLB best) do this (but not needed, try some of the above voices first)

Code: Select all

cd /usr/share/festival/voices/english/
sudo wget -c http://www.speech.cs.cmu.edu/cmu_arctic/packed/cmu_us_clb_arctic-0.95-release.tar.bz2
sudo tar jxf cmu_us_clb_arctic-0.95-release.tar.bz2 
sudo ln -s cmu_us_clb_arctic cmu_us_clb_arctic_clunits
Then you can use the clb voice, I like it best so far. The info how to do this is in the script, with a couple links. To use the script, save the code to a file, then from prompt run "chmod +x **whateveryousavedthescriptto**" Save the other code to a file called phrases.txt in the same folder. Welcome to Linux, all i run now is Linux Mint (Ubuntu based).

You can add whatever lines to the txt file, makes it easy to make a new set, or try voices. I have already added RTH enabled, and a few others quickly and easily. There is a volume setting in there too.

You may need to play with the spelling of some words to make it sound right. running festival from the prompt can test it.

rperkins - it will say whatever you like. i.e. line 0028 :shock:
jhsa - maybe i should of trimmed the file some... :D

User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Easy Voice Script under Linux

Post by gohsthb »

I don't know if it was my text editor, or the way the files copied from the forum. But it didn't work for me. I was able to fix it, and here are the files I can now use. There are 3 files. First is installPackages.sh. Run this file to install all of the dependencies, and the extra voices. Next is the phrases.txt file, this is a listing of what the sound files will be. And finally the mkSounds.sh, this is the script that creates the sound files.
-Gohst
Last edited by gohsthb on Sun Mar 10, 2013 7:47 pm, edited 1 time in total.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Easy Voice Script under Linux

Post by rperkins »

line 28 :lol:

I'm afraid to get started down this path. I see hours of time playing around, modding my 9x, installing all the sounds. :)
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Easy Voice Script under Linux

Post by jhsa »

sudo apt install festival festlex-cmu festvox-en1 festvox-us1 festvox-us2 festvox-us3 festvox-kallpc16k festvox-kdlpc16k festvox-rablpc16k
When I insert this in terminal, it doesn't work.. It says "sudo: apt: command not found"
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Easy Voice Script under Linux

Post by rperkins »

he meant to say apt-get where he just said apt. I did not actually run this command so there may be other errors. I did look at gohsthb's script, he has it correctly in his, you may want to try out his work.

Code: Select all

sudo apt-get install festival festlex-cmu festvox-en1 festvox-us1 festvox-us2 festvox-us3 festvox-kallpc16k festvox-kdlpc16k festvox-rablpc16k 
User avatar
tilmanb
Posts: 347
Joined: Thu Oct 11, 2012 9:36 pm
Country: Germany
Location: Karlsruhe, Germany

Re: Easy Voice Script under Linux

Post by tilmanb »

Its apt-get
But I don't want to encourage running commands as root (that is what sudo does) if you don't know what they do.

There I'd so much bad advice being given by beginners on the net, especially in the Ubuntu scene, that I would always advise to be sceptical first.
Above commands are certainly not written up in a way that they can just be hacked in a terminal. It's good Unix prosa though.
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Easy Voice Script under Linux

Post by gohsthb »

Forgot to mention, my system is running xubuntu 12.04. The script should work on any system with apt-get.
Finding the apt-get problem was easy. I figured that was just a typing error. The main problem I had was no tabs in the text file. So I changed it to look for spaces. And I prefer posting things that work when I say they will. I test what I post so it is not likely to cause the end user problems.
-Gohst

Sent from my LG-P999 using Tapatalk 2
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Easy Voice Script under Linux

Post by jhsa »

Well, downloaded Gohsthb's files, extracted, right click on install and select execute, nothing happens..
What is this noob doing wrong? ;)
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Easy Voice Script under Linux

Post by gohsthb »

Use a terminal window for one. You might have to run "chmod u+x *.sh" to make the scripts executable. At least in the terminal you will get the error messages.
-Gohst
zector
Posts: 15
Joined: Thu Jan 17, 2013 7:14 pm
Country: -

Re: Easy Voice Script under Linux

Post by zector »

Sorry, i run mint, it uses apt, which is a smart script that includes apt-get and a few others in one. as for the tabs, sorry it didnt paste in well.

running sudo apt-get is safe as long as you are installing an app from the repository, which is the ubuntu software database. when you get in trouble is when someone gives you a link to a .deb, or other software package, tell you to download it then install from the prompt. Be careful of that, just like downloading a windows program from some sight. apt-get gets the software from the ubuntu servers, so its safe. otherwise you should never really have the need to run sudu. Mint's apt script does this work for you, so i never run sudo at all. Mint is really worth a look, its ubuntu based and comes out of the box with some nice stuff setup, and easier to use from day 1. It is the most popular distro according to distrowatch.com
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Easy Voice Script under Linux

Post by jhsa »

Well, guess what.. ;) I managed to make it work.. Being a windows user for many years, I just opened a terminal on the folder where the install.sh file is, then dragged it into the terminal window and voilá. all installed.. then double clicked on the MKSounds.sh file and it created another folder with the wav files inside.. The problem is, many files are cut. for example the files supposed to say point one, point two, point 3, ect, only say point. the numbers are missing.. the file 10 seconds for example only plays 10..
Somehow is cropping the files to early

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Easy Voice Script under Linux

Post by gohsthb »

The script was only reading the first word of the message and sending that to festival. Fixed in this version. I should note there are 3 spaces between the number and what you want said. Exactly 3, no more no less, or it will skip that line.
-Gohst
Attachments
mkSounds.zip
(4.03 KiB) Downloaded 613 times
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Easy Voice Script under Linux

Post by jhsa »

yep. now it works.. can we select other voices?
or even better, can we adapt this to use other online TTS sites?
The quality is not so great and there are others with much more quality.. actually my latest sound pack was made using an online TTS site..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Easy Voice Script under Linux

Post by gohsthb »

To change the voice you need to change this line in mkSounds.sh

Code: Select all

VOICE="us1_mbrola"
Looking above that line will give you hints about what to set it too. :lol:
-Gohst
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Easy Voice Script under Linux

Post by jhsa »

Thanks.. :)
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
zector
Posts: 15
Joined: Thu Jan 17, 2013 7:14 pm
Country: -

Re: Easy Voice Script under Linux

Post by zector »

the script breaks the fields up by TAB not spaces. The text part can have as many spaces as you like. Perhaps when pasting in the phrases, auto replace replaced all the spaces with tabs.

You can see how it loads the array, breaking it up by tabs, or '\t' to load each field in the while statement. Linux has some crazy power when doing stuff in bash (prompt).
saijem
Posts: 82
Joined: Wed Sep 05, 2012 11:30 am
Country: -

Re: Easy Voice Script under Linux

Post by saijem »

Hello zector I'm saijem from Málaga (Spain) and I would like to make the waw files in spanish but I have been looking for the spanish voices and I can't find it, please can you look it for me ., I have linux in one 100 gb usb hard disk and unless I use windows 7, I like linux too. Please give me some help to put my two cents in the opentx project. I made the file phrases.txt in spanish and I'm waiting for your help. Thanks for it.

Best regards from Málaga (Spain)

Post Reply

Return to “Sound Pack Library”