Skip to content
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

Merged
merged 4 commits into from
Dec 9, 2024

Conversation

jcavar
Copy link
Contributor

@jcavar jcavar commented Nov 20, 2024

  • 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:

Quick look in action:

Screenshot 2024-11-20 at 21 08 40

jcavar added 4 commits August 26, 2024 09:53
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)"
Copy link

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
Copy link

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 {
Copy link

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│
Copy link

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│
Copy link

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│
Copy link

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│
Copy link

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│
Copy link

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│
Copy link

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│
Copy link

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)

Copy link
Member

@aure aure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So cool!

@aure aure merged commit e05284f into AudioKit:main Dec 9, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants