Skip to content

Instantly share code, notes, and snippets.

@Bejofo
Created February 10, 2023 18:29
Show Gist options
  • Save Bejofo/a43f7f73bcc8697926a8aa564bbee15f to your computer and use it in GitHub Desktop.
Save Bejofo/a43f7f73bcc8697926a8aa564bbee15f to your computer and use it in GitHub Desktop.
# script for ripping audio out of gamemaker audiogroup
in_file = open("./audiogroup1.dat", "rb") # opening for [r]eading as [b]inary
data = in_file.read()
start = data.find(b"OggS")-4 # not exactly reliable
idx = 0
while True:
size = int.from_bytes(data[start:start+4],'little')
f = data[start+4:start+4+size]
print(f"test{idx}.ogg - size:{size}")
with open(f"./test{idx}.ogg","wb") as new_file:
new_file.write(f)
idx+=1
start = data.find(b"OggS",start+size)-4
if start <= 0:
print("EOF")
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment