Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Friday, March 26, 2010

TTS (Text-to-Speech) Using Linux

Okey... TTS or Text to Speech is the system converts normal language text into speech. Speech synthesis is the artificial production of human speech. A computer system used for this purpose is called a speech synthesizer, and can be implemented in software or hardware

This Schema of TTS generally :

File:Festival TTS Telugu.jpg
for more information about TTS u can go to http://en.wikipedia.org/wiki/Speech_synthesis
Now at least we know how text can be converted to voice.

Let's Rock n Roll On LINUX
actually, you can use any LINUX Distro and I Use CENTOS 5.2 to implement TTS
here we go...
if you have install linux on your PC, you can go now to try TTS but if you have not install yet. i will wait you :P hehehe......
Okey....Now We install dependencies of TTS using gnome-terminal or shell (run as root)


1. yum install festival (for REDHAT-Based) / apt-get install festival (for Debian-Based)
festival is the speech synthesizer that developed by The University of Edinburgh


2. yum install text2wave (for REDHAT-Based) / apt-get install text2wave (for Debian-Based)
taxe2wave is text to wav converter based-on festival voice

3. Install lame :
- wget http://nchc.dl.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
- tar xvfz lame-3.98.4.tar.gz
- cd lame-3.98.4
- ./configure --prefix=/usr
- make
- make install
lame is wav to mp3 converter :D
4. Install PHP and Web Server (Optional: Just if you want to make a TTS Web-Based)
- yum install php5 httpd (for REDHAT-Based) / apt-get install php5 httpd (for Debian-Based)
PHP and Web Server for create web-based TTS



Now test festival running or not

$ echo hello world festival --tts (you will hear "Hello World")

$ nano myspeech.txt (write everything you wanna say)

$ festival --tts myspeech.txt (you will hear everything you wanna say)



Test text2wav

$text2wave myspeech.txt -o myspeech.wav (Now you will get wav file from text2wave )



Test lame

$lame myspeech.wav myspeech.mp3 (and you get mp3 file from lame you can play using totem in linux)



Okey....actually it's over if we just talking how can we convert text to audio file but if we want to try explore.

I will give u a simple source code for PHP front-end below


< html >
< body >
< form method="POST" >
< textarea name="text" cols="70" > < /textarea > < br / >
< input type="submit" >
< /form >
< ?php
error_reporting ( E_ALL );
ini_set ( 'display_errors', True );
if ( isset ( $_REQUEST['text'] ) ) {

//Directory OF WAV FILE
$wavfile = "wav/".time().".wav";

//Directory Of WWW file default is /var/www
$wwwDir = '/var/www/voice/';
2
//Directory of mp3 file
$mp3file = "mp3/".time().".wav";

// convert text 2 wav
exec ( 'echo "'. escapeshellarg ( utf8_decode ( $_REQUEST['text'] ) ) . '" | text2wave -o ' . $wwwDir . $wavfile );

// convert wav to mp3
exec ( "lame '".$wavfile."' '".$mp3file."'" );
? >
< p > The File is < a href="
< ?php
echo $speechfile;
? > " > Here< a > < /p >
< ?php
}
? >
< /body >
< /html >

Oke See ya..... I hope can help you





Thursday, June 25, 2009

Delete Dual Partitions Grub Error 22, FIXMBR

Hoaaaaaaaaaahhhh....... So speepy .... overnight because of install dualboot OS windows and linux in my Friend PC.... ckckckckc..... after trying to install Linux 3 times but i still got error.... ckckckckckck... i used PC with prosessor intel dualcore ram 512 mb swap 1,5 gb vga nvidia os 1 windows xp sp2 os 2 PCLINUX3d ckckckckc .......it isnt running very well..............damn!!...... i think this computer need more RAM i have trying to install untill 7 PM but finally i boot using XP and delete all Linux Partition i hope i can boot directly into XP But it turn outs .............
OH...DAMN !!!...............
ckckckckckckckckck

I got error like this :
GRUB 1.5

Error 22

Ya...Allaah...
i forgot if i delete a Linux the grub is not exist any more..........
oke
i immediately took my CD XP
and boot use XP
then enter menu Install XP

i choose R to repair

then choose no 1
then i retype password of admin pc
then type FIXMBR
finish .......
i can directly boot from PC to XP
ahehehehehehe :D
hoaaaaa......
Sleepy

Wednesday, June 10, 2009

Format and Mounting New Hard disk on Linux


Ckckckckckckck.....
Installation new harddisk broo..........
ckckckc..........
i cant guess that i must install new harddisk, because today i've run out of My disk space damn !!
ckckckckck
ok ...
let's see....(here i use UBUNTU 8.10 )

command line mode : ON


$ df -H (for see space of disk broo...)
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 19G 16.8G 2.2G 89% /
tmpfs 127M 0 127M 0% /lib/init/rw
varrun 127M 103k 127M 1% /var/run
varlock 127M 0 127M 0% /var/lock
udev 127M 2.8M 124M 3% /dev
tmpfs 127M 0 127M 0% /dev/shm
lrm 127M 2.1M 125M 2% /lib/modules/2.6.27-7-generic/volatile

$ su - root (become root ya...accidental hard drive already installed so there isn't need turn off the computer hehehe..... i use hardisk maxtor IDE 160gb)
password:******(usual enter root password)

# fdisk -l (to see my hard drive already signed or have not)
Disk /dev/sda: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x473432c2

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2327 18691596 83 Linux
/dev/sda2 2328 2434 859477+ 5 Extended
/dev/sda5 2328 2434 859446 82 Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
(wah already signed but cos of new harddrive you will see like that ya.....)

# fdisk /dev/sdb (this for create partition on your new hard drive....)
The number of cylinders for this disk is set to 2434.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): m (press m for help)
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): n
( n for new partition ok! than press enter 2 times ok..... finish now we have new partition .........)

# fdisk -l
Disk /dev/sda: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x473432c2

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2327 18691596 83 Linux
/dev/sda2 2328 2434 859477+ 5 Extended
/dev/sda5 2328 2434 859446 82 Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 19452 18691596 83 Linux
(already signed new partition hehehehehe ...... next broo)

# mkfs.ext3 /dev/sdb1 (format hardisk till finish using type ext3 (not NTFS windows ya)

# mkdir /mnt/disk-2 (create new folder to new mount disk hihiihihihi delight :) )

# mount -t ext3 /dev/sdb1 /mnt/disk-2 (mount new disk so that could be used.... hehehehe)

# df -H (check again brooo.....)
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 19G 16.8G 2.2G 89% /
tmpfs 127M 0 127M 0% /lib/init/rw
varrun 127M 103k 127M 1% /var/run
varlock 127M 0 127M 0% /var/lock
udev 127M 2.8M 124M 3% /dev
tmpfs 127M 0 127M 0% /dev/shm
lrm 127M 2.1M 125M 2% /lib/modules/2.6.27-7-generic/volatile
/dev/sdb1 160G 0 160G 100% /mnt/disk-2 (already enter broo....)

# vi /etc/fstab (to create permanent disk so don't have to be mounted again when you restart your computer)

# /etc/fstab: static file system information.
proc /proc proc defaults 0 0
/dev/sda1 / ext3 relatime,errors=remount-ro 0 1
/dev/sda5 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
(tambahin dimari boss)
/dev/sdb1 /mnt/disk-2 ext3 defaults 1 3
(terus tekan ESC dan ketik :wq! untuk simpan ok.....selesai bozzz.......)


Alhamdulillah i have done......

Install Microsoft Fonts and TTF Fonts on Fedora 10


Finally I can install TTF Font (Microsoft Font) On Fedora Server 10....
hehehehe.... :P
Alfter usual use UBUNTU DESKTOP that so easy to install fonts which have extension TTF like this....
ok.. Broo....
to the Point ....

For installing MS Fonts or TTF Fonts is
enter command line / shell /console / press button alt+ctrl+F2


$ su - root
Password:******(enter your password root)
# wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec (download ms font)
# yum install rpm-build cabextract ttmkfdir popt-devel (install all dependences)
# wget http://dl.atrpms.net/all/chkfontpath-1.10.1-2.fc10.i386.rpm (download chkfontpath)
# yum localinstall --nogpgcheck chkfontpath-1.10.1-2.fc10.i386.rpm (install chkfontpath)
#rpmbuild -ba msttcorefonts-2.0-1.spec (build ms font from .spec to .rpm)
# yum localinstall --nogpgcheck /root/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm (install ms font hehehe :D)


and for you who wanna install TTF font the ways is here


Copy all .ttf files into one folders for example on /usr/share/fonts/TTF/
#(root mode : On)
# cd /home/user/download/font/ (when you take the .ttf files there folder)
# mkdir /usr/share/fonts/TTF/ ( create folder for your fonts ...)
# cp *.ttf /usr/share/fonts/TTF/ (now....copy all files to the new folders)
# cd /usr/share/fonts/TTF/ (move to the folder have been created)
# ttmkfdir (now you create fonts.scale files in that folder)
# mkfontdir (now you are indexing TTF files)
# chkfontpath -a /usr/share/fonts/TTF (and you are adding the path of new TTF Files to the master path)
# fc-cache (the last you are building font cache info ....)

Be..... Finish bro.....
hehehehehe.
Finally its Over