File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes playing ogg voices as smooth as possible in java TTS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "playing ogg voices as smooth as possible in java TTS" Watch "playing ogg voices as smooth as possible in java TTS" New topic
Author

playing ogg voices as smooth as possible in java TTS

Nawras Nzar
Greenhorn

Joined: Feb 25, 2012
Posts: 6
hello guys
Am developing a text-to-speech for my own language in java (its my final project which is not developed before, therefor I could NOT use built-in classes). I can recognize the diphones for input text, for playing: I place the diphones in an array, after the input text analysis completed I play the audio files (which are in ogg format) according to the diphones in the array one by one. what I want to ask is: what do you think about this way for playing separate diphones? and what to do to make it smoother because its really not smooth (there is a big gap between playing one file and next one)
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3649
    
  17

Hi, welcome to CodeRanch!

Please UseRealWords. I imagine not many people know what the abbreviation TTS stands for, so it's better to just write text-to-speech.

As for your problem, I haven't really worked with audio in Java that much, but I imagine that instead of playing separate files, it's better to buffer the files well before they're about to be played, or create an entire new file consisting of the phones and diphones for the part of speech that you want to play.
Nawras Nzar
Greenhorn

Joined: Feb 25, 2012
Posts: 6
thanks for reply...
I don't think it's possible to merge all files, but buffering them well maybe.
but I'm seeking for better approach
thank you again.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3649
    
  17

A better approach than buffering? What's wrong with buffering?
Nawras Nzar
Greenhorn

Joined: Feb 25, 2012
Posts: 6
sorry I didn't mean it's not good
but I personally didn't tried it before so I don't know how much effective it will be.
my audio files are in a package for example sounds and I just give the path and play
better say I don't know how exactly to buffer them!!!
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3649
    
  17

Exactly, that's the problem. You're loading the files one at a time, so there's a gap between two fragments when the program has to load the next file. If the sounds are buffered, they can start playing immediately after the previous sound ends.

Now, if you show us how you're currently playing the sound fragments, maybe we can show you how to improve smooth playback.
Nawras Nzar
Greenhorn

Joined: Feb 25, 2012
Posts: 6


if I remove line.drain(); it become very much faster, but I don't know if any drawbacks I will face
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3649
    
  17

This is very little to go on. I don't know how you're loading files, how you're handling your fragment queuing, what types you're using, etc.

Please post an SSCCE.
Nawras Nzar
Greenhorn

Joined: Feb 25, 2012
Posts: 6
from this class tokens send to Sound.java class

Speech.java



this is Sound.java

Nawras Nzar
Greenhorn

Joined: Feb 25, 2012
Posts: 6
Mr.Stephan van Hulst are you there?
I really need help...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: playing ogg voices as smooth as possible in java TTS