Repository Public MIT
1{2 "accessibility" : [3 "The drawing is one element with the image trait. Its label is a textual summary, \"Waveform, 48,000 samples, peak level 87 percent\" (`GlassL10n` `.waveformSummary`), and its value is the progress as a percentage when one is given.",4 "Played and unplayed bars differ in colour only because the same information is in the accessibility value and, in a player, in the time labels next to it."5 ],6 "category" : "media",7 "changelog" : [8 {9 "changes" : [10 "Release 1.1.0: see the project changelog."11 ],12 "date" : "2026-12-03",13 "version" : "1.1.0"14 },15 {16 "changes" : [17 "Initial release."18 ],19 "date" : "2026-12-02",20 "version" : "1.0.0"21 }22 ],23 "dependencies" : [24 {25 "id" : "glass-foundation",26 "version" : "1.1.0"27 }28 ],29 "description" : "Bounded, aggregated audio samples drawn with Canvas and described in text.",30 "examples" : [31 {32 "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassWaveformExample: GlassExample {\n public static let componentID = \"glass-waveform\"\n /// Aggregated once, when the example is created, not on every frame.\n @State private var voice = GlassWaveformData(samples: Self.syntheticSamples(count: 48_000), maxBuckets: 96, aggregation: .rms)\n @State private var peaks = GlassWaveformData(samples: Self.syntheticSamples(count: 48_000), maxBuckets: 160)\n @State private var progress = 0.35\n\n public init() {}\n\n public var body: some View {\n VStack(alignment: .leading, spacing: 16) {\n Text(\"RMS, 96 buckets, with progress\")\n .font(.headline)\n GlassWaveform(voice, progress: progress)\n Slider(value: $progress, in: 0...1) { Text(\"Progress\") }\n\n Text(\"Peak, 160 buckets\")\n .font(.headline)\n GlassWaveform(peaks, minimumHeight: 72)\n\n Text(\"Progress without the playhead\")\n .font(.headline)\n GlassWaveform(voice, progress: progress, showsPlayhead: false)\n\n Text(\"No samples\")\n .font(.headline)\n GlassWaveform(.empty, minimumHeight: 24)\n\n Text(\"Sample data · a synthetic signal built from sine waves.\")\n .font(.caption)\n .foregroundStyle(.secondary)\n }\n .padding()\n }\n\n /// A deterministic signal: a carrier shaped by two slow envelopes.\n static func syntheticSamples(count: Int) -> [Float] {\n (0..<count).map { index in\n let t = Double(index) / Double(count)\n let envelope = 0.55 + 0.45 * sin(t * .pi * 6)\n let swell = 0.6 + 0.4 * cos(t * .pi * 17)\n return Float(sin(Double(index) * 0.21) * envelope * swell)\n }\n }\n}\n\n#Preview(\"GlassWaveform\") { GlassWaveformExample().glassTheme(.aurora) }\n",33 "title" : "GlassWaveform example"34 }35 ],36 "files" : [37 {38 "bytes" : 11035,39 "path" : "Media/Media/GlassWaveform.swift",40 "sha256" : "682352cacdb8d27f8d8eefd0ceba9680660bbcbee389d0d92a0f2eeacd443950"41 }42 ],43 "frameworks" : [4445 ],46 "id" : "glass-waveform",47 "kind" : "content-component",48 "license" : "MIT",49 "minimumOS" : {50 "iOS" : "26.0",51 "iPadOS" : "26.0",52 "macOS" : "26.0"53 },54 "name" : "GlassWaveform",55 "platforms" : [56 "iOS",57 "iPadOS",58 "macOS"59 ],60 "schemaVersion" : 1,61 "sha256" : "7f144181b19a878730b3d517bf4b0943aa6349520594b6424fa2c9630355397f",62 "symbols" : [63 "GlassWaveformAggregation",64 "GlassWaveformDownsampler",65 "GlassWaveformData",66 "GlassWaveform",67 "GlassWaveformLayout"68 ],69 "version" : "1.1.0"70}71