### Build and run MusicPlayground from source Source: https://github.com/1amageek/musicplaygournd/blob/main/docs/index.html Commands to build MusicPlayground from source on macOS 15+ with Swift 6.4 and Xcode command-line tools. Initial package resolution and compilation can take longer; progress appears in the sidebar. ```bash git clone --branch 0.6.0 https://github.com/1amageek/MusicPlaygournd.git cd MusicPlaygournd ./Scripts/build-app.sh open .build/MusicPlaygournd.app ``` -------------------------------- ### SwiftPM folder structure for projects Source: https://github.com/1amageek/musicplaygournd/blob/main/README.md Shows the folder-based SwiftPM structure used by projects. New projects create this directory layout, and existing folders containing Package.swift can be opened. ```text MyLiveSet/ ├── Package.swift ├── Sources/ │ └── MyLiveSet/ │ ├── Session.swift │ └── Resources/ └── Recordings/ ``` -------------------------------- ### Run landing page tests with node --test Source: https://github.com/1amageek/musicplaygournd/blob/main/docs/DESIGN.md Run the landing page test suite from the project root. The test-timeout flag sets a 10-second timeout for the test run. ```bash node --test --test-timeout=10000 Scripts/test-landing-page.mjs ``` -------------------------------- ### Compose sounds in Session.swift with SwiftMusic Source: https://github.com/1amageek/musicplaygournd/blob/main/docs/index.html Template excerpt from Session.swift showing how to compose sounds declaratively with SwiftMusic. It layers a RhythmSection, a SynthSection with a live filter amount, and a BusReturn with a gain controlled by a slider. ```swift // Compose sounds together. var body: some Sound { RhythmSection() // Shape the filter live. SynthSection( acidAmount: slider(0.5, in: 0...1) ) BusReturn("synths") .gain(slider($synthLevel, in: 0...1)) } ``` -------------------------------- ### Pin SwiftMusic 0.5.1 in Package.swift Source: https://github.com/1amageek/musicplaygournd/blob/main/README.md Adds the SwiftMusic package to a Swift package manifest, pinning version 0.5.1 exactly. Used in Package.swift for new projects. ```swift .package(url: "https://github.com/1amageek/SwiftMusic.git", exact: "0.5.1") ``` -------------------------------- ### Compose reusable sounds with Music and Sound Source: https://github.com/1amageek/musicplaygournd/blob/main/README.md Defines a Music session that composes Drums and Bass sounds in parallel. Uses Track to name and mix each part, Sample with rhythm and gain patterns, and Synthesizer with notes, lowPass, and gain. Pattern syntax: x triggers, ~ rests, brackets subdivide, x*4 repeats. ```swift import SwiftMusic struct Session: Music { var body: some Sound { Drums() Bass() } } struct Drums: Sound { var body: some Sound { Track("Kick") { Sample("kick") .rhythm("x ~ x ~") .gain(0.7) } Track("Hats") { Sample("closedHat") .rhythm("[~ x] [~ x] [~ x] [~ [x x]]") .gain("0.4 [0.2 0.3] 0.4 0.2") } } } struct Bass: Sound { var body: some Sound { Track("Bass") { Synthesizer(.bandLimitedSaw) .notes("C2 ~ [Eb2 G2] Bb1") .lowPass("800") .gain(0.2) } } } ``` -------------------------------- ### Switch musical variations with Swift switch and @State Source: https://github.com/1amageek/musicplaygournd/blob/main/README.md Use a Swift switch with @State to select between performance pads. The switch can choose a sound inside a track or change whole tracks. Supported variants are prepared before playing; pads switch using the existing beat clock and a short crossfade without compiling or rendering a new variant on the click. ```swift import SwiftMusic enum Beat { case steady, fill } struct Session: Music { @State private var beat: Beat = .steady var body: some Sound { Track("Drums") { switch beat { case .steady: Sample("kick").rhythm("x ~ x ~").gain(0.7) case .fill: Sample("kick").rhythm("x x [x x] x").gain(0.7) } } } } ``` -------------------------------- ### Add inline sliders with MusicPlayground Source: https://github.com/1amageek/musicplaygournd/blob/main/README.md Shows how to add inline sliders to a MusicPlayground session. Use slider(0.5, in: 0...1) for automatic state or slider($level, in: 0...0.5) to bind to your own @State. Dragging updates the retained session without recompiling Swift; invalid values keep the accepted audio playing. ```swift import SwiftMusic import MusicPlayground struct Session: Music { @State private var level = 0.2 var body: some Sound { Synthesizer(.bandLimitedSaw) .notes("C2 Eb2 G2 Bb2") .lowPass("200", resonanceQ: 4) .acidEnvelope(slider(0.5, in: 0...1)) .gain(slider($level, in: 0...0.5)) } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.