Squashed 'python/fsb5/' content from commit 5acfaed
git-subtree-dir: python/fsb5 git-subtree-split: 5acfaed9b44167eeebbd5f0414745cc23a2104a7
This commit is contained in:
11
fsb5/pcm.py
Normal file
11
fsb5/pcm.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import wave
|
||||
from io import BytesIO
|
||||
|
||||
|
||||
def rebuild(sample, width):
|
||||
data = sample.data[:sample.samples * width]
|
||||
ret = BytesIO()
|
||||
with wave.open(ret, "wb") as wav:
|
||||
wav.setparams((sample.channels, width, sample.frequency, 0, "NONE", "NONE"))
|
||||
wav.writeframes(data)
|
||||
return ret.getvalue()
|
||||
Reference in New Issue
Block a user