Squashed 'python/fsb5/' content from commit 5acfaed

git-subtree-dir: python/fsb5
git-subtree-split: 5acfaed9b44167eeebbd5f0414745cc23a2104a7
This commit is contained in:
Haoyu Xu
2025-05-01 10:40:57 +08:00
commit 57e889fb45
13 changed files with 31707 additions and 0 deletions

11
fsb5/pcm.py Normal file
View 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()