Polyend Tracker Library - v0.1.1
    Preparing search index...

    Class Tracker

    Read and write Tracker Projects, Patterns and Instrument files.

    Index

    Methods

    • Creates an instrument object with specified properties, including sample data, slices, automation settings, and other configurations.

      Parameters

      • OptionalwavBuffer: ArrayBuffer

        An optional WAV file buffer containing the sample data for the instrument. If not provided, a default empty buffer is used.

      • Optionalslices: number[]

        An optional array of slice start positions for beat slicing mode. If not provided, no slices are defined.

      Returns InstrumentData

      The constructed instrument object containing all the properties needed for playback and processing.

    • Creates a pattern structure with the specified number of tracks and steps.

      Parameters

      • numTracks: number

        The number of tracks to include in the pattern. Should either be 12 (for OG Tracker) or 16 (for Tracker+ and Mini).

      • numSteps: number

        The number of steps per track in the pattern. Min: 1, Max: 128.

      Returns PatternData

      An object containing the pattern data, including header, tracks, and other metadata.

    • Generates metadata for a set of patterns.

      Parameters

      • patternNames: string[]

        An array of pattern names to include in the metadata.

      Returns PatternsMetadata

      The metadata object containing header information and the provided pattern names.

    • Creates a new project with default configurations and the specified project name.

      Parameters

      • projectName: string

        The name of the project to be created. Max 32 characters. Will be truncated if longer.

      Returns ProjectData

      The newly created project data object containing header information, project settings, and initial values.

    • Reads and parses instrument data from a provided .pti file.

      Parameters

      • file: string | File

        The file path or File object containing the .pti instrument data to be read.

        • Browser based projects: Pass a File object
        • NodeJS based projects: Use a string based file path

      Returns Promise<InstrumentData | null>

      A promise that resolves to the parsed InstrumentData if successful, or null if the data cannot be read or parsed.

    • Reads a pattern from the specified file and parses it into a PatternData object.

      Parameters

      • file: string | File

        The file to read the pattern data from. Can be a file path or a File object.

      Returns Promise<PatternData | null>

      A promise that resolves to a PatternData object if parsing is successful, or null if the input cannot be processed.

    • Reads and parses the patterns metadata from the given file.

      Parameters

      • file: string | File

        The file to read the patterns metadata from. Can be a file path or a File object.

      Returns Promise<PatternsMetadata | null>

      A promise that resolves to the parsed patterns metadata if successful, or null if the file content is invalid or cannot be processed.

    • Reads and parses a project file into a ProjectData object.

      Parameters

      • file: string | File

        The file path or File object to be read and parsed.

      Returns Promise<ProjectData | null>

      A promise that resolves to a ProjectData object if parsing is successful, or null if the input is not valid.

    • Writes the provided instrument data to a file in the specified format.

      Parameters

      • instrument: InstrumentData

        The instrument data to be written to the file.

      • Optionalfilename: string

        Optional filename to write the instrument data. If not provided, the default filename will be derived from the instrument's sample filename with a .pti extension.

      Returns Promise<void>

      A promise that resolves when the file has been successfully written.

    • Writes a given pattern to a file. The pattern data is serialized and saved to the specified filename. If no filename is provided, a default name is used.

      Parameters

      • pattern: PatternData

        The pattern data to be written to the file.

      • Optionalfilename: string

        Optional. The name of the file to write to. Defaults to "pattern.mtp".

      Returns Promise<void>

      A promise that resolves when the file has been successfully written.

    • Writes the given patterns metadata to the appropriate storage or file system.

      Parameters

      • metadata: PatternsMetadata

        The metadata object containing patterns information to be written.

      Returns Promise<void>

      A promise that resolves when the metadata is successfully written.

    • Writes the provided project data to the appropriate storage or system.

      Parameters

      Returns Promise<void>

      A promise that resolves when the project data has been successfully written.