Skip to content

Instantly share code, notes, and snippets.

View HertzDevil's full-sized avatar
⚒️

Quinton Miller HertzDevil

⚒️
View GitHub Profile
@HertzDevil
HertzDevil / organ.lua
Created January 9, 2016 10:50
n163 fti organ generator
local MULT = {1, 3, 2, 4, 6, 8, 10, 12, 16}
local assertParams = function (t)
assert(type(t.file) == "string",
"Bad filename")
assert(type(t.vol) == "table" and #t.vol == #MULT,
"Bad partial volume")
assert(not t.master or (type(t.master) == "number" and t.master >= 0),
"Bad master volume")
assert(type(t.wavelen) == "number" and t.wavelen % 4 == 0 and t.wavelen >= 4 and t.wavelen <= 240,
@HertzDevil
HertzDevil / ft_gb.md
Last active June 5, 2022 02:24
famitracker nsf driver game boy port

A WLA DX port of the FamiTracker / 0CC-FamiTracker NSF driver with an external compiler script that allows certain binary music data exported from the tracker to play properly as a GBS music file or a GB ROM file.

The Roadmap

  • Port NSF driver to GB-Z80
    • driver.s
    • init.s
    • player.s
    • effects.s
    • instrument.s
  • apu.s
@HertzDevil
HertzDevil / !0cc_status.md
Last active January 11, 2017 17:04
FamiTracker 0.5.0 Beta 5 File Format Differences

PARAMS

  • Reading: Done
  • Refresh rate: Converts to integer rate if custom rate is used, otherwise assumes default rate
  • 2A03 sweep reset flag: Read but discarded
  • Highlight settings: Done
  • Global tuning: Done, data currently saves to PARAMS_EXTRA block

HEADER

@HertzDevil
HertzDevil / dump.lua
Created August 19, 2016 03:29
MDRV2 MDT to MML unconverter
-- MDT filename is the only command line argument
local schar = function (f)
local z = string.byte(f:read(1))
return z >= 0x80 and z - 0x100 or z
end
local char = function (f)
return string.byte(f:read(1))
end
local sshort = function (f)
@HertzDevil
HertzDevil / mm3.lua
Last active September 3, 2016 22:22
how to write an MML compiler
-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
--- The Mega Man 3 - 6 MML engine.
-- @module mm3
-- [Commands Reference](https://gist.github.com/HertzDevil/0f868d77a32f92c2877b7ce304f29c53)
local require = require
@HertzDevil
HertzDevil / decompile_test.lua
Last active September 17, 2016 14:53
how to write an MML decompiler
#! /usr/bin/lua
-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
require "util.stringfuncs"
local Dumper = require "util.streamdumper"
local name = arg[1]
@HertzDevil
HertzDevil / minimal.lua
Last active October 15, 2016 20:28
how to use the MML compiler framework
-- MGCInts library
-- this imports most modules except those in util
local MGCInts = require "mgcints"
-- create a default engine with 4 channels
local engine = MGCInts.Default.Engine(4, "test driver")
local macros = engine:getCommandTable()
local builder = MGCInts.MML.CmdBuilder()
-- build some dummy commands
@HertzDevil
HertzDevil / README.md
Last active October 17, 2016 07:53
MGCInts readme

MGCInts

MGCInts (MML Generic Compiler Interfaces) is a Lua framework for creating binary music compilers with a uniform Music Macro Language syntax. It also contains a frontend to compile its own MML files directly.

MGCInts is licensed under Mozilla Public License Version 2.0.

Features

@HertzDevil
HertzDevil / minimal3.lua
Last active October 25, 2016 09:27
how to add muting support to any MML compiler
local MGCInts = require "mgcints"
local engine = MGCInts.Default.Engine(4, "test driver")
local macros = engine:getCommandTable()
local builder = MGCInts.MML.CmdBuilder()
-- this one-liner gives everything we need
engine:importFeature(require "mgcints.mml.feature.mute")
-- extra: show information about the feature (will be available from the frontend)
print(require "mgcints.mml.feature.mute":description())
@HertzDevil
HertzDevil / COMPAT.MD
Created January 30, 2017 11:55
FamiTracker compatibility

FamiTracker Compatibility

This file is targeted for 0CC-FamiTracker 0.3.14.5.

This special file lists all known sources of incompatibilities between FamiTracker 0.4.6 modules and 0CC-FamiTracker modules. Some sources for 0.5.0 beta are also included below; the remaining can be found here. Items in boldface can lead to undefined behaviour in the vanilla builds. (The vanilla builds do not perform sufficient cleanup after they invalidate modules, so simply trying to read a rejected module might crash FamiTracker nonetheless.)

PARAMS, PARAMS_EXTRA

  • The N163 chip will steal FDS/VRC7/5B channels to maximize its channel count in the vanilla builds, when fewer than 8 are used.
  • Modules that enable all expansion chips are rejected by the vanilla builds.