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 "Initial release."11 ],12 "date" : "2026-12-02",13 "version" : "1.0.0"14 }15 ],16 "dependencies" : [17 {18 "id" : "glass-foundation",19 "version" : "1.0.0"20 }21 ],22 "description" : "Bounded, aggregated audio samples drawn with Canvas and described in text.",23 "examples" : [24 {25 "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(\"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",26 "title" : "GlassWaveform example"27 }28 ],29 "files" : [30 {31 "bytes" : 9323,32 "path" : "Media/Media/GlassWaveform.swift",33 "sha256" : "d0774b0b9d2821a2b50f248b13a86e6b305e76a20a1eabe143185961e4aca6a9"34 }35 ],36 "frameworks" : [3738 ],39 "id" : "glass-waveform",40 "kind" : "content-component",41 "license" : "MIT",42 "minimumOS" : {43 "iOS" : "26.0",44 "iPadOS" : "26.0",45 "macOS" : "26.0"46 },47 "name" : "GlassWaveform",48 "platforms" : [49 "iOS",50 "iPadOS",51 "macOS"52 ],53 "schemaVersion" : 1,54 "sha256" : "2fd2d69a426cedda72dfa102f53380e8e40d0ffee72dd291dc6e76092eaf64e3",55 "symbols" : [56 "GlassWaveformAggregation",57 "GlassWaveformDownsampler",58 "GlassWaveformData",59 "GlassWaveform",60 "GlassWaveformLayout"61 ],62 "version" : "1.0.0"63}64