BlipKit
by Detomon
BlipKit for Godot Engine 4.3
A GDExtension for creating the beautiful sound of old sound chips.
- Generate waveforms: square, triangle, noise, sawtooth, sine, and custom ones using BlipKitTrack
- Create pitch, volume, panning, and duty cycle envelopes using BlipKitInstrument
- Load and play audio samples from
AudioStreamWAV
using BlipKitSample - Provides a basic byte code interpreter to generate more complex melodies and reuse patterns
Contents
Installation
- Search for
BlipKit
in theAssetLib
editor tab - Download and install the plugin
- Enable the plugin in the project settings via the
Plugins
tab
or...
- Clone this repository or download the archive
- Copy the folder
addons/detomon.blipkit
to your project'saddons
folder (create it if needed) - Enable the plugin in the project settings via the
Plugins
tab
Introduction
The BlipKitTrack class generates a single waveform. Multiple tracks can be attached to a AudioStreamBlipKit, which then mixes the audio. As with every audio stream, it can be used with AudioStreamPlayer
, AudioStreamPlayer2D
or AudioStreamPlayer3D
nodes.
Time is measured in ticks. Every tick allows properties of the waveform to be updated. The tick rate is 240
ticks per second.
Usage
- Create an
AudioStreamPlayer
node and add an AudioStreamBlipKit resource - Attach BlipKitTrack objects to the stream resource
- Change properties of the BlipKitTrack to play notes, change the volume etc.
Tip
See the examples directory for some examples.
Class descriptions are available in the Editor via the reference documentation after the extension is loaded, or in the doc/classes directory.
Examples
- Play an iconic startup sound (Power On!):
extends Node
# Create a track.
var _track := BlipKitTrack.new()
# Create an instrument.
var _instr := BlipKitInstrument.new()
# An audio player with an `AudioStreamBlipKit` resource.
@onready var _player: AudioStreamPlayer = $AudioStreamPlayer
func _ready() -> void:
# Set pitch sequence:
# - Play lower octave for 18 ticks (defined with `_track.instrument_divider`)
# - Then play current note as long as the note is playing
_instr.set_envelope(BlipKitInstrument.ENVELOPE_PITCH, [-12, 0])
# Set volume envelope:
# - Set volume to 1.0 for 0 ticks (do not slide from previous value)
# - Keep volume on 1.0 for 18 ticks
# - Slide volume to 0.0 for 162 ticks
_instr.set_envelope(BlipKitInstrument.ENVELOPE_VOLUME, [1.0, 1.0, 0.0], [0, 18, 162])
# Set duty cycle of square wave to 50%.
_track.duty_cycle = 8
# Set instrument.
_track.instrument = _instr
# Set number of ticks per envelope sequence value.
_track.instrument_divider = 18
# Get the audio stream.
var stream: AudioStreamBlipKit = _player.stream
# Attach the track to the audio stream.
_track.attach(stream)
# Add a divider and call it every 360 ticks (1.5 seconds).
_track.add_divider(360, func () -> int:
# Release previous note to start instrument again.
_track.release()
# Play note C on octave 6.
_track.note = BlipKitTrack.NOTE_C_6
# Do not change tick rate of divider.
return 0
)
Byte code interpreter
The byte code assembler allows to create instructions to play patterns.
- BlipKitAssembler generate byte code from instructions
- BlipKitInterpreter execute the byte code on a BlipKitTrack to change its properties over time
Examples
- Play an iconic startup sound (Power On! Assembler version).
- Play on multiple tracks (Bytecode).
Classes
- AudioStreamBlipKit
- BlipKitAssembler
- BlipKitBytecode
- BlipKitInstrument
- BlipKitInterpreter
- BlipKitSample
- BlipKitTrack
- BlipKitWaveform
References
Uses the BlipKit library to generate audio.
Download
Support
If you need help or have questions about this plugin, please contact the author.
Contact Author