Skip to content

Commit 4128534

Browse files
committed
Remove swift-snapshot-testing dependency
1 parent 1719d7c commit 4128534

92 files changed

Lines changed: 654 additions & 301 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Package.resolved

Lines changed: 0 additions & 24 deletions
This file was deleted.

Package.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.0
1+
// swift-tools-version: 6.2
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -12,15 +12,9 @@ let package = Package(
1212
targets: ["AudioSnapshotTesting"]
1313
)
1414
],
15-
dependencies: [
16-
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.17.6")
17-
],
1815
targets: [
1916
.target(
20-
name: "AudioSnapshotTesting",
21-
dependencies: [
22-
.product(name: "SnapshotTesting", package: "swift-snapshot-testing")
23-
]
17+
name: "AudioSnapshotTesting"
2418
),
2519
.testTarget(
2620
name: "AudioSnapshotTestingTests",

Sources/AudioSnapshotTesting/AudioSnapshotTesting.swift

Lines changed: 0 additions & 205 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// Specifies the amplitude scaling method for spectrograms.
2+
public enum AmplitudeScale: Sendable {
3+
/// Linear amplitude scale (raw FFT magnitudes normalized to 0...1)
4+
case linear
5+
/// Logarithmic amplitude scale in decibels with specified dynamic range
6+
/// - Parameter range: The dB range from minimum to maximum (e.g., 120 means -120dB to 0dB)
7+
case logarithmic(range: Float)
8+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/// Defines the visualization strategy for audio snapshot failures.
2+
public enum AudioSnapshotStrategy: Sendable {
3+
/// Waveform visualization.
4+
/// - Parameters:
5+
/// - width: The width of the resulting image.
6+
/// - height: The height of the resulting image.
7+
/// - strategy: The strategy to use when generating the waveform. Defaults to `.joinedLines`.
8+
/// - mono: Whether to mix down to a mono signal. Defaults to `true`.
9+
case waveform(width: Int, height: Int, strategy: WaveformStrategy = .joinedLines, mono: Bool = true)
10+
11+
/// Frequency spectrum visualization.
12+
/// - Parameters:
13+
/// - width: The width of the resulting image.
14+
/// - height: The height of the resulting image.
15+
/// - window: Optional window function for FFT. Uses Hann window if not provided.
16+
/// - threshold: Minimum amplitude threshold for frequency bins. Defaults to `0.005`.
17+
/// - Note: Requires iOS 16+ or macOS 13+.
18+
case spectrum(width: Int, height: Int, window: [Float]? = nil, threshold: Float = 0.005)
19+
20+
/// Spectrogram visualization.
21+
/// - Parameters:
22+
/// - hopSize: The number of audio frames between successive spectral frames.
23+
/// - frequencyCount: The number of frequency bins to include in each spectral frame.
24+
/// - window: Optional window function for FFT. Uses Hann window if not provided.
25+
/// - amplitudeScale: The amplitude scaling method. Defaults to `.logarithmic(range: 120)`.
26+
/// - imageWidth: The width of the resulting image. Defaults to `1000`.
27+
/// - Note: Requires iOS 16+ or macOS 13+.
28+
case spectrogram(hopSize: Int, frequencyCount: Int, window: [Float]? = nil, amplitudeScale: AmplitudeScale = .logarithmic(range: 120), imageWidth: Int = 1000)
29+
30+
/// Overlay waveform visualization comparing two buffers.
31+
/// - Parameters:
32+
/// - width: The width of the resulting image.
33+
/// - height: The height of the resulting image.
34+
/// - strategy: The strategy to use when generating the waveform. Defaults to `.joinedLines`.
35+
/// - mono: Whether to mix down to a mono signal. Defaults to `true`.
36+
case overlayWaveform(width: Int, height: Int, strategy: WaveformStrategy = .joinedLines, mono: Bool = true)
37+
}

0 commit comments

Comments
 (0)