2
제 목표는 pyaudio에서 제공하는 문자열을 int16으로 언팩 한 다음 수정하여 다시 재생하여 재생하는 것입니다. pyaudio에서 struct.pack/unpack을 올바르게 사용하는 방법은 무엇입니까?
이
내가 (코드는 다른 게시물에서 복사) 지금까지 무엇을 가지고 있습니다 :#data contains my string of interleaved int16 data
#this code should unpack it accordingly
# 1 short out of each 2 chars in data
count = len(data)/2
format = "%dh"%(count) #results in '2048h' as format: 2048 short
shorts = struct.unpack(format, data)
#here some modifications will take place but are left out to test packing
#now i need to pack my short data back to pyaudio compliant string
#i have tried the following with no success. just random noise
struct.pack(str(len(shorts)*2) + "s", str(shorts))
이제 내 질문 :
- 에 다시 내 데이터를 얻을 수
struct.pack
에 대한 올바른 인수 일 것입니다 무슨 파이 오디오 문자열?
이 코드를 어디서 받았습니까? – aIKid
@aIKid [첫 번째 답변은 여기] (http://stackoverflow.com/questions/4160175/detect-tap-with-pyaudio-from-live-mic) –