Initial commit

This commit is contained in:
Stillkill committed 2026-03-08 14:57:24 -05:00
commit a9c1b8fcb6
2100 files changed
+610164

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import os
import struct
import wave
from ImgToCArray import emitDataArray
def conv(fn):
wav = wave.Wave_read(fn)
nframes = wav.getnframes()
header = struct.pack("iiii",
wav.getnchannels(),
wav.getsampwidth(),
wav.getframerate(),
nframes)
frames = wav.readframes(nframes)
rawname = os.path.splitext(fn)[0]
cdata = emitDataArray("PCM_%s"%rawname, header + frames)
out = file("%s.pcm"%rawname, 'wb')
out.write(cdata)
if __name__ == "__main__":
import sys, glob
try: arg = sys.argv[1]
except:
print "usage: wavToRaw.py <glob-pattern|filename>"
sys.exit(1)
fns = glob.glob(arg)
if not fns: fns = [arg]
for fn in fns:
conv(fn)