collab/PineapplePad
git clone https://git.julia.blue/collab/PineapplePad
0e8c935
master
1import sys 2 3if len (sys .argv )== 1 : 4"give me a file" 5sys .exit () 6 7outFile = open ("sfx.h" ,'w' ) 8outFile .write ("#include <stdint.h>\n" ) 9 10for i in sys .argv [1 :]: 11outFile .write ("const uint8_t " + i .split ('.' )[0 ]+ "[] = {\n" ) 12inFile = open (i ) 13 14limit = 20000 15# inFile.read(10000) # silence at the beginning of sound 16byte = inFile .read (1 ) 17while byte != '' and limit > 0 : 18outFile .write (str (int (ord (byte )))+ "," ) 19byte = inFile .read (1 ) 20limit -= 1 21inFile .close () 22outFile .write ("};\n" ) 23 24outFile .close ()