All Projects → dmrschmidt → Dswaveformimage

dmrschmidt / Dswaveformimage

Licence: mit
Generate waveform images from audio files in iOS

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Dswaveformimage

Waveform analysis
Functions and scripts for analyzing waveforms, primarily audio. This is currently somewhat disorganized and unfinished.
Stars: ✭ 193 (-15.35%)
Mutual labels:  waveform, audio-analysis
Waveform Playlist
Multitrack Web Audio editor and player with canvas waveform preview. Set cues, fades and shift multiple tracks in time. Record audio tracks or provide audio annotations. Export your mix to AudioBuffer or WAV! Project inspired by Audacity.
Stars: ✭ 919 (+303.07%)
Mutual labels:  audio-visualizer, waveform
MusicVisualizer
A music visualizer based on the ATMEGA328P-AU
Stars: ✭ 30 (-86.84%)
Mutual labels:  audio-visualizer, audio-analysis
Audio Oscilloscope
🎵 Waveform audio visualizer for the HTML5 canvas.
Stars: ✭ 54 (-76.32%)
Mutual labels:  audio-visualizer, waveform
Amplituda
Amlituda - an android library that calculates amplitudes from audio and provides data in different formats. Based on this data, you can draw waveform. Android audio amplitude library.
Stars: ✭ 75 (-67.11%)
Mutual labels:  waveform, audio-visualizer
Mpv Scripts
mpv lua scripts
Stars: ✭ 68 (-70.18%)
Mutual labels:  audio-visualizer, waveform
Wfplayer
🌊 WFPlayer.js is an audio waveform generator
Stars: ✭ 124 (-45.61%)
Mutual labels:  waveform
Img Encode
Encode an image to sound and view it as a spectrogram - turn your images into music
Stars: ✭ 157 (-31.14%)
Mutual labels:  audio-visualizer
Waveformseekbar
Android Waveform SeekBar library
Stars: ✭ 120 (-47.37%)
Mutual labels:  waveform
Scituner
SciTuner is a guitar tuner written in Swift3
Stars: ✭ 118 (-48.25%)
Mutual labels:  waveform
Webgl Plot
A high-Performance real-time 2D plotting library based on native WebGL
Stars: ✭ 200 (-12.28%)
Mutual labels:  waveform
Devicehive Audio Analysis
Stars: ✭ 189 (-17.11%)
Mutual labels:  audio-analysis
Essentia
C++ library for audio and music analysis, description and synthesis, including Python bindings
Stars: ✭ 1,985 (+770.61%)
Mutual labels:  audio-analysis
React D3 Components
D3 Components for React
Stars: ✭ 1,599 (+601.32%)
Mutual labels:  waveform
Torch Audiomentations
Fast audio data augmentation in PyTorch. Inspired by audiomentations. Useful for deep learning.
Stars: ✭ 164 (-28.07%)
Mutual labels:  waveform
Gxaudiovisualisation
Blender Python script for audio visualisation
Stars: ✭ 120 (-47.37%)
Mutual labels:  audio-visualizer
Soundwaveform
Generate WaveForms Images from Sounds and Videos on macOS and iOS (Swift 5.x)
Stars: ✭ 119 (-47.81%)
Mutual labels:  waveform
Speechrecognizerbutton
UIButton subclass with push to talk recording, speech recognition and Siri-style waveform view.
Stars: ✭ 144 (-36.84%)
Mutual labels:  waveform
Akwf Free
Adventure Kid Wave Forms are a collection of sampled one cycle waveforms for use in synthesizers or similar sound generators.
Stars: ✭ 179 (-21.49%)
Mutual labels:  waveform
Soundnet Tensorflow
TensorFlow implementation of "SoundNet".
Stars: ✭ 137 (-39.91%)
Mutual labels:  audio-analysis

DSWaveformImage

Carthage compatible Swift Package Manager compatible

DSWaveformImage offers a few interfaces with the main purpose of drawing the envelope waveform of audio files in iOS. To do so, you can use WaveformImageDrawer or WaveformImageView.

Additionally, you can get a waveform's (normalized) samples directly as well by creating an instance of WaveformAnalyzer.

More related iOS Controls

You may also find the following iOS controls written in Swift interesting:

Installation

  • use SPM: add https://github.com/dmrschmidt/DSWaveformImage and set "Up to Next Major" with "7.0.0"
  • use carthage: github "dmrschmidt/DSWaveformImage" ~> 7.0
  • simply copy the DSWaveformImage folder directly into your project.
  • or, sunset since 6.1.1: use cocoapods: pod 'DSWaveformImage', '~> 6.1'

Usage

Calculations are always performed and returned on a background thread, so make sure to return to the main thread before doing any UI work.

To create a UIImage using WaveformImageDrawer:

let waveformImageDrawer = WaveformImageDrawer()
let audioURL = Bundle.main.url(forResource: "example_sound", withExtension: "m4a")!
waveformImageDrawer.waveformImage(fromAudioAt: audioURL,
                                  size: topWaveformView.bounds.size,
                                  style: .striped(UIColor.black),
                                  position: .top) { image in
    // need to jump back to main queue
    DispatchQueue.main.async {
        self.topWaveformView.image = image
    }
}

To create a WaveformImageView (UIImageView subclass):

let audioURL = Bundle.main.url(forResource: "example_sound", withExtension: "m4a")!
waveformImageView = WaveformImageView(frame: CGRect(x: 0, y: 0, width: 500, height: 300)
waveformImageView.waveformAudioURL = audioURL

And finally, to get an audio file's waveform samples:

let audioURL = Bundle.main.url(forResource: "example_sound", withExtension: "m4a")!
waveformAnalyzer = WaveformAnalyzer(audioAssetURL: audioURL)
waveformAnalyzer.samples(count: 200) { samples in
    print("so many samples: \(samples)")
}

Playback Indication

If you're playing back audio files and would like to indicate the playback progress to your users, you can find inspiration in this ticket. There's various other ways of course, depending on your use case and design.

Loading remote audio files from URL

For one example way to display waveforms for audio files on remote URLs see https://github.com/dmrschmidt/DSWaveformImage/issues/22.

What it looks like

Waveforms can be rendered in 3 different styles: .filled, .gradient and .striped. Similarly, there are 3 positions .top, .middle and .bottom

  • relative to the canvas. The effect of each of those can be seen here:
Screenshot

Migration

In 7.0.0 colors have moved into associated values on the respective style enum.

Waveform and the UIImage category have been removed in 6.0.0 to simplify the API. See Usage for current usage.

See it live in action

SoundCard lets you send postcards with audio messages.

DSWaveformImage is used to draw the waveforms of the audio messages on postcards sent by SoundCard.

Check it out on the App Store.

Screenshot
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].