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

25
LINES

< > BotCompany Repo | #1004840 // Grab PCM Data From Music Player

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

Libraryless. Click here for Pure Java version (3987L/27K/90K).

1  
!752
2  
3  
static int window =
4  
  8; // erratic
5  
  //100; // stable
6  
  //20; // compromise?
7  
8  
p {
9  
  final DialogIO io = findBot("Music");
10  
  final JPanel panel = singleColorPanel(Color.black);
11  
  showFrame(panel);
12  
  installTimer(panel, 100, r {
13  
    S s = io.ask("pcm data " + window);
14  
    if (eq(s, "null")) ret;
15  
    byte[] pcm = (byte[]) safeUnstructure(s);
16  
    if (pcm != null) {
17  
      Color color = levelToColor(pcmToLevel(pcm));
18  
      panel.setBackground(color);
19  
    }
20  
  });
21  
}
22  
23  
static Color levelToColor(float l) {
24  
  ret new Color(0, l, 0);
25  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004840
Snippet name: Grab PCM Data From Music Player
Eternal ID of this version: #1004840/1
Text MD5: ac2da1adcbb5a2d36e2d22b675f225c6
Transpilation MD5: 0dbcd42f4e03d8b14cdf5b57c18f901e
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-07 13:28:04
Source code size: 559 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 634 / 784
Referenced in: [show references]