Uses 3874K of libraries. Click here for Pure Java version (3464L/23K/83K).
!7 static JButton button; static volatile Capturer cap; static File wavFile; p-substance { showControls(jCenteredLine(button = jbutton("Record!", f recordOrStop))); } svoid recordOrStop { if (cap != null) { cap.stop(); byte[] pcm = cap.getPCM(); infoMessage("Got " + l(pcm) + " bytes PCM!"); pcmToWAVE(pcm, cap.format(), wavFile); infoBox("Wrote " + f2s(wavFile) + " (" + wavFile.length() + " bytes)"); cap = null; setText(button, "Record!"); } else { AudioLine line = first(allTargetDataLines()); assertNotNull("Need audio input line!", line); DataLine dataLine = cast line.open(); print("Capturing"); wavFile = prepareProgramFile(ymd_minus_hms() + ".wav"); cap = captureAudioFromLine2(dataLine, sphinxAudioFormat()); setText(button, "Stop"); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007035 |
Snippet name: | Capture Audio By Button Press [dev.] |
Eternal ID of this version: | #1007035/6 |
Text MD5: | 14dc49d717e9767f35697504e44c90c1 |
Transpilation MD5: | 6371229cf88acc9138f0fbb56298d978 |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-02-26 00:15:08 |
Source code size: | 842 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 461 / 551 |
Version history: | 5 change(s) |
Referenced in: | #1007039 - Capture Audio By Button Press & Recognize With CMU Sphinx [WORKS!] |