如何开发像Talking Tom这样的语音识别应用程序?
1.我的要求是如何在没有按钮,触摸事件等任何事件的情况下识别语音
.2.所有录音样本都包含通过按钮,但我的要求是当用户在该时间讲话时识别语音并且当用户自动停止语音时用汤姆或鹦鹉
3 等其他声音修改声音.我已经通过按钮完成了
我的.java
File storageDir = new File(Environment.getExternalStorageDirectory(), "SRAVANTHI");
storageDir.mkdir();
Log.d(APP_TAG, "Storage directory set to " + storageDir);
outfile = File.createTempFile("hascode", ".3gp", storageDir);
// init recorder
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(outfile.getAbsolutePath());
// init player
player.setDataSource(outfile.getAbsolutePath());
try {
recorder.prepare();
recorder.start();
recording = true;
} catch (IllegalStateException e) {
Log.w(APP_TAG, "Invalid recorder state .. reset/release should have been called");
} catch (IOException e) {
Log.w(APP_TAG, "Could not write to sd card");
}
recorder.stop();
Run Code Online (Sandbox Code Playgroud)
用于播放按钮
try {
playing = true; …Run Code Online (Sandbox Code Playgroud) 是否有一些openCV函数可以传入cv::Mat并获取其中所有值的总和?
例如:int cvSumFoo(Mat &srcMat); 我期待一个int回来
我像这样创建它:
srcMat= new Mat(rows, cols, CV_8U);
Run Code Online (Sandbox Code Playgroud)
如果可能的话,我想避免创建自己的循环.
在处理重定向链接时,我在Android webview应用程序中使用反键进入死循环.
例如,当我的webview开始时,它将转到link0.
在link0中,有一个链接到link1的href链接.Link1重写到link2.
因此,如果我单击link1,它将转到link1,然后重定向到link2.当我点击返回键时,它应该返回到link0,在我的情况下.但相反,它转到link1,它再次重定向回link2.所以我再也没有机会回去了.
如果它们不是重定向链接,则反向键可以与其他链接正常工作.
我用Google搜索网页寻求帮助,但未找到相关问题.
顺便说一下,反密钥在互联网浏览器中按预期工作.但不是在webview中.
以下是我的代码,供您试用.正如你在代码中看到的那样,我尝试了onBackPressed和onKeyDown,但是更好的是.
谢谢你的帮助.我对此持续了一段时间.
================================================== ================================
public class MyActivity extends Activity
{
private WebView myWebView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
myWebView = (WebView) findViewById(R.id.webview);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.loadUrl("http://50.112.242.120/temp/");
myWebView.setWebViewClient(new MyWebViewClient());
}
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
myWebView.loadUrl(url);
return true;
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Check if the key event …Run Code Online (Sandbox Code Playgroud) 尝试使用放心自动化api测试
@Test
public void Login() {
Response resp = given().
body("{\"phone_number\":\"2222222222\",\"\r\n" +
" + \" \"country_code\": \"+91\",\"\r\n" +
" + \" \"login_type\": 0}").
when().
contentType(ContentType.JSON).
post("http://url/api/v1/login");
System.out.println(resp.asString());
}
Run Code Online (Sandbox Code Playgroud) 我尝试实现以下代码来处理屏幕方向更改.
****DataBaseUpdateService.java****
public class DataBaseUpdateService extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Updatetask Task = new Updatetask(this.getApplicationContext());
if(Task.getStatus() == AsyncTask.Status.PENDING){
Task.execute();};
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onResume() {
super.onResume();
}
}
Run Code Online (Sandbox Code Playgroud)
================================================== ========================
****Androidmanifest.xml****
<activity
android:name=".DataBaseUpdateService"
android:configChanges="keyboardHidden|orientation"/>
Run Code Online (Sandbox Code Playgroud)
这些代码与android 3.x或更低版本完美配合.但是,它无法正常运行android 4.x.
你知道问题是什么吗?
我有一个空的,干净的Eclipse Java项目.我有什么做用Tess4J的库,我想发展我的web服务?
甚至可以将它用作Android项目的库吗?(会很快缩短).tif我遇到的问题与android 有关.
Tess4J是本机代码的包装器,因为tesseract-ocr是用C/C++编写的.我到目前为止.但是如何将这个包装器包含到我的项目中?
我已经google了很多,直到我决定放弃tesseract.Net,因为这个项目被严格维护/记录并且会迫使我去C#(这没关系),但我没有设法让它工作,所以我不得不默认为C/C++(不行);)
我现在有点失落,所以欢迎任何帮助.问候.
编辑:按照这里提到的步骤(从nguyenq回答)
1:新的Eclipse工作区
2:创建了一个名为的新目录 lib
3:复制\Tess4J\dist\tess4j.jar,\Tess4J\lib\jna.jar并\Tess4J\lib\jai_imageio.jar进入lib(2)
4:在Eclipse中创建了一个新的Java项目
5:在项目属性中(4)我将.jars从(3)添加到Java构建路径作为库下的外部jar
6:我复制了dir \tessdata并libtesseract302.dll进入项目根目录\workspace\project\
7:我创建了一个新类Main并实例化了一个Tesseract1 tesseract = new Tesseract1();用于测试
8:我运行应用程序但抛出异常: Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract302' Module not found
EDIT2:
7.1:我创建了一个新类Main并实例化了一个Tesseract tesseract = new Tesseract.getInstance();用于测试的(源代码:here)
8.1:到目前为止看起来没问题,但没有实现逻辑,只是试图构建它.
EDIT3:
9:不,不行.仍然不满意的链接错误.这可能是32位与64位的问题吗?我正在使用Win7 64bit.
我尝试使用MediaPlayer(Android ICS)循环播放多个视频,并在每次调用oncompletion()时更改视频.
它工作得很好,但在随机时间后应用程序冻结,我得到错误:
[SurfaceView]连接:已连接(cur = 3,req = 3)setVideoSurfaceTexture失败:-22
发生此错误时,内部会调用重置播放器
ref:mediaplayer.cpp
if (err != OK) {
LOGE("setVideoSurfaceTexture failed: %d", err);
// Note that we must do the reset before disconnecting from the ANW.
// Otherwise queue/dequeue calls could be made on the disconnected
// ANW, which may result in errors.
reset();
disconnectNativeWindow();
return err;
}
Run Code Online (Sandbox Code Playgroud)
根据我的代码,我得到onprepared()的通知并开始播放.
实际上由于这个错误没有回放.
因此我尝试重置媒体播放器并在发生此问题并且没有播放媒体播放器时调用prepare(),但我无法捕获此错误(mp.isPlaying() - > true(在preprepared中称为start() ()).
我尝试逻辑
onprepared() {
mp.start();
if (pbm : [SurfaceView] connect : already connected (cur=3, req=3)
setVideoSurfaceTexture failed : -22 ) …Run Code Online (Sandbox Code Playgroud) 我试图FrameLayout用我自己的颜色设置我的backgroundcolor .
我创建了一个.xml包含我自己颜色的文件.这里是:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red">#FF0000</color>
<color name="orange">#FF7D00</color>
<color name="yellow">#FFFF00</color>
<color name="green">#00FF00</color>
<color name="blue">#00B4FF</color>
<color name="black">#000000</color>
</resources>
Run Code Online (Sandbox Code Playgroud)
这里是我试图设置backgroundcolor的代码,但是当我运行应用程序时,FrameLayout它总是灰色的,为什么?:
FrameLayout MyFrameLayout = new FrameLayout(this);
LayoutParams MyFrameLayoutParam = new LayoutParams(LayoutParams.FILL_PARENT, 200);
MyFrameLayout.setLayoutParams(MyFrameLayoutParam);
MyFrameLayout.setBackgroundColor(R.color.red);
Parent.addView(MyFrameLayout);
Run Code Online (Sandbox Code Playgroud) ObjectNetBache类是否包含在.Net Framework 3.5中?
如果没有,是否有一种替代方法可以在缓存中存储对象(在Windows应用程序中不是asp.net)?
有没有人有任何在线资源或代码片段,演示如何使用ObjectCache类?
我正在尝试从eclipse juno(jetty web-server)运行一个简单的基于REST的应用程序(稍后将在谷歌应用程序引擎上部署)
这是我的代码:
package co.suhas.live;
import java.io.IOException;
import javax.servlet.http.*;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
@SuppressWarnings("serial")
public class AppServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/plain");
resp.getWriter().println("Hello, world");
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(
"http://www.google.com/search?q=google");
HttpResponse response = httpclient.execute(httpget);
resp.getWriter().println(response.toString());
}
}
Run Code Online (Sandbox Code Playgroud)
我已将Apache HTTP Client jar文件添加到BUILD PATH中.
包含:
commons-codec-1.6.jar
commons-logging-1.1.1.jar
fluent-hc-4.2.3.jar
httpclient-4.2.3.jar
httpclient-cache-4.2.3.jar
httpcore-4.2.2.jar
httpmime-4.2.3.jar
Run Code Online (Sandbox Code Playgroud)
但是当我运行它时,我收到此错误localhost:
HTTP ERROR 500
Problem accessing /app. Reason:
org/apache/http/client/methods/HttpUriRequest …Run Code Online (Sandbox Code Playgroud) android ×6
java ×3
.net ×1
c# ×1
c++ ×1
deployment ×1
eclipse ×1
manifest ×1
media-player ×1
mobile ×1
objectcache ×1
ocr ×1
opencv ×1
rest ×1
surfaceview ×1
tesseract ×1
voice ×1
webview ×1