mtm

package
v1.0.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mtm loads MultiTracker modules with reusable tracks and PCM samples.

Index

Constants

This section is empty.

Variables

View Source
var ErrRenaissanceRows = errors.New("tracker/mtm: MultiTracker Renaissance requires 64 rows per pattern; use the OpenMPT profile for shorter patterns")

ErrRenaissanceRows indicates a row count the original editor cannot load.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Note, Sample, Effect, Param uint8
}

Cell holds a native pitch, one-based sample number, and effect command.

type Module

type Module struct {
	Title          string
	Version        uint8
	Rows, Channels int
	Pan            [maxChannels]uint8
	Orders         []uint8
	Tracks         []Track
	Patterns       []Pattern
	Comments       string
	Samples        []Sample
}

Module contains the order list, reusable tracks, and sample bank.

func Load

func Load(r io.Reader) (*Module, error)

Load reads a module of at most 256 MiB.

func Parse

func Parse(data []byte) (*Module, error)

Parse validates and decodes an MTM file.

func (*Module) Metadata

func (m *Module) Metadata() tag.Metadata

Metadata returns the tags parsed from the MTM module.

type Pattern

type Pattern [maxChannels]uint16

Pattern holds one-based track references. Zero selects an empty track.

type Profile

type Profile uint8

Profile selects a driver and its speed and tempo policy. RenaissanceGUS uses separate row and effect timers and a 32-voice mixer with 64-row patterns. OpenMPT preserves both commands when a row sets speed and tempo.

const (
	RenaissanceGUS Profile = iota // Original Gravis UltraSound replay.
	OpenMPT                       // OpenMPT-compatible replay.
)

type Replay

type Replay[T audio.Sample] struct {
	// contains filtered or unexported fields
}

Replay applies MultiTracker commands to the shared tick player.

func NewReplay

func NewReplay[T audio.Sample](m *Module, profile Profile) (*Replay[T], tracker.ReplayConfig[T], error)

NewReplay builds a MultiTracker replay and its PCM instrument bank.

func (*Replay[T]) Reset

func (r *Replay[T]) Reset() error

Reset restores each channel's initial panning and clears effect memory.

func (*Replay[T]) StepTick

func (r *Replay[T]) StepTick(ctx *tracker.TickContext) error

StepTick applies row commands and advances ongoing effects in channel order.

type Sample

type Sample struct {
	Name               string
	FineTune           int8
	Volume             uint8
	Bits               int
	LoopStart, LoopEnd int64
	PCM                audio.Buffer[float64]
}

Sample describes unsigned PCM decoded into normalized mono frames. FineTune is signed and measured in eighths of a semitone. LoopStart and LoopEnd retain the byte offsets from the file header.

type Track

type Track [trackRows]Cell

Track stores the rows that a pattern can assign to a channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL