0
如何在JavaScript中创建随机声音并将其保存到桌面?js中的随机声音
如何在JavaScript中创建随机声音并将其保存到桌面?js中的随机声音
使用像Riffwave库:http://codebase.es/riffwave/
“riffwave.js”是音频数据编码到可以用来播放合成声音与格式(PCM一个RIFF容器内)一个微小的JavaScript库HTML5音频元素。
例如随机声音的产生
var data = [];
for (var i=0; i<1000; i++) {
// fill data with random samples
data[i] = Math.round(255 * Math.random());
}
var wave = new RIFFWAVE(data); // create the wave file
/*
pass wave.dataURI property to a server page via POST and
then re-send the content along with the right headers
for a wav file so to enforce download
or just redirect your client using data:uri schema, like
location.href = wave.dataURI
(but this won't force the download in every browser)
*/
取决于你的意思是“随机声音”。 – JJJ 2012-04-23 10:07:21
你为什么要标记jQuery? – 2012-04-23 10:08:20
这意味着每秒有不同的音符。 – user1 2012-04-23 10:08:32