How do I compress multiple Web Audio sources/tracks into one?

回眸只為那壹抹淺笑 提交于 2019-12-07 06:13:57

问题


We are making an web based music editor and mixer based on the Web Audio api. Users can mix together multiple tracks, crop tracks, etc. The actual mixing together of the tracks just involves playing back all the sources at once.

We want to be able to add the option to save the mix and make it available for download to a user's computer. Is there some way to do this on the front end (like connecting all the sources to one destination/export node), or even the backend (we are using RoR)?


回答1:


RecorderJS does exactly what you need, and it could not possibly be easier to use. Really, really great library.

https://github.com/mattdiamond/Recorderjs

P.S. Look into OfflineAudioContext and my answer to this question (Web audio API: scheduling sounds and exporting the mix) for info on doing a faster-than-realtime mixdown of your audio.




回答2:


Users data looks to be on client side?

Basically when converting data with base64 into dataURI, datas are diplayed inline so they can be add 1 by 1 togheter into one single blob object, and be downloaded.

But this method is only good for smalls files, causing crash and freezing with most browser, this is only good for blob size less than 10mb after some personnal tests, this will be better soon for sure.

<audio controls><source src="data:audio/ogg;base64,BASE64.......BASE564......BASE64............."></audio>

or

<a href="data:audio/ogg;base64,BASE64...BASE64..BASE64....>Download</a>

Probably not your way, just an idea but your project is interesting ;)



来源:https://stackoverflow.com/questions/17159387/how-do-i-compress-multiple-web-audio-sources-tracks-into-one

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!