!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(); } }