Download Jar. Libraryless. Click here for Pure Java version (1558L/10K).
!7 import javax.sound.sampled.*; static JPanel colorPanel; p { swing { tt(); colorPanel = singleColorPanelWithSize(); showControls(jFullCenter(colorPanel)); } AudioFormat format = new AudioFormat(44100, 16, 1, true, true); // signed, big-endian //TargetDataLine line = AudioSystem.getTargetDataLine(format); DataLine.Info info = new DataLine.Info(TargetDataLine.class, format); TargetDataLine line = (TargetDataLine) AudioSystem.getLine(info); line.open(format); byte[] data = new byte[256]; short[] buf = new short[l(data)/2]; line.start(); try { while licensed { int n = line.read(data, 0, l(data)); //printWithMSTime("Bytes: " + n); bytesToShorts_signedBigEndian(data, buf); int min = min(buf), max = max(buf); final double loudness = min(max(abs(min), abs(max))/32767.0, 1); //print("min: " + min + ", max: " + max + ", loudness: " + formatDouble(loudness, 2)); awt { colorPanel.setBackground(blendColor(Color.white, Color.black, loudness)); } } } finally { line.close(); } }
Began life as a copy of #1007999
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): alesojohvdrz, aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008000 |
Snippet name: | Audio Voltmeter with singleColorPanel (works without Substance) |
Eternal ID of this version: | #1008000/21 |
Text MD5: | 5041034c3fe040f581cc4aac4c94e894 |
Transpilation MD5: | c4a38f984cac0773208b90b9ecaee586 |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-04-18 20:38:27 |
Source code size: | 1131 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 564 / 1180 |
Version history: | 20 change(s) |
Referenced in: | [show references] |