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

34
LINES

< > BotCompany Repo | #1007034 // Show Input Audio Lines [dev.]

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

Uses 3874K of libraries. Click here for Pure Java version (6131L/42K/155K).

!7

import javax.sound.sampled.*;

static /*Target*/DataLine currentLine;

p-substance {
  final L<AudioLine> lines = allTargetDataLines();
  L<S> lineNames = allToString(lines);
  ButtonGroup buttons = showUnselectedRadioButtons("Input Audio Lines", lineNames);
  JFrame frame = minFrameWidth(300, packFrame(buttons));
  final JLabel lblLevel = jcenteredBoldLabel("Level: ");
  addToWindowAndPack(frame, lblLevel);
  awtEvery(lblLevel, 100, r {
    S text = "Level: ";
    if (currentLine != null) try {
      text += currentLine.getLevel();
    } catch e {
      text += str(e);
      printStackTrace(e);
    }
    lblLevel.setText(text);
  });
  onRadioButtonChange(buttons, voidfunc(int i) {
    if (i < 0) ret;
    AudioLine line = lines.get(i);
    currentLine = (DataLine) line.open();
    thread {
      print("Capturing");
      captureAudioFromLine(currentLine, sphinxAudioFormat());
      print("Capture done");
    }
  });
}

Author comment

Began life as a copy of #1007023

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: #1007034
Snippet name: Show Input Audio Lines [dev.]
Eternal ID of this version: #1007034/1
Text MD5: e8163d9fdbbd235db66d2fa6740aa118
Transpilation MD5: 6fe11d70208ea981cd699d8e2c8bf2a0
Author: stefan
Category: javax / audio
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-25 23:50:56
Source code size: 969 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 433 / 549
Referenced in: