This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

playing ogg voices as smooth as possible in java TTS

 
Nawras Nzar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6327
78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6327
78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A better approach than buffering? What's wrong with buffering?
 
Nawras Nzar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6327
78
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 6327
78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from this class tokens send to Sound.java class

Speech.java



this is Sound.java

 
Nawras Nzar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr.Stephan van Hulst are you there?
I really need help...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic