All Projects → antonKalinin → audio-waveform-svg-path

antonKalinin / audio-waveform-svg-path

Licence: MIT License
Building path for SVG element to perform waveform view of audio file

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to audio-waveform-svg-path

qxresearch-event-1
10+ Python Application 🦾 | 10- lines of code 👽
Stars: ✭ 194 (+397.44%)
Mutual labels:  audio-visualizer
barva
An audio visualizer that pulses the background of your terminal (or anything else).
Stars: ✭ 101 (+158.97%)
Mutual labels:  audio-visualizer
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 (+92.31%)
Mutual labels:  audio-visualizer
songturtle
🐢 Play, slow down, and loop sections of audio files in the browser 🐢
Stars: ✭ 26 (-33.33%)
Mutual labels:  audio-visualizer
audio-visualizer-with-controls
html5 audio visualizer with audio play controls
Stars: ✭ 83 (+112.82%)
Mutual labels:  audio-visualizer
RecPlayer-iOS
A simple iOS application that records audio and plays it back. (+some animations)
Stars: ✭ 21 (-46.15%)
Mutual labels:  audio-visualizer
MusicVisualizer
A music visualizer based on the ATMEGA328P-AU
Stars: ✭ 30 (-23.08%)
Mutual labels:  audio-visualizer
visualizer2
OpenGL Audio Visualizers in Rust
Stars: ✭ 54 (+38.46%)
Mutual labels:  audio-visualizer
QuietVR
A Quiet Place in VR: Generate any 3D object with your voice. It's magic!
Stars: ✭ 17 (-56.41%)
Mutual labels:  audio-visualizer
vue-dictaphone
🎙️ Vue.js dictaphone component to record audio from the user
Stars: ✭ 22 (-43.59%)
Mutual labels:  audio-visualizer
wav2bar
Wav2Bar is a tool to make custom audio visualization and export production videos for the audio and music industry.
Stars: ✭ 35 (-10.26%)
Mutual labels:  audio-visualizer
Comet
Web Synthesis on steroids
Stars: ✭ 18 (-53.85%)
Mutual labels:  audio-visualizer
audiovisualizer
Another simple audio visualizer for android.
Stars: ✭ 33 (-15.38%)
Mutual labels:  audio-visualizer
ModularMusicVisualizer
Project in Hiatus, unmaintained, being rewritten privately. Will Open Source when stuff is ready. Project will be Renamed.
Stars: ✭ 81 (+107.69%)
Mutual labels:  audio-visualizer
pulseviz.py
Audio visualizer for PulseAudio written in Python
Stars: ✭ 24 (-38.46%)
Mutual labels:  audio-visualizer
BeatDrop
BeatDrop Music Visualizer
Stars: ✭ 54 (+38.46%)
Mutual labels:  audio-visualizer
JetTunes-Desktop-Music-Player
Material design music player made with javafx
Stars: ✭ 36 (-7.69%)
Mutual labels:  audio-visualizer
koch fractals
Koch Fractals Demo for Unity
Stars: ✭ 31 (-20.51%)
Mutual labels:  audio-visualizer
iiVisu
A player/ recorder visualizer with the swipe to seek functionality.
Stars: ✭ 112 (+187.18%)
Mutual labels:  audio-visualizer
modular-led-controller-workstation
🎵 🌈 Real-time LED strip music visualization using Python and the ESP8266 or Raspberry Pi
Stars: ✭ 21 (-46.15%)
Mutual labels:  audio-visualizer

Audio Waveform SVG Path

npm version

Building path for SVG element to perform waveform view of audio file

Inspired by:

https://robots.thoughtbot.com/javascript-audio-api

Demo:

https://antonkalinin.github.io/audio-waveform-svg-path/

Installation

npm install --save audio-waveform-svg-path

Usage

import AudioSVGWaveform from 'audio-waveform-svg-path';

const trackWaveform = new AudioSVGWaveform({url: 'url of audio file'});

trackWaveform.loadFromUrl().then(() => {
    const path = trackWaveform.getPath();

    document.getElementById('my-path-element').setAttribute('d', path);
});

Constructor accepts object with one of keys:

{
    url: 'url address of audio file',
    buffer: 'audio as AudioBuffer'
}

Methods

  • loadFromUrl - loads audio from url, returns Promise

  • getPath(preprocessChannels) - returns a path of waveform, accepts callback function as only arument

Example of getPath with callback

const diffPath = trackWaveform.getPath(
    /*
        Use preprocessChannels callback to modify final list of channels.
        This callback will be invocked as a argument of reduce method of channels array.
     */
    (channels, channel) => {
        const prevChannel = channels[0];
        const length = channel.length;
        const outputChannel = [];

        if (prevChannel) {
            for (let i = 0; i < length; i++) {
                // flip phase of right channel
                outputChannel[i] = (channel[i] - prevChannel[i]);
            }

            channels[0] = outputChannel;
        } else {
            channels.push(channel);
        }

        return channels;
    },
    []
);

License

MIT

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].