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).

abstract sclass DynWitAILastRecording > DynPrintLogAndEnabled {
  transient StreamingWitAIUploader uploader;
  S language = "english";
  
  start {
    dm_requireQuickAudioRecord();
    dm_require("#1026970/ConcurrentMP3");
    dm_vmBus_onMessage startedRecordingMP3(voidfunc(File f) enter {
      if (!enabled) ret;
      dm_q(r {
        uploader = new StreamingWitAIUploader;
        uploader.language = language;
        uploader.start();
      });
    });
      
    dm_vmBus_onMessage wroteMP3Chunk(voidfunc(File f, byte[] array, int i, int j) enter {
      if (!enabled) ret;
      byte[] data = cloneSubByteArray(array, i, j);
      dm_q(r {
        uploader?.sendData(data);
      });
    });
      
    dm_vmBus_onMessage_q newMP3Recording(voidfunc(File f) enter {
      if (!enabled || uploader == null) ret;
      S text = uploader!;
      dispose uploader;
      flatInfoBox(text);
      S info = "wit.ai " + language;
      dm_rawSpeechRecognized(module(), text, info, f);
    });
  }
  
  void cleanMeUp { dispose uploader; }
}

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: 229 / 576
Version history: 7 change(s)
Referenced in: [show references]