Re: advice: program to generate sound from characters
- From: babaji <banerjee.anirban@xxxxxxxxx>
- Date: Wed, 30 Jul 2008 18:40:21 -0700 (PDT)
On Jul 30, 5:26 pm, babaji <banerjee.anir...@xxxxxxxxx> wrote:
On Jul 30, 4:35 pm, Unruh <unruh-s...@xxxxxxxxxxxxxx> wrote:
babaji <banerjee.anir...@xxxxxxxxx> writes:
Hello all :-) ,
Could someone please help me with a little bit of
advice.
I am planning to write a program which would take as input characters,
say a-z and would output a wav/mp3 file to represent them. e.g. input-
"myname" output-> an mp3 file where a tone will be played for say0.5 sec to represent each character.
I have searched for packages and have come up with a lot of results. I
am a little overwhelmed by the complexity of some of the packages for
text to speech and the like. Could someone please suggest a simple
program/library which I could use to convert a letter to a tone and
get a wav/mp3 file as output.
I am sure noone has written it. YOu could write your own. Eg, you could use
sox as a translator from an ascii using the .dat data format, and then have
sox convert that to a .wav file.
you could write one .dat for each letter and then convert it.
iThe only problem would be to convert the time in the file to consecutive
times.
timebase=0
for i in m y n a m e
do
awk 'BEGIN {t='$timebase'} {print $1+t " " $2}' $i.dat>>output.dat
timebase=`echo $timebase + .5 |bc`
done
sox output.dat output.wav
Wher I assume that each a.dat, b.dat... have times which go from 0 to
.5-mint
where mint is the minimum timestep.
and a.dat, b.dat, c.dat .... are .dat files which contain the tones you
want to have put in for a b c ...
I have seen festival, and some other text2speech packages, but I am
just wondering if there is something much simpler for my
requirements.
I plan to use the program as a command line utility to convert small
chunks of text to tones.
Thanks,
-A
Thanks so much for your input, it is very helpful. I will bug you just
a little more since this is my first audio programming tryout.
I looked up Sox and installed at was trying to find the file format
of .dat files from
http://aaron.birenboim.com/unix/audioRecording.htmlhttp://www.cs.rutgers.edu/~village/lab/dat2d2wav.htmlhttp://www.boutell.com/scripts/silence.html
and from some other sources. Your script has solved nearly 90% of the
problem :-) . I will work on the rest, but if you can please provide
me another pointer, that would be great.
It seems that .dat is a generic format. Is it the same as .raw? From http://www.boutell.com/scripts/silence.html and your code it seems
that the .dat file should have at least 2 fields: time and tone/
pitch , is this correct?
Thanks for the help,
-A
Hi,
I have used the following to make the dat file,
[code]
#!/bin/sh
wd=$PWD
seconds=$1
file=$2
samples=(`echo "$seconds*8000" | bc`)
for (( i = 0;i<$samples;i++ ))
do
time=(`pc $i/8000`)
echo $time" "500 >> $wd/$2
done
exit 0;
[/code]
and your code following it
[code]
#!/bin/sh
#Unruhs code groups.google.com
#linux.misc
timebase=0
for i in m y n a m e
do
awk 'BEGIN {t='$timebase'} {print $1 + t " " $2}' $i.dat >>
output.dat
timebase=`echo $timebase + 1 | bc`
done
sox -r 8000 output.dat output.wav
exit 0
[\code]
I get, sox sox: output.dat: input clipped 48000 samples and when I
play the file I hear a deep sounding blip for a millisecond or so and
then nothing for the rest of the duration :-( . I have tried changing
the putch to 1000, 5000, 500, 10 etc.. but it is the same thing every
time. Can someone spot any obvious mistakes?
Thanks,
-A
Notes: pc is a perl calculator, the first piece of code is modified
from http://www.boutell.com/scripts/silence.html
.
- References:
- advice: program to generate sound from characters
- From: babaji
- Re: advice: program to generate sound from characters
- From: Unruh
- Re: advice: program to generate sound from characters
- From: babaji
- advice: program to generate sound from characters
- Prev by Date: Re: Good command line word processor for Linux
- Next by Date: Re: How do I extend a user's account
- Previous by thread: Re: advice: program to generate sound from characters
- Next by thread: Re: advice: program to generate sound from characters
- Index(es):