Skip to content

Instantly share code, notes, and snippets.

@cnsaturn
Created December 29, 2016 09:17
Show Gist options
  • Save cnsaturn/dba2a5bf92ed74d7066305d8a511514f to your computer and use it in GitHub Desktop.
Save cnsaturn/dba2a5bf92ed74d7066305d8a511514f to your computer and use it in GitHub Desktop.
No Voice Output when given normal text.
Search "AcapelaTTS" (40 hits in 1 file)
C:\Users\changjingpei\Desktop\英语版奥飞\打包\新建文本文档.txt (40 hits)
Line 1: 03-01 10:04:17.313 D/Turing-AcapelaTTS( 4617): ttsevents: Text 0 processed
Line 2: 03-01 10:04:17.326 D/Turing-AcapelaTTS( 4617): ttsevents: Audio start for text 0
Line 3: 03-01 10:04:17.327 D/Turing-AcapelaTTS( 4617): ttsevents: Audio stop for text 0 - totalsamples : 0
Line 56: 03-01 10:04:33.916 D/Turing-AcapelaTTS( 4617): startTTS: ttsText---------> Right.
Line 57: 03-01 10:04:34.074 D/Turing-AcapelaTTS( 4617): ttsevents: Text 0 start processing
Line 58: 03-01 10:04:34.079 D/Turing-AcapelaTTS( 4617): ttsevents: Text 0 processed
Line 63: 03-01 10:04:34.135 D/Turing-AcapelaTTS( 4617): ttsevents: Audio start for text 0
Line 64: 03-01 10:04:34.138 D/Turing-AcapelaTTS( 4617): ttsevents: Audio stop for text 0 - totalsamples : 0
Line 133: 03-01 10:06:15.437 D/Turing-AcapelaTTS( 6434): <init>: load---------> Rosie
Line 134: 03-01 10:06:15.537 D/Turing-AcapelaTTS( 6434): startTTS: ttsText--------->
Line 135: 03-01 10:06:15.539 D/Turing-AcapelaTTS( 6434): startTTS: start-----ttsText--------->
Line 136: 03-01 10:06:15.714 D/Turing-AcapelaTTS( 6434): ttsevents: Text 0 start processing
Line 137: 03-01 10:06:15.744 D/Turing-AcapelaTTS( 6434): ttsevents: Text 0 processed
Line 138: 03-01 10:06:15.777 D/Turing-AcapelaTTS( 6434): ttsevents: Audio start for text 0
Line 139: 03-01 10:06:15.778 D/Turing-AcapelaTTS( 6434): ttsevents: Audio stop for text 0 - totalsamples : 0
Line 151: 03-01 10:06:20.642 D/Turing-AcapelaTTS( 6434): startTTS: ttsText---------> Hi, here comes Jett! Hello, kid. Look at my eyes, and you can talk when my eyes turn into a microphone. Just say hello to me.
Line 152: 03-01 10:06:20.644 D/Turing-AcapelaTTS( 6434): startTTS: start-----ttsText---------> Hi, here comes Jett! Hello, kid. Look at my eyes, and you can talk when my eyes turn into a microphone. Just say hello to me.
Line 153: 03-01 10:06:20.785 D/Turing-AcapelaTTS( 6434): ttsevents: Text 0 start processing
Line 154: 03-01 10:06:20.805 D/Turing-AcapelaTTS( 6434): ttsevents: Text 0 processed
Line 155: 03-01 10:06:20.823 D/Turing-AcapelaTTS( 6434): ttsevents: Audio start for text 0
Line 156: 03-01 10:06:20.828 D/Turing-AcapelaTTS( 6434): ttsevents: Audio stop for text 0 - totalsamples : 0
Line 204: 03-01 10:06:37.860 D/Turing-AcapelaTTS( 6434): startTTS: ttsText---------> Ah ha.,,,Kid, Jett has many skills. Why don't we play an interesting game. Say who is screaming
Line 205: 03-01 10:06:37.867 D/Turing-AcapelaTTS( 6434): startTTS: start-----ttsText---------> Ah ha.,,,Kid, Jett has many skills. Why don't we play an interesting game. Say who is screaming
Line 206: 03-01 10:06:37.987 D/Turing-AcapelaTTS( 6434): ttsevents: Text 0 start processing
Line 207: 03-01 10:06:38.006 D/Turing-AcapelaTTS( 6434): ttsevents: Text 0 processed
Line 208: 03-01 10:06:38.035 D/Turing-AcapelaTTS( 6434): ttsevents: Audio start for text 0
Line 209: 03-01 10:06:38.040 D/Turing-AcapelaTTS( 6434): ttsevents: Audio stop for text 0 - totalsamples : 0
Line 244: 03-01 10:06:45.647 D/Turing-AcapelaTTS( 6434): startTTS: ttsText---------> Right.
Line 245: 03-01 10:06:45.669 D/Turing-AcapelaTTS( 6434): startTTS: start-----ttsText---------> Right.
Line 246: 03-01 10:06:45.828 D/Turing-AcapelaTTS( 6434): ttsevents: Text 0 start processing
Line 247: 03-01 10:06:45.906 D/Turing-AcapelaTTS( 6434): ttsevents: Text 0 processed
Line 248: 03-01 10:06:45.923 D/Turing-AcapelaTTS( 6434): ttsevents: Audio start for text 0
Line 250: 03-01 10:06:45.949 D/Turing-AcapelaTTS( 6434): ttsevents: Audio stop for text 0 - totalsamples : 0
package com.turing.libs.tts;
import android.content.Context;
import android.text.Spannable;
import android.text.style.BackgroundColorSpan;
import android.util.Log;
import com.acapelagroup.android.tts.acattsandroid;
import com.acapelagroup.android.tts.acattsandroid.iTTSEventsCallback;
import com.turing.libs.utils.Loger;
public class AcapelaTTS implements TTSImpl, iTTSEventsCallback {
private String TAG = AcapelaTTS.class.getSimpleName();
acattsandroid TTS = null;
private static AcapelaTTS ttsEngine;
// 监听接口
private ITtsCallBack listener;
String license = "\"9703 0 Eno1 #COMMERCIAL#GuangzhouAuricIntelligentTechnologyCo.-Guangzhou-China\"\nZ6aeFGk5escM8t89uKc82kOiNMexz5%zid@2IixupV7alyBHOL9oDGFukOiWTbh6An@7uxjJ$xFxYRwhZDo2xai!pFHR2xrsfam7dZRs4R##\nYWhwWJqtcsBzhrMzRPYZWfJwoDY2cVUL4ObCebzBEeWqNSUI\nRK5@mfA$Y48C8BZwQuuRvT##\n";
// Required to load native TTS library on startup
static {
System.loadLibrary("acattsandroid");
}
/**
* tts对象随构造方法被创建
*
* @param ctx
*/
public static AcapelaTTS getInstance(Context context) {
if (ttsEngine == null) {
synchronized (AcapelaTTS.class) {
ttsEngine = new AcapelaTTS(context);
}
}
return ttsEngine;
}
public AcapelaTTS(Context context) {
TTS = new acattsandroid(context, this, null);
TTS.setLicense(
0x316f6e45,
0x0031fb03,
license);
String[] voiceDirPaths = {
"/sdcard/voices"
};
String[] voicesList = TTS.getVoicesList(voiceDirPaths);
Loger.d(TAG, "load---------> " + voicesList[0]);
TTS.load(voicesList[0], "");
}
@Override
public boolean isTtsPlaying() {
return TTS.isSpeaking();
}
@Override
public void startTTS(String text, int ttsSpeed, int tone, String effect) {
Loger.d(TAG, "ttsText---------> " + text);
if (TTS != null) {
Loger.d(TAG, "start----ttsText---------> " + text);
// TTS.setSpeechRate(100);
// TTS.setPitch(100);
// TTS.setAudioBoost(0);
TTS.speak(text);
}
}
@Override
public void stopTTS() {
if (TTS != null) {
TTS.stop();
}
}
@Override
public void resumeTTS() {
if (TTS != null)
TTS.shutdown();
}
@Override
public void setTtsListener(ITtsCallBack ttsListener) {
this.listener = ttsListener;
}
@Override
public void ttsevents(long type, long param1, long param2, long param3, long param4) {
final long fparam1 = param1;
final long fparam2 = param2;
if (type == acattsandroid.EVENT_TEXT_START) {
Loger.d(TAG, "Text " + param1 + " start processing");
if (listener != null) {
listener.onSpeakBegin(String.valueOf(param1));
}
} else if (type == acattsandroid.EVENT_TEXT_END) {
Loger.d(TAG, "Text " + param1 + " processed");
} else if (type == acattsandroid.EVENT_AUDIO_START) {
Loger.d(TAG, "Audio start for text " + param1);
} else if (type == acattsandroid.EVENT_AUDIO_END) {
Loger.d(TAG, "Audio stop for text " + param1 + " - totalsamples : " + param2);
if (listener != null) {
listener.onTtsPlayCompleted();
}
} else if (type == acattsandroid.EVENT_WORD_POS) {
} else if (type == acattsandroid.EVENT_VISEME_POS) {
// Log.i(TAG, "Viseme : " + param1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment