Created
June 2, 2011 03:59
-
-
Save b1naryth1ef/1003914 to your computer and use it in GitHub Desktop.
Broken AIFF to MP3 in a very basic way. Skips some bytes, may not work on extremely large corrupted files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<gator> | |
[.load] | |
.byte | |
.audio(mp3) | |
.audio(aif) | |
.adioctrl | |
.randy | |
[/] | |
!err(error){ | |
push error screen | |
die.err(error) | |
} | |
env(){ | |
for call in ._self: | |
g.eval(call) | |
on.g.eval error: | |
!err(g.eval.error) | |
} | |
env.holder(){ | |
init vhdd[*] | |
init vram2[*] | |
} | |
vram2($any){ | |
$any.safe | |
$any :> ._vram2 | |
} | |
vhdd($any){ | |
if $any == "r": | |
._vhdd:>return | |
$any.safe | |
$any :> ._vhdd | |
} | |
main(){ | |
for sys.arg: | |
if sys.arg.type(.path) | |
load(sys.arg) | |
else: | |
!err("System argument is incorrect! Must be path to broken .aif file!") | |
} | |
load(file){ | |
if file.type(".aif"): | |
f = load.file(_vram_) | |
transfer(f) | |
else: | |
!err("File is not a .aif") | |
} | |
order(b){ | |
x = "" | |
for byte in b: | |
for byte as list: | |
byte.place = b.spot | |
list = b.spot, b.idf | |
x.append(list) | |
b :> return | |
} | |
near(){ | |
for input: | |
try: | |
x = input.ascii() | |
if x.valid(): | |
x:>return | |
else: | |
y = "0" | |
y:>return | |
} | |
transfer(){ | |
b = bytes(_vram_) | |
b.order = order(b) | |
for byte in b: | |
if byte.valid(ascii) | |
vhdd(byte) | |
else: | |
byte.replace(near()) | |
vhdd(byte) | |
check(vhdd(r)) | |
} | |
check(hd){ | |
z = "" | |
z.order = order(hd) | |
if b.order = z.order: | |
convert(hd) | |
else: | |
!err("Order of transfer was incorrect!") | |
} | |
convert($hdx){ | |
original = audio.aiff($hdx) | |
audio.convert($hdx:>file_%.mp3) | |
where % is randy.num(1,1000) | |
while audio.convert.done(): | |
end() | |
} | |
end(){ | |
gator.exit(0) #A safe clean exit! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment