AudioProcessing.Compute.Stream.StepSequencer

This node implements a step sequencer interface that allows editing the rhythmic information for the playback of audio samples within the GSN Composer. It can be used for many tasks, starting from creating simple drum machine beats up to composing complete song with multiple instruments. As the GSN Composer is an online node-based programming environment, the input audio samples as well as the output audio streams of the step sequencer node can be freely modified with additional filters and audio effects. Another options is to trigger visual 2D or 3D effects based on the evaluated rhythmic information (as will be explained later in the text).

In the image below, the user interface of the step sequencer node is shown:

Each row of the interface contains the rhythmic information for a particular audio sample. In the example above, four audio samples named "Hihat", "Kick", "Snare", and "Crash" are present. The shown pattern has 16 steps per row advancing from left to right. Each beat comprises of four steps (as indicated by the dark vertical lines). Such a pattern can be interpreted as a musical bar with a signature of 4/4 (four beats per bar), where each step then corresponds to a sixteenth note. By clicking on the rounded square that represents a step, the triggering of the note can be turned on, which is indicated by the violet color. Another click turns it off, which is indicated by the gray color of the step. Therefore, in the example above, the hihat is triggered every eighth note, the kick every quarter note, the snare on the 2nd and 4th beat, and the crash on the 1st beat of the musical bar.

Song, patterns, and rows

The term "pattern" is very commonly used in the context of step sequencers and drum machines. A pattern is a building block of a song and consists of multiple rows that contain the rhythmic information to trigger the playback of an audio sample. Songs consist of multiple patterns that are played in a consecutive order. However, it is often the case that the same pattern should be played multiple times in the song. Therefore, a song is defined by a list of pattern indices, e.g., the song "0 1 0 2" first plays the pattern with index 0, then pattern 1, then again pattern 0, and finally the pattern with index 2.

Pattern row buttons

A pattern can consist of multiple rows. In the user interface, each pattern row has several per-row buttons on the left side, as can be seen in the figure above:

copyCopy row This button copies the content of the row. When holding down the shift key while pressing this button, multiple rows can be copied at once.
cutCut row The cut button removes the content of the row.
pastePaste row This button pastes the row content that was previously copied or cut. If multiple rows were copied with the shift key, the content of multiple rows is inserted into the pattern.
setSet rowThis button is useful if you want to turn on every note of a row. Furthermore, with each consecutive button click the gap between the notes becomes larger (every second note, every second off-beat note, every fourth note, every fourth off-beat note, etc.)
deleteDelete rowThis button deletes the row. If there are additional rows in the pattern below the current row, their content is shifted up.
insertInsert rowThis button inserts a new row. If there are additional rows in the pattern below the current row, their content is shifted down.

The button labeled "Ch. 0" toggles to which output channel the triggered audio samples of the row are streamed. In total, there are four options: "Ch. 0", "Ch. 1", "Ch. 2" and "Mute". The three output channels can be used, for example, as different post-processing effect channels. Toggling the channel output is valid for the corresponding row of all patterns of a song. If you want to toggle the output channel only for the current pattern, hold down the shift key while pressing the button.

Song buttons

At the top of the user interface the song information is shown and can be modified. In the example shown in the image below, the song consist of two patterns: First the pattern with index 4 is played and then the pattern with index 2. The triangle-shaped buttons allow to change the pattern index. The right arrow button creates a new pattern index next to the current one. If you hold down the shift key while pressing the right arrow button, the current pattern is cloned to a new pattern and the new pattern index is inserted next to the current one. The button with the black cross deletes a pattern index from the song.

step_sequencer_ui_labels

The white vertical bar is the song playback indicator that informs about the currently played position within the song. The playback from a particular pattern index of a song can be triggered by clicking on the corresponding song index button. Individual parts of a song can be enabled or disabled by clicking on a song index button while holding down the shift key (violet=enabled, gray=disabled).

Pattern mode button

The most important button of the interface is the "pattern mode button" in the top left corner. If the pattern mode is disabled the complete song is played and the currently played pattern index is shown as the label of the pattern mode button. If the pattern mode is enabled (by clicking on the pattern mode button), only the current pattern is played in a loop. This is very useful while working on the row information of a particular pattern. Once the pattern mode is disabled (by clicking the pattern mode button again), the pattern indices before and after the current pattern are enabled as well and the three pattern indices are played back in a loop. The reason for this is that after editing a pattern, it is often necessary to see how the changed pattern sounds in combination with its neighbors. Instead, if you want to toggle directly into the playback of the complete song, hold down the shift key when disabling the pattern mode.

Input Slots

The step sequencer node has the follow input slots:

  • Samples: This slot must be connected to a vector of signal data nodes that are used as audio samples for each pattern row. The name of the signal node is displayed as a white text within the pattern row (see images above)
  • Frame length: The step sequencer is intended to be used as a node in a streaming pipeline. This means it does not produce the audio signal for the complete song at once but only small sections called "frames". This input slot allows to choose the size of these frames. All frames concatenated together would result in the complete song. Which frame of the song is currently written depends on the internal frame counter that is automatically advanced after a new frame was written. The current frame counter is also provided as an output slot.
  • Reset: If this Boolean value is set to true, the frame counter is reset to zero.
  • Loop: If this Boolean value is set to true, the song repeats from the beginning once its end is reached.
  • Pause: If this Boolean value is set to true, the step sequencer is paused, no output is generated, and the frame counter is not increased.
  • Visual offset: The output streams of the step sequencer are typically not played directly but are buffered for continuous playback. Thus, to visually synchronize the playback and the output, a visual offset can be set here (in number of sample values).
  • Overlap length: The overlap length value specifies how many additional sample values are computed at the front and the back of the current stream processing frame. The total output length is the frame length plus two times the specified overlap length. The default value is 0. Changing it to some other value is only required in the rare case that you are implementing some custom filter chains at the output that require not only the current samples but also a certain neighborhood.
  • Sample rate: This slot specifies the sample rate of the input and output signals. Input samples are not resampled internally and must therefore have the same sample rate.
  • Beats per minute: The number of beats per minute (BPM). For example, 60 bpm is considered a rather slow tempo, and 180 bpm rather fast. You can change this value at any point while composing a song because it influences only the output and not the stored rhythmic information.
  • Steps per beat: Steps per beat of a new pattern that can be created with the "new pattern" button (see above).
  • Steps per pattern: Steps per pattern of a newly created pattern. By choosing the desired combination of steps per beat and steps per pattern not only the musical patterns with the todays common 4/4 signature can be realized but also waltz, 5/4 beats, or shuffle rhythms.

Output Slots

The step sequencer node has the follow output slots:

  • Channel 1,2,3: The step sequencer has three output channels that can be used, for example, as different post-processing effect channels.
  • Overlap: This is a copy of the value that is set at the overlap length input slot.
  • Frame counter: The frame counter is automatically increased internally with each processed frame. It is reset to zero with the reset input slot. If loop is set to true, the song is looped and the frame counter will continue to increase beyond the song length.
  • Song pos.: This slot informs about the position (sample value offset) of the current frame within the song.
  • Step info: A text with detailed information about the steps/notes that are triggered in the current frame. The text starts with "[SongIndex,PatternIndex,PlayedStep]:" and continues with a comma separated string for each triggered note/step with the format:
    • audio sample number,
    • the letter "d" for "down" or "h" for "hold",
    • position of the note/step within the frame,
    • the letter "v" followed by the velocity in range 0 to 255,
    • the letter "c" followed by the index of the output channel.
    • If the note was released, an additional letter "u" for "up" is appended.
    This step information can be parsed, for example, to trigger visual 2D or 3D effects based on the currently played notes.
  • Vis info: A text with detailed information about the steps/notes that are triggered since the last update. In contrast to the step info slot the output of this slot is synchronized to the visualization (see also visual offset above). The text starts with "[SongIndex,PatternIndex,PlayedStep]:" and continues with a comma separated string for each triggered note/step with the format:
    • audio sample number,
    • the letter "d" for "down" or "h" for "hold",
    • the number of sample values that have been played from the corresponding audio sample
    • the letter "v" followed by the velocity in range 0 to 255,
    • the letter "c" followed by the index of the output channel.
    • the number of sample values that have been played from the corresponding audio sample normalized to the total length of audio samples (in per mille)
    This visualization information can be parsed, for example, to trigger visual 2D or 3D effects based on the currently played notes.
  • View X,Y: Internal variables that store the pagination information of the view.
  • Song: List of pattern indices that represent the song. If an song index is disabled a "D" is appended to the number.
  • Patterns: Text that contains the pattern information. Each pattern starts with a line in square brackets containing "[Steps per pattern, Steps per beat]". Then each new line contains the row information as a colon separated list starting with the output channel number as the first entry followed by an arbitrary number of (Step index,velocity) pairs in round brackets.

Example: Drum Machine

This is a drum machine example with some funky drum sounds. Sounds can be changed by creating a new project and uploading own audio samples.

Example: Instrument

In this example, the InstrumentNode is used to create 72 semitones of a piano from a total of 14 audio samples. The 72 semitones are fed as inputs to a StepSequencerNode, which plays the beginning of Beethoven's "Für Elise".

Example: Complete Song / Stream Delay

This example shows how to compose a complete song using the online step sequencer (including drums, bass, and a lead voice). The lead voice is routed to output channel 1, where a delay effect is added.

You can upload other audio samples by creating your own new project.

If you want to create a new song with the audio samples provided in this example, it is easiest to clone the example project:

  • Go to Project → Clone Project
  • Enter a new project name
  • Press the "Clone Project: publicSong" button

A new project is created and you can save your edits to the song.

Please contact me if you have suggestions for improvement or if you need support.