collab/PineapplePad

git clone https://git.julia.blue/collab/PineapplePad

Joseph RyanAdd sfx0e8c935

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