-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement textual waveform support on AVAudioPCMBuffer #2941
Conversation
I spent quite a bit of time debugging an issue where `AudioUnitSetProperty` was returning error `OSStatus`. Ideally, all of these would be marked as throws, so that call-site can react appropriatelly to these errors. But I thought this is a good first step to improve the current situation.
- Textual waveforms can be useful as a debugging (and testing) tool - Additionally, this PR adds the ability to quick look AVAudioPCMBuffer inside of Xcode For example: - https://goq2q.net/blog/tech/using-ascii-waveforms-to-test-real-time-audio-code - https://melatonin.dev/blog/audio-sparklines/
|
||
private extension AVAudioFormat { | ||
var stringDescription: String { | ||
"Format \(channelCount) ch, \(sampleRate) Hz, \(isInterleaved ? "interleaved" : "deinterleaved"), \(commonFormat.stringDescription)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 120 characters or less: currently 140 characters (line_length)
} | ||
|
||
// Allows to use Quick Look in the debugger on AVAudioPCMBuffer | ||
// https://developer.apple.com/library/archive/documentation/IDEs/Conceptual/CustomClassDisplay_in_QuickLook/CH01-quick_look_for_custom_objects/CH01-quick_look_for_custom_objects.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 120 characters or less: currently 187 characters (line_length)
|
||
var buckets = [Float](repeating: 0, count: bucketCount) | ||
var maxBucket: Float = 0 | ||
for i in 0..<bucketCount { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'i' (identifier_name)
4│ | ||
5│ | ||
6│ | ||
7│ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
3│ | ||
4│ | ||
5│ | ||
6│ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
4│ | ||
3│ | ||
2│ | ||
1│ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
5│ | ||
4│ | ||
3│ | ||
2│ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
6│ | ||
5│ | ||
4│ | ||
3│ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
7│ ******************************* | ||
6│ | ||
5│ | ||
4│ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
|
||
7│ ******************************* | ||
6│ | ||
5│ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So cool!
inside of Xcode
For example:
Quick look in action: