如何在HTML中为音频文件/标签创建移动波形?单击播放按钮时,必须播放音频HTML元素,并生成相应的移动波形....如何实现?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title id='title'>HTML Page setup Tutorial</title>
<script src='riffwave.js'></script>
<script type="text/javascript">
function myFunction()
{
var data = []; // just an array
for (var i=0; i<10000; i++) data[i] = /*Math.round(255 * Math.random())*/i; // fill data with random samples
var wave = new RIFFWAVE(data); // create the wave file
var audio = new Audio(wave.dataURI); // create the HTML5 audio element
audio.play();
}
</script>
</head>
<body>
<button type="button" onclick="myFunction()">Click Me!</button>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我正在尝试找到构建音乐可视化工具的最佳方法,以便在网络浏览器中运行.Unity是一个选项,但我需要构建一个自定义音频导入/分析插件来获得最终用户的声音输出.Quartz做我需要的但只能在Mac/Safari上运行.WebGL似乎没有准备好.Raphael主要是2D,但仍然存在获取用户声音的问题......任何想法?有没有人这样做过?
visualization quartz-graphics raphael unity-game-engine webgl