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

!752

static int window =
  8; // erratic
  //100; // stable
  //20; // compromise?

p {
  final DialogIO io = findBot("Music");
  final JPanel panel = singleColorPanel(Color.black);
  showFrame(panel);
  installTimer(panel, 100, r {
    S s = io.ask("pcm data " + window);
    if (eq(s, "null")) ret;
    byte[] pcm = (byte[]) safeUnstructure(s);
    if (pcm != null) {
      Color color = levelToColor(pcmToLevel(pcm));
      panel.setBackground(color);
    }
  });
}

static Color levelToColor(float l) {
  ret new Color(0, l, 0);
}

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