| | |
| | | }
|
| | |
|
| | | public FunasrWsClient(URI serverURI) {
|
| | | super(serverURI);
|
| | | |
| | | super(serverURI);
|
| | | }
|
| | |
|
| | | public FunasrWsClient(URI serverUri, Map<String, String> httpHeaders) {
|
| | |
| | |
|
| | | // send json at first time
|
| | | public void sendJson(
|
| | | String mode, String strChunkSize, int chunkInterval, String wavName, boolean isSpeaking) {
|
| | | String mode, String strChunkSize, int chunkInterval, String wavName, boolean isSpeaking,String suffix) {
|
| | | try {
|
| | |
|
| | | JSONObject obj = new JSONObject();
|
| | |
| | | obj.put("chunk_size", array);
|
| | | obj.put("chunk_interval", new Integer(chunkInterval));
|
| | | obj.put("wav_name", wavName);
|
| | | if(suffix.equals("wav")){
|
| | | suffix="pcm";
|
| | | }
|
| | | obj.put("wav_format", suffix);
|
| | | if (isSpeaking) {
|
| | | obj.put("is_speaking", new Boolean(true));
|
| | | } else {
|
| | |
| | |
|
| | | // function for rec wav file
|
| | | public void recWav() {
|
| | | sendJson(mode, strChunkSize, chunkInterval, wavName, true);
|
| | | String fileName=FunasrWsClient.wavPath;
|
| | | String suffix=fileName.split("\\.")[fileName.split("\\.").length-1];
|
| | | sendJson(mode, strChunkSize, chunkInterval, wavName, true,suffix);
|
| | | File file = new File(FunasrWsClient.wavPath);
|
| | |
|
| | | int chunkSize = sendChunkSize;
|