0
import neopixel
import board
import sounddevice as sd
from numpy import linalg as LA
import numpy as np

def getvolume(indata, outdata, frames, time, status):
       volume_norm = np.linalg.norm(indata)*10

with sd.Stream(callback=getvolume):
       sd.sleep(250)

pixels = neopixel.NeoPixel(board.D18, 144)
pixels.fill((volume_norm, volume_norm, volume_norm))`

我希望代码使 LED 灯条发出的声音越亮越亮。它目前没有做任何事情。我究竟做错了什么?

4

0 回答 0