# LED矩阵上的音频可视化器

#### Audio visualizer on led matrix

1 个回复

``````import numpy as np

fftsize = 4096  # about 100ms at 44 kHz; each bin will be ~ 10 Hz
# Band edges to define 8 octave-wide ranges in the FFT output
binedges = [8, 16, 32, 64, 128, 256, 512, 1024, 2048]
nbins = len(binedges)-1
# offsets to get our 48 dB range onto something useful, per band
offsets = [4, 4, 4, 4, 6, 8, 10, 12]
# largest value in ledval
nleds = 8
# scaling of LEDs per doubling in amplitude
ledsPerDoubling = 1.0
# initial value of per-band energy history
binval = 0.001 * np.ones(nbins, np.float)
newbinval = np.zeros(nbins, np.float)
# How rapidly the displays decay after a peak (depends on how often we're called)
decayConst = 0.9

if not_done:
# somehow tap into the most recent 30-100ms of audio.
# Assume we get 44 kHz mono back
waveform = get_latest_waveform()
# find spectrum
spectrum = np.abs(np.fft.rfft(waveform[:fftsize]))
# gather into octave bands
for i in range(nbins-1):
newbinval[i] = np.mean(spectrum[binedges[i]:binedges[i+1]])
# Peak smoothing - decay slowly after large values
binval = np.maximum(newbinval, decayConst*binval)
# Quantize into values 0..8 as the number of leds to light in each column
ledval = np.round(np.maximum(0, np.minimum(nleds,
ledsPerDoubling * np.log2(binval)
+ offsets)))
# Now illuminate ledval[i] LEDs in column i (0..7) ...
``````

1 快速音频波形可视化器

2 JavaScript 音频展示台

3 音频可视化器帮助

4 WebRTC的音频可视化器

2016-01-14 19:51:31 1 612   webrtc
5 带有画布的音频可视化器

6 带有AVQueuePlayer的音频可视化器

7 简单的Jquery音频可视化器

8 VLCJ音频可视化器输出

2012-06-11 07:46:41 0 406   java/ vlcj
9 矩阵可视化

10 可视化矩阵

2016-03-07 23:43:23 1 443   pyspark