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

33
LINES

< > BotCompany Repo | #1009769 // Swing: Record audio to .wav, CD quality mono [WORKS]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 114K of libraries. Click here for Pure Java version (2509L/18K).

!7

static JButton btn;
static Flag flag; // stop flag

static AudioFormat format;

p {
  format = javaSound_monoCDQuality°;
  swing {
    showControls(jcenteredline(btn = jbutton("Start", f btn)));
  }
}

svoid btn {
  if (flag == null || flag.isUp()) start(); else stop();
}

svoid start ctex {
  setText(btn, "Stop");
  flag = new Flag;
  final File wavFile = countTillNewFile(prepareProgramFile("recorded-"), ".wav");
  thread {
    captureAudioToWAV(format, wavFile, flag);
    print(wavFile);
    print("Actually done. " + l(wavFile) + " bytes");
  }
}

svoid stop {
  setText(btn, "Start");
  flag.raise();
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009769
Snippet name: Swing: Record audio to .wav, CD quality mono [WORKS]
Eternal ID of this version: #1009769/14
Text MD5: bf2244c677dcd9b0cba35224238f6e13
Transpilation MD5: 86b1e6184f57620b562d98ceb959af22
Author: stefan
Category: javax / audio
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-16 17:16:58
Source code size: 648 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 356 / 896
Version history: 13 change(s)
Referenced in: [show references]