it

package
v1.0.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 it loads and replays Impulse Tracker modules.

Index

Constants

View Source
const Profile = "Impulse Tracker PCM sample and instrument modes"

Profile is the name of the supported playback profile.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

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

Cell retains the resolved note, instrument, volume-column, and command fields. Mask carries the native packing bits, including reuse flags.

type Envelope

type Envelope struct {
	Flags, LoopStart, LoopEnd, SustainStart, SustainEnd uint8
	Points                                              []EnvelopePoint
}

Envelope contains native interpolation points and loop indices.

type EnvelopePoint

type EnvelopePoint struct {
	Tick  int
	Value int8
}

EnvelopePoint is a native tracker tick and its signed value.

type Instrument

type Instrument struct {
	Name, Filename                                 string
	NewNoteAction, DuplicateCheck, DuplicateAction uint8
	Fadeout                                        int
	PitchPanSeparation                             int8
	PitchPanCenter, GlobalVolume, Pan              uint8
	RandomVolume, RandomPan                        uint8
	FilterCutoff, FilterResonance                  uint8
	MIDIChannel, MIDIProgram                       uint8
	MIDIBank                                       int
	Keys                                           [120]Key
	VolumeEnvelope, PanEnvelope, PitchEnvelope     Envelope
}

Instrument contains the native IT keymap, voice actions and envelopes.

type Key

type Key struct {
	Note, Sample uint8
}

Key maps an IT note to a transposed note and a one-based sample number.

type Module

type Module struct {
	Title, Message                                                   string
	CreatedVersion, CompatibleVersion, Flags, Special                int
	HighlightMinor, HighlightMajor                                   uint8
	GlobalVolume, MixVolume, Speed, BPM, Separation, PitchWheelDepth uint8
	ChannelPan, ChannelVolume                                        [headerChannels]uint8
	Orders                                                           []uint8
	PlayableOrders                                                   []int
	InstrumentOffsets                                                []int64
	Instruments                                                      []Instrument
	Patterns                                                         []Pattern
	Samples                                                          []Sample
	// contains filtered or unexported fields
}

Module contains the native order table, timing, channel settings and samples.

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 IT orders, packed patterns, instruments and PCM.

func (*Module) Metadata

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

Metadata returns the tags parsed from the IT module.

type Pattern

type Pattern [][channels]Cell

Pattern stores rows in native channel order.

type Replay

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

Replay implements the IT PCM sample and instrument profiles.

func NewReplay

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

NewReplay builds the native-channel configuration and bank of PCM samples.

func NewReplayWithOptions

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

NewReplayWithOptions builds a native IT replay with the selected clock.

func (*Replay[T]) Reset

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

Reset restores the header's channel state before a pass through the song.

func (*Replay[T]) StepTick

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

StepTick applies IT sample-mode row commands and later-tick slides.

func (*Replay[T]) StoppedAtRestart

func (r *Replay[T]) StoppedAtRestart() bool

StoppedAtRestart reports whether StopAfterLoop ended the current pass at a jump to a previously played row.

type ReplayOptions

type ReplayOptions struct {
	ImpulseTrackerWAV bool // Use the original WAV driver's clock and PCM mixer.
	// StopAfterLoop ends playback when a position jump attempts to re-enter
	// a row already visited in this pass. Pattern-loop commands still run.
	StopAfterLoop bool
}

ReplayOptions selects the output clock for an IT replay.

type Sample

type Sample struct {
	Name, Filename                                                            string
	GlobalVolume, Flags, Volume, Convert, Pan                                 uint8
	Length, LoopStart, LoopEnd, C5Speed, SustainStart, SustainEnd, DataOffset int64
	VibratoSpeed, VibratoDepth, VibratoRate, VibratoType                      uint8
	PCM                                                                       audio.Buffer[float64]
}

Sample retains the sample-mode PCM header and decoded sample planes. Lengths and loop points are in source frames.

Jump to

Keyboard shortcuts

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