s3m

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: 11 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 s3m loads and replays Scream Tracker 3 modules.

Index

Constants

View Source
const Profile = "S3M PCM and melodic AdLib"

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 {
	HasNote, HasVolume, HasEffect            bool
	Note, Instrument, Volume, Command, Param uint8
}

Cell retains the fields present in an S3M pattern event.

type Clock

type Clock uint8

Clock selects the timing and mixer used for S3M playback.

const (
	IdealClock        Clock = iota // Continuous tracker tempo.
	SoundBlasterClock              // Original Sound Blaster Pro DMA timing and mixer.
	GravisClock                    // Original Gravis UltraSound timer and mixer.
)

type Module

type Module struct {
	Title                                  string
	Flags, Version, SampleFormat           int
	GlobalVolume, Speed, BPM, MasterVolume uint8
	ChannelSettings, Pan                   [channels]uint8
	HasPan                                 bool
	Orders                                 []uint8
	PlayableOrders                         []int
	Patterns                               []Pattern
	Samples                                []Sample
	// contains filtered or unexported fields
}

Module contains native orders, channel settings, timing and PCM.

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

func (*Module) Metadata

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

Metadata returns the tags parsed from the S3M module.

type Pattern

type Pattern [rows][channels]Cell

Pattern contains 64 rows in native channel order.

type Replay

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

Replay implements the S3M PCM profile.

func NewReplay

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

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

func NewReplayWithClock

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

NewReplayWithClock builds an S3M replay with the selected timing and mixer.

func (*Replay[T]) Reset

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

Reset clears channel state before a pass through the song.

func (*Replay[T]) StepTick

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

StepTick applies S3M row commands and advances regular slides.

type Sample

type Sample struct {
	Name, Filename                                  string
	Type, Volume, Packing, Flags                    uint8
	Length, LoopStart, LoopEnd, C2Speed, DataOffset int64
	PCM                                             audio.Buffer[float64]
	AdLib                                           [12]uint8
}

Sample retains the instrument header and decoded PCM planes or AdLib patch. 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