Files
modgen/modgen.py

30 lines
735 B
Python
Executable File

#!/usr/bin/env python3
import sys
import struct
with open("out.mod", "wb") as fo:
# Module name.
fo.write(struct.pack("20s", "TEMP".encode('utf-8')))
for i in range(1,32):
# Sample name.
fo.write(struct.pack("22s", "SMPL".encode('utf-8')))
fo.write(struct.pack(">H", 0)) # Sample length.
fo.write(struct.pack(">B", 8)) # Finetune.
fo.write(struct.pack(">B", 64)) # Volume.
fo.write(struct.pack(">H", 0)) # Loop offset.
fo.write(struct.pack(">H", 0)) # Loop length.
fo.write(struct.pack(">B", 0)) # Song positions.
fo.write(struct.pack(">B", 42)) # Obsolete.
# Pattern table.
for i in range(0, 128):
fo.write(bytes(b"\x00"))
# 31 samples mode.
fo.write(struct.pack("4s", "M.K.".encode("ascii")))