Packages

A simple OSC transport layer for communicating with SuperCollider from Elixir. Provides low-level OSC messaging and node/group management for live coding and audio synthesis. Requires SuperCollider to be installed on your system.

Current section

Files

Jump to
waveform lib mix tasks waveform.check.ex
Raw

lib/mix/tasks/waveform.check.ex

defmodule Mix.Tasks.Waveform.Check do
@moduledoc """
Tests SuperDirt functionality by playing sample sounds.
This task verifies that:
- SuperDirt is installed and running
- Buffer configuration is correct (4096 buffers)
- Dirt-Samples are loaded properly
- Sample playback works
## Usage
mix waveform.check
You should hear four sounds in sequence: kick, snare, hi-hat, and clap.
If you don't hear all sounds, the task will provide troubleshooting guidance.
## Prerequisites
Before running this task:
1. SuperCollider must be installed
2. SuperDirt Quark must be installed
3. Dirt-Samples should be installed (run `mix waveform.install_samples`)
"""
@shortdoc "Tests SuperDirt by playing sample sounds"
use Mix.Task
@impl Mix.Task
def run(_args) do
Mix.shell().info("""
πŸ”Š SuperDirt Verification
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Testing SuperDirt with multiple samples to verify:
βœ“ SuperDirt is installed
βœ“ Buffer configuration is correct (4096 buffers)
βœ“ Dirt-Samples are loaded
βœ“ Sample playback works
""")
# Start the application
Mix.shell().info("Starting Waveform application...")
Mix.Task.run("app.start")
# Give it a moment to initialize
Process.sleep(1000)
# Ensure SuperDirt is ready
Mix.shell().info("Starting SuperDirt with Dirt-Samples...")
case ensure_superdirt_ready() do
:ok ->
Mix.shell().info("βœ“ SuperDirt ready!\n")
run_sample_tests()
{:error, reason} ->
Mix.shell().error("βœ— Failed to start SuperDirt: #{reason}")
Mix.shell().info("\nTroubleshooting:")
Mix.shell().info(" 1. Run: mix waveform.doctor")
Mix.shell().info(" 2. Ensure SuperDirt is installed in SuperCollider")
Mix.shell().info(" 3. Check for errors in the output above")
end
end
defp ensure_superdirt_ready do
Waveform.Helpers.ensure_superdirt_ready()
:ok
rescue
e ->
{:error, Exception.message(e)}
end
defp run_sample_tests do
Mix.shell().info("Testing sample playback...")
Mix.shell().info("You should hear: kick, snare, hi-hat, clap\n")
samples = [
{"bd", "Kick drum"},
{"sn", "Snare"},
{"hh", "Hi-hat"},
{"cp", "Clap"}
]
for {sample, name} <- samples do
Mix.shell().info(" Playing #{name}...")
try do
Waveform.SuperDirt.play(s: sample, n: 0, gain: 0.8)
Process.sleep(700)
rescue
e ->
Mix.shell().error(" βœ— Failed to play #{name}: #{Exception.message(e)}")
end
end
print_results()
end
defp print_results do
Mix.shell().info("""
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
βœ“ Test complete!
Did you hear all four sounds?
YES: βœ“ SuperDirt is working perfectly!
- Buffer configuration is correct
- All Dirt-Samples are loaded
- Ready to run demos and create music
NO: βœ— There may be an issue:
- If you only heard kick: Buffer limit might be too low
β†’ Check lib/waveform/lang.ex has numBuffers = 4096
β†’ Restart your application: :init.restart()
- If you heard nothing: SuperDirt might not be running
β†’ Run: mix waveform.doctor
β†’ Check for errors in the output above
- If you heard some but not all:
β†’ Run: mix waveform.install_samples
β†’ Verify samples installed correctly
For more help: https://github.com/rpmessner/waveform#troubleshooting
""")
end
end