TrainCarts/Attachments/Sequencer
Introduction
The sequencer attachment is like the real-life equivalent of a music sequencer. It can be used to activate effects in sequence on a loop. It supports the engine start-loop-stop logic to allow for realistic train engine sounds to be played. The sequencer itself does not configure any sounds. It activates other named effect attachments like the sound attachment.
Like other effect attachments, the sequencer must be activated. It can also be set to automatically play.
Categories
There are three categories, each with their own configuration and list of effects to play:
- Start - Plays once when the effect is first played
- Loop - Plays on a loop over and over after the start sequence finished playing
- Stop - Plays once when the effect is stopped after playing
Duration
For how long this category plays or loops. The category is enabled if the duration is set to more than 0 (off).
Playback Speed
Controls the rate of playback of all effects under this category. Can be tied with functions to inputs such as the train speed.
Interrupt Play
Whether to interrupt playback when playing state changes. For example, if enabled for Start, the playback is aborted when the sequencer is stopped moving straight to the stop sequence.
Adding Sequences
The [+] button can be used to add new effects to play under a category. The menu first asks for the effect name to play. It then can add one of several sequence types:
- Simple - Simply plays the effect once, optionally with a delay
- MIDI - Allows for a melody to be configured using a piano roll
Configuration
After selecting a sequence, multiple options are available. From left to right:
Preview button
Plays the sequence. In the case of MIDI, plays the full melody.
Configure Type
Configures the piano roll for MIDI, or opens a menu to configure the delay for the simple sequence.
Configure Effect
Configures the effect name activated by the sequence.
Configure Sequence
Opens a menu to configure three options:
- Active - Makes the effect conditionally play. You can use this with input functions to, for example, only play the sound when a player is in a seat, or when a certain tag is set on the train.
- Volume - Volume multiplier for the effect. Use this to have an effect volume controlled by, for example, the speed of the train.
- Pitch - Pitch (speed) multiplier for the effect. Use this to have an effect pitch controlled by, for example, the speed of the train.
Delete
Deletes the sequence. Asks to confirm first.
Other Options
At the top of the menu several other options are available
Synchronous
Switch between async/sync playback. Asynchronous playback is not affected by server lag. However, this can cause it to go out of sync with for example redstone-timed effects. Asynchronous is preferred, as it allows for smooth uninterrupted sound loops.
Autoplay
Automatically play the sequencer based on a condition, or all the time. This allows effects to be automatically played when a certain condition is met. For example, you can make a sound play when a player steps into the cart, or when the train goes from not moving to moving.
Play
Override autoplay and play the sequencer, or stop it again. Use this to test the play/stop behavior