Working pattern data writer.
This commit is contained in:
17
modgen.py
17
modgen.py
@@ -13,12 +13,12 @@ with open("out.mod", "wb") as fo:
|
||||
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", 0)) # 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", 1)) # Song positions.
|
||||
fo.write(struct.pack(">B", 42)) # Obsolete.
|
||||
|
||||
# Pattern table.
|
||||
@@ -27,3 +27,16 @@ with open("out.mod", "wb") as fo:
|
||||
|
||||
# 31 samples mode.
|
||||
fo.write(struct.pack("4s", "M.K.".encode("ascii")))
|
||||
|
||||
# Pattern data.
|
||||
for i in range(0, 1):
|
||||
for r in range(0,64):
|
||||
for c in range(0, 4):
|
||||
period = 214;
|
||||
effect = 0;
|
||||
sample = 1;
|
||||
|
||||
div0 = (period & 0xFFF) | ((sample & 0xF0) * 256)
|
||||
div1 = (effect & 0xFFF) | ((sample & 0xF) * 4096)
|
||||
fo.write(struct.pack(">H", div0))
|
||||
fo.write(struct.pack(">H", div1))
|
||||
|
||||
Reference in New Issue
Block a user