Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

36
LINES

< > BotCompany Repo | #1026978 // DynWitAILastRecording - Recognize Last Recording With Wit.AI [Fully Pipelined Version]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (13446L/97K).

1  
abstract sclass DynWitAILastRecording > DynPrintLogAndEnabled {
2  
  transient StreamingWitAIUploader uploader;
3  
  S language = "english";
4  
  
5  
  start {
6  
    dm_requireQuickAudioRecord();
7  
    dm_require("#1026970/ConcurrentMP3");
8  
    dm_vmBus_onMessage startedRecordingMP3(voidfunc(File f) enter {
9  
      if (!enabled) ret;
10  
      dm_q(r {
11  
        uploader = new StreamingWitAIUploader;
12  
        uploader.language = language;
13  
        uploader.start();
14  
      });
15  
    });
16  
      
17  
    dm_vmBus_onMessage wroteMP3Chunk(voidfunc(File f, byte[] array, int i, int j) enter {
18  
      if (!enabled) ret;
19  
      byte[] data = cloneSubByteArray(array, i, j);
20  
      dm_q(r {
21  
        uploader?.sendData(data);
22  
      });
23  
    });
24  
      
25  
    dm_vmBus_onMessage_q newMP3Recording(voidfunc(File f) enter {
26  
      if (!enabled || uploader == null) ret;
27  
      S text = uploader!;
28  
      dispose uploader;
29  
      flatInfoBox(text);
30  
      S info = "wit.ai " + language;
31  
      dm_rawSpeechRecognized(module(), text, info, f);
32  
    });
33  
  }
34  
  
35  
  void cleanMeUp { dispose uploader; }
36  
}

Author comment

Began life as a copy of #1026976

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026978
Snippet name: DynWitAILastRecording - Recognize Last Recording With Wit.AI [Fully Pipelined Version]
Eternal ID of this version: #1026978/8
Text MD5: 5494f5caccc035a2c4ee5048eaebe1ec
Transpilation MD5: 0c956f9572fd6ae4b8e870d5dace61ad
Author: stefan
Category: javax / audio recognition
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-13 13:26:23
Source code size: 1077 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 329 / 710
Version history: 7 change(s)
Referenced in: [show references]