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

1  
!7
2  
3  
import javax.sound.sampled.*;
4  
5  
static /*Target*/DataLine currentLine;
6  
7  
p-substance {
8  
  final L<AudioLine> lines = allTargetDataLines();
9  
  L<S> lineNames = allToString(lines);
10  
  ButtonGroup buttons = showUnselectedRadioButtons("Input Audio Lines", lineNames);
11  
  JFrame frame = minFrameWidth(300, packFrame(buttons));
12  
  final JLabel lblLevel = jcenteredBoldLabel("Level: ");
13  
  addToWindowAndPack(frame, lblLevel);
14  
  awtEvery(lblLevel, 100, r {
15  
    S text = "Level: ";
16  
    if (currentLine != null) try {
17  
      text += currentLine.getLevel();
18  
    } catch e {
19  
      text += str(e);
20  
      printStackTrace(e);
21  
    }
22  
    lblLevel.setText(text);
23  
  });
24  
  onRadioButtonChange(buttons, voidfunc(int i) {
25  
    if (i < 0) ret;
26  
    AudioLine line = lines.get(i);
27  
    currentLine = (DataLine) line.open();
28  
    thread {
29  
      print("Capturing");
30  
      captureAudioFromLine(currentLine, sphinxAudioFormat());
31  
      print("Capture done");
32  
    }
33  
  });
34  
}

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: 432 / 548
Referenced in: [show references]