本文整理汇总了Java中marytts.util.data.audio.AudioPlayer类的典型用法代码示例。如果您正苦于以下问题:Java AudioPlayer类的具体用法?Java AudioPlayer怎么用?Java AudioPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AudioPlayer类属于marytts.util.data.audio包,在下文中一共展示了AudioPlayer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: speakTextFromAcousticParameters
import marytts.util.data.audio.AudioPlayer; //导入依赖的package包/类
private void speakTextFromAcousticParameters(Document doc, MaryProsody mp) throws TTSException
{
AudioInputStream audio = speakTextToAudioInputStream(doc, MaryDataType.ACOUSTPARAMS);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream is1, is2;
try
{
ByteStreams.copy(audio, baos);
is1 = new ByteArrayInputStream(baos.toByteArray());
is2 = new ByteArrayInputStream(baos.toByteArray());
double data[] = MaryAudioUtils.getSamplesAsDoubleArray(new AudioInputStream(is1, audio.getFormat(), audio.getFrameLength()));
mp.setRMSEnergy(getRMSEnergy(data, audio.getFormat().getFrameRate()));
is1.close();
}
catch (IOException e)
{
throw new TTSException(e.getLocalizedMessage(), e);
}
AudioPlayer ap = new AudioPlayer(new AudioInputStream(is2, audio.getFormat(), audio.getFrameLength()), null);
ap.start();
}
开发者ID:ArticulatedSocialAgentsPlatform,项目名称:HmiCore,代码行数:23,代码来源:MaryTTSGenerator.java
示例2: speakBlocking
import marytts.util.data.audio.AudioPlayer; //导入依赖的package包/类
public synchronized void speakBlocking(String text) //synchronized so that together with the call to join(), calls to this method will wait until previous calls are finished
{
if (text != null && !text.isEmpty())
{
try
{
AudioPlayer ap = new AudioPlayer();
ap.setAudio(maryTTS.generateAudio(text));
ap.start();
ap.join();
}
catch (SynthesisException se)
{
logger.log(Level.SEVERE, "MaryTTS failed to generate audio for text \"" + text + "\"", se);
}
catch (InterruptedException ie)
{
logger.log(Level.SEVERE, "MaryTTS AudioPlayer thread was interrupted.", ie);
}
}
}
开发者ID:ck3ck3,项目名称:WhoWhatWhere,代码行数:22,代码来源:MaryTTS.java
示例3: say
import marytts.util.data.audio.AudioPlayer; //导入依赖的package包/类
public static void say(String comment) {
if (isSilenced) {
System.out.println(comment);
return;
}
try {
if (!inited) {
init();
}
if (comment.isEmpty()) return;
final AudioInputStream audio = marytts.generateAudio(comment);
final AudioPlayer player = new AudioPlayer(audio);
player.start();
} catch (MaryConfigurationException | SynthesisException e) {
logger.error("Error sythesizing text to voice", e);
}
}
开发者ID:phrack,项目名称:ShootOFF,代码行数:21,代码来源:TextToSpeech.java
示例4: playAudio
import marytts.util.data.audio.AudioPlayer; //导入依赖的package包/类
private void playAudio(AudioInputStream audio)
{
LineListener lineListener = new LineListener()
{
public void update(LineEvent event)
{
if (event.getType() == LineEvent.Type.START) { Log.print(Log.DEBUG,"Audio started playing."); }
else if (event.getType() == LineEvent.Type.STOP) { Log.print(Log.DEBUG,"Audio stopped playing."); }
else if (event.getType() == LineEvent.Type.OPEN) { Log.print(Log.DEBUG,"Audio line opened."); }
else if (event.getType() == LineEvent.Type.CLOSE) { Log.print(Log.DEBUG,"Audio line closed."); }
}
};
AudioPlayer ap = new AudioPlayer(audio, lineListener);
ap.start();
}
开发者ID:scbickle,项目名称:maryspeak,代码行数:17,代码来源:Process.java
示例5: executeSpeaking
import marytts.util.data.audio.AudioPlayer; //导入依赖的package包/类
private void executeSpeaking(String speech) throws SynthesisException, InterruptedException {
AudioInputStream audio = marytts.generateAudio(speech.trim());
currentlySpeeking = new AudioPlayer(audio);
log.debug("Speeking: " + speech.trim());
notifySpeechListeners(speech.trim());
currentlySpeeking.start();
currentlySpeeking.join();
}
开发者ID:TypeTalk,项目名称:TypeTalk,代码行数:9,代码来源:Speeker.java
示例6: executeSpeaking
import marytts.util.data.audio.AudioPlayer; //导入依赖的package包/类
private void executeSpeaking(String speech) throws SynthesisException, InterruptedException {
AudioInputStream audio = marytts.generateAudio(speech);
currentlySpeeking = new AudioPlayer(audio);
log.debug("Speeking: " + speech);
currentlySpeeking.start();
currentlySpeeking.join();
}
开发者ID:raginggoblin,项目名称:speechless,代码行数:8,代码来源:Speeker.java
示例7: read
import marytts.util.data.audio.AudioPlayer; //导入依赖的package包/类
public static void read(String s) throws SynthesisException, InterruptedException {
AudioInputStream audio = marytts.generateAudio(s.length() > 0 ? s : "Ich kann das leider nicht lesen.");
player = new AudioPlayer(audio);
player.start();
player.join();
}
开发者ID:Dakror,项目名称:WebcamParser,代码行数:8,代码来源:Reader.java
注:本文中的marytts.util.data.audio.AudioPlayer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论