Skip to content

Commit

Permalink
na
Browse files Browse the repository at this point in the history
  • Loading branch information
npinto committed Nov 29, 2022
1 parent 2185120 commit 371967f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions utils/.utils/mogg_to_wav_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python

import wave
import pyogg
import numpy as np

import sys

infn = sys.argv[1]
outbn = sys.argv[2]


mogg = pyogg.VorbisFile(infn)
n_ch = mogg.channels
print(infn, n_ch)

buff = mogg.buffer

for i in range(n_ch):
outfn = outbn + '.%d.wav' % i
print(outfn, i)
buff_arr = np.frombuffer(buff, dtype='int16')
with wave.open(outfn, "wb") as outf:
outf.setnchannels(1)
outf.setsampwidth(2) # number of bytes
outf.setframerate(44100)
outf.writeframesraw(buff_arr[i::11].tobytes())

0 comments on commit 371967f

Please sign in to comment.