Sign in to follow this  
Followers 0
SadBunny

Script that molests mp3 files - just because I secretly like shit music

5 posts in this topic

Hi! I wrote a small script, just for fun, that makes a molested (but intact!) copy of an mp3 file by reading in it's frames, manipulating the binary data randomly, and saving it to another file.

This was done for fun on the Dutch Synthesizer Forum thread "Make A Shit Track On Purpose" thread that has been going on actively for over the past four years with almost 6000 posts and 5 GB of dedicatedly composed music in total :D Great little place to hang out if you like to punish your auditory sense every now and then.

Also I thought it'd be fun just to try to read a multimedia file as a binary, handle it into it's frames and then manipulate it, and saving it in a working form again. Just to see what all those music software coders do all day :o And to try to make it fast, and very compactly coded.

This will ask you for a shit factor promillage ("verkuttingspromillage"), and then ask for an imput file. It reads the imput file 'binarily' (is that a word?), filters it into a big array with all the frames in the elements as hex strings, and then changes <verkuttingspromillage> promille of the bytes in every frame to a random byte. Finally, it asks you where to save the copy.

Enjoy the Crappiness! :D

#include <array.au3>

$opneukPromillage = Int(InputBox("SadBunny's Kutnummer Verkutter ± 2.13 2/3 ", "Welk promillage (1 promille = 1 van de 1000!) van de bytes in de frames moet verwillekeurd worden? (NB: Alléén gehele getallen invoeren.)"&@CRLF&@CRLF&"A.k.a.: Kies Uw Verkuttingspromillage."&@CRLF&@CRLF&"NB: 10 promille is al Best Kut! Reeds!",10,"",400,200))
If $opneukPromillage <= 0 Then Exit

$file = FileOpenDialog("Welke MP3 wil je afgrijselijk verkutten?",@MyDocumentsDir,"mp3 (*.mp3)",1)
If $file = "" Or @error Then Exit

Dim $ar_hexChars[16] = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"]
ProgressOn("Verkutting","Wacht tot het kutnummer geladen is...")
$ar_fileStrings=StringSplit(StringReplace(StringReplace(FileRead(FileOpen($file,16)),"FFE","!@"),"FFF","!#"),"!")
$newFile = StringLeft(ProgressOn("Verkutting","Wacht op de Totale Verkutting..."),0)
For $teller = 1 To $ar_fileStrings[0]
    $ar_fileStrings[$teller] = StringReplace(StringReplace($ar_fileStrings[$teller], "@", "FFE"), "#", "FFF")
    If StringLen($ar_fileStrings[$teller]) < 10 Then
        $newFile &= $ar_fileStrings[$teller]
    Else
        $newFile &= _verklootFrame($ar_fileStrings[$teller])
    EndIf
    ProgressSet(Int($teller/$ar_fileStrings[0]*100))
Next
ProgressOff()

$fileToWrite=FileSaveDialog("Opslaan als?","","mp3 (*.mp3)",18,"Verkutte_"&StringMid($file,StringInStr($file,"\",-1)+1))
If $fileToWrite = "" Or @error Then Exit
FileWrite(FileOpen($fileToWrite, 18),$newFile)
Exit

Func _verklootFrame($frame)
    For $loop = 1 To Int(StringLen($frame)/1000*$opneukPromillage)
        $i = Random(10, StringLen($frame), 1)
        $frame = StringLeft($frame, $i - 1) & $ar_hexChars[Random(0, 15, 1)] & StringRight($frame, StringLen($frame) - $i)
    Next
    Return $frame
EndFunc  ;==>_verklootFrame

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites



#include <array.au3>

$opneukPromillage = Int(InputBox("SadBunny's Kutnummer Verkutter ± 2.13 2/3 ", "Welk promillage (1 promille = 1 van de 1000!) van de bytes in de frames moet verwillekeurd worden? (NB: Alléén gehele getallen invoeren.)"&@CRLF&@CRLF&"A.k.a.: Kies Uw Verkuttingspromillage."&@CRLF&@CRLF&"NB: 10 promille is al Best Kut! Reeds!",10,"",400,200))
If $opneukPromillage <= 0 Then Exit

$file = FileOpenDialog("Welke MP3 wil je afgrijselijk verkutten?",@MyDocumentsDir,"mp3 (*.mp3)",1)
If $file = "" Or @error Then Exit

Dim $ar_hexChars[16] = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"]
ProgressOn("Verkutting","Wacht tot het kutnummer geladen is...")
$ar_fileStrings=StringSplit(StringReplace(StringReplace(FileRead(FileOpen($file,16)),"FFE","!@"),"FFF","!#"),"!")
$newFile = StringLeft(ProgressOn("Verkutting","Wacht op de Totale Verkutting..."),0)
For $teller = 1 To $ar_fileStrings[0]
    $ar_fileStrings[$teller] = StringReplace(StringReplace($ar_fileStrings[$teller], "@", "FFE"), "#", "FFF")
    If StringLen($ar_fileStrings[$teller]) < 10 Then
        $newFile &= $ar_fileStrings[$teller]
    Else
        $newFile &= _verklootFrame($ar_fileStrings[$teller])
    EndIf
    ProgressSet(Int($teller/$ar_fileStrings[0]*100))
Next
ProgressOff()

$fileToWrite=FileSaveDialog("Opslaan als?","","mp3 (*.mp3)",18,"Verkutte_"&StringMid($file,StringInStr($file,"\",-1)+1))
If $fileToWrite = "" Or @error Then Exit
FileWrite(FileOpen($fileToWrite, 18),$newFile)
Exit

Func _verklootFrame($frame)
    For $loop = 1 To Int(StringLen($frame)/1000*$opneukPromillage)
        $i = Random(10, StringLen($frame), 1)
        $frame = StringLeft($frame, $i - 1) & $ar_hexChars[Random(0, 15, 1)] & StringRight($frame, StringLen($frame) - $i)
    Next
    Return $frame
EndFunc ;==>_verklootFrame
Creative naming used .... Wonder how this all translates to English. :D

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Creative naming used .... Wonder how this all translates to English. :D

I guess it doesn't... :D

The thread in question is called "Maak Bewust Een Kutnummer" and it's a sport to spout that word as many times as possible. As badly as possible, too... :o


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

I guess it doesn't... :D

The thread in question is called "Maak Bewust Een Kutnummer" and it's a sport to spout that word as many times as possible. As badly as possible, too... :o

BableFish: "Make consciously Kutnummer" :D

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0