Conversation
1017350 to
f40f08f
Compare
This commit adds a support for waveform snapshots on AVAudioPCMBuffer. Additionally: - Add required resources for testing - Add tests for basic waveform types
f40f08f to
08d195e
Compare
hhrvoic
approved these changes
Apr 2, 2025
Contributor
hhrvoic
left a comment
There was a problem hiding this comment.
Looks good, added minor cosmetic comments 🙌
Tests/AudioSnapshotTestingTests/AudioSnapshotTestingTests.swift
Outdated
Show resolved
Hide resolved
| let waveform2 = WaveformView( | ||
| buckets: data2, | ||
| absMax: max2, | ||
| height: CGFloat(height - 8), |
Contributor
There was a problem hiding this comment.
Why do we have those -8 corrections?
Collaborator
Author
There was a problem hiding this comment.
This is because of padding. I extracted it into a variable and calculate height taking it into account.
Comment on lines
+43
to
+44
| let newFormat = AVAudioFormat(standardFormatWithSampleRate: format.sampleRate, channels: 1)! | ||
| let buffer = AVAudioPCMBuffer(pcmFormat: newFormat, frameCapacity: frameLength)! |
Contributor
There was a problem hiding this comment.
Let's use guard let here to safely unwrap those format/buffer vars
| let buffer = AVAudioPCMBuffer(pcmFormat: newFormat, frameCapacity: frameLength)! | ||
| buffer.frameLength = frameLength | ||
| let stride = vDSP_Stride(1) | ||
| let result = buffer.floatChannelData![0] |
Contributor
There was a problem hiding this comment.
Maybe also here we could use if/guard let
Co-authored-by: Hrvoje Hrvoić <hrvoje.hrvoic@infinum.hr>
Co-authored-by: Hrvoje Hrvoić <hrvoje.hrvoic@infinum.hr>
Co-authored-by: Hrvoje Hrvoić <hrvoje.hrvoic@infinum.hr>
Co-authored-by: Hrvoje Hrvoić <hrvoje.hrvoic@infinum.hr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for waveform snapshots on AVAudioPCMBuffer.
Additionally: