stm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 9 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 stm loads Scream Tracker 2 embedded-sample modules.

Index

Constants

View Source
const Profile = "STM mono"

Profile identifies the native four-channel STM replay and mono mixer.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Note, Instrument, Volume, Command, Param uint8
}

Cell is one decoded STM note, volume and effect. Note 254 cuts the current voice. Note 255 and volume 65 stand for omitted fields.

type Driver

type Driver uint8

Driver selects a Scream Tracker 2 playback revision. Later trackers share the 2.21 on-disk marker, so the caller chooses their playback behavior.

const (
	ST22  Driver = iota // Original 2.2 replay from st2play's master branch.
	ST224               // 2.24 arpeggio and sample tuning.
	ST23                // 2.3 clock, mixer, and combined effects.
)

type Module

type Module struct {
	Title, Tracker      string
	Version             int
	Tempo, GlobalVolume uint8
	Orders              []uint8
	Patterns            []Pattern
	Samples             [instruments]Sample
}

Module holds an STM score and its embedded instruments. Tempo stores the speed and tempo adjustment as a byte with two nibbles.

func Load

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

Load reads an STM module of at most 256 MiB.

func Parse

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

Parse validates and decodes the on-disk Scream Tracker 2 module.

func (*Module) Metadata

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

Metadata returns the tags parsed from the STM module.

type Pattern

type Pattern [rows][channels]Cell

Pattern contains one STM pattern in playback order.

type Replay

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

Replay applies native STM row and tick rules over a single mono PCM mixer.

func NewReplay

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

NewReplay builds the STM replay and its shared tracker player configuration.

func NewReplayWithDriver

func NewReplayWithDriver[T audio.Sample](m *Module, driver Driver) (*Replay[T], tracker.ReplayConfig[T], error)

NewReplayWithDriver builds a replay for the specified Scream Tracker 2 driver.

func (*Replay[T]) Reset

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

Reset clears all effect and mixer state for another pass.

func (*Replay[T]) StepTick

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

StepTick applies STM commands and updates the mono mixer registers.

type Sample

type Sample struct {
	Filename                                     string
	DataOffset, Length, LoopStart, LoopEnd, Rate int
	Volume                                       uint8
	PCM                                          []int8
}

Sample holds the signed mono sample and native loop boundaries. LoopEnd 65535 means the sample is a one-shot.

Jump to

Keyboard shortcuts

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