Files
josh abc64df4d7 v1.4.1 release: Learning Swift for Lyrebird intro guide
Documentation-only release. Adds docs/learning-swift/ — a four-part
introduction to Swift for Lyrebird users coming from SuperCollider,
Max/MSP, Csound, etc. (Hello World, Swift basics & best practices,
types & functional programming, Xcode/packages/debugging). Linked from
README.md and LYREBIRD_START_HERE.md. See RELEASES.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 12:10:00 -07:00

2.7 KiB

Learning Swift for Lyrebird

You saw Lyrebird make sound and you want in — but you've never written Swift, and every Swift tutorial you find is about buttons, table views, and iPhone apps. This series is different. It teaches just enough Swift to be productive in Lyrebird, using audio examples the whole way.

You do not need to be an iOS developer. You do not need SwiftUI (though it helps later, once you build GUIs). You need to be comfortable reading and writing small programs, understanding types, and running them. That's what these four documents give you.

Who this is for

  • Musicians, composers, and sound designers coming from SuperCollider, Max/MSP, Pd, Csound, or Faust.
  • Programmers in other languages (Python, JavaScript, C++) who want the Swift-specific parts fast.
  • Anyone who felt "I get the idea of Lyrebird, I just don't know how to type the Swift."

The path

Read them in order. Each is short and ends where the next begins.

# Document What you'll be able to do
1 Hello, World Make Lyrebird produce a tone from a program you wrote and ran yourself. Understand every line of it.
2 Swift Basics & Best Practices Read and write Swift confidently: variables, functions, control flow, optionals, classes vs structs, and the style Lyrebird expects.
3 Types & Functional Programming Use Swift's type system and functional tools (map, filter, closures) to build and control synthesis graphs cleanly.
4 Xcode, Packages & Debugging Open, build, and run projects in Xcode; add Lyrebird as a package; configure Debug vs Release; set breakpoints and debug a running synth.

The one-minute mental model

Lyrebird is a library, not an app and not a language. You write a normal Swift program. In it you:

  1. Create a SynthesisEngine — it owns the audio hardware.
  2. Describe sound by subclassing SynthesizerBase and wiring generators (oscillators, filters, effects) together in a build() method.
  3. Hand your synthesizer to the engine with engine.add(...).

There is no separate scripting language to learn (unlike SuperCollider's sclang or Csound's orchestra). The language is Swift. That's the whole reason this series exists: learn a slice of Swift, and you've learned how to drive Lyrebird.

A naming quirk to know from the start: in Package.swift you depend on a product called Lyrebird, but in your source you write import LyrebirdSynth. That's expected — the product and the module have different names. Both guides 1 and 4 remind you.

Start with Hello, World.