bbc / audiowaveform

C++ program to generate waveform data and render waveform images from audio files
https://waveform.prototyping.bbc.co.uk
GNU General Public License v3.0
1.94k stars 242 forks source link

Convert to data client side #31

Closed tgoldenberg closed 9 years ago

tgoldenberg commented 9 years ago

Hi, this seems like a very interesting project. I am interested in converting mp3 files and user recorded .caf files on a React Native iOS app into data visualizations. From what I gather, this project converts audio files to data through command line tools. Is there a way I could convert the files on the client side with JavaScript? Any suggestions or pointers would be greatly appreciated.

Thanks!

chrisn commented 9 years ago

I imagine you could wrap some of the audiowaveform code as a native module in React Native (see here) to be invoked from JavaScript, but you'd have to write your own code to handle the Core Audio Format files, as audiowaveform only handles MP3, WAV, and FLAC audio.

thom4parisot commented 9 years ago

@tgoldenberg we use the WebAudio API to convert MP3 into waveforms but this is not suited to a native app. You probably want to use iOS Audio API and then interface it with Peaks.js to visualise it into a canvas – but there are probably more optimised ways of doing it.