Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastienrousseau/audiowavelib
AudioWaveLib is a Swift library for loading and processing audio sample data to generate waveform visualizations.
https://github.com/sebastienrousseau/audiowavelib
swift waveform
Last synced: about 1 month ago
JSON representation
AudioWaveLib is a Swift library for loading and processing audio sample data to generate waveform visualizations.
- Host: GitHub
- URL: https://github.com/sebastienrousseau/audiowavelib
- Owner: sebastienrousseau
- License: zlib
- Created: 2024-02-28T18:57:28.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-03-01T07:45:51.000Z (9 months ago)
- Last Synced: 2024-05-02T03:01:02.096Z (7 months ago)
- Topics: swift, waveform
- Language: Swift
- Homepage:
- Size: 430 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# AudioWaveLib
AudioWaveLib is a Swift library for processing audio files and generating waveform visualizations.
## Features
- Read audio files using AVFoundation
- Extract PCM sample data from audio files
- Generate waveform images from sample data
- Asynchronous processing using GCD
- Support for macOS AppKit graphics and waveform rendering## Usage
To use AudioWaveLib:
1. Create an `AudioWaveLibProvider` instance with audio file URL
2. Set a delegate to receive callbacks
3. Call `createSampleData()` to process the file```swift
let url = URL(filePath: "file.mp3")
let provider = AudioWaveLibProvider(url: url)
provider.delegate = self
provider.createSampleData()
```Implement the `AudioWaveLibProviderDelegate` to handle updates:
```swift
func sampleProcessed(provider: AudioWaveLibProvider) {
if let data = provider.getSampleData() {
// Render waveform from sample data
}
}func statusUpdated(provider: AudioWaveLibProvider, error: Error) {
// Handle error
}
```Use AppKit to render waveform images:
```swift
let image = generateWaveformImage(sampleData: data, size: CGSize(width: 400, height: 100))
```See `main.swift` for a complete AppKit waveform rendering example.
## Requirements
- iOS 13+
- macOS 10.15+
- Xcode 13+
- Swift 5.5+## Installation
Add AudioWaveLib as a Swift Package dependency.
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md).
## License
AudioWaveLib is released under the [zlib License](LICENSE.txt).