小编use*_*907的帖子

环绕声(5.1)Web Audio支持

我正在尝试创建简单的应用程序来播放所有5.1声道中的立体声/单声道音乐.在研究了Web音频规范之后,我花了4个小时来尝试编写代码.不幸的是我无处可去.音频仅播放2个频道.如果我设置merger.channelCountMode ="explicit",它只能从中心通道播放.

如果我设置merger.channelInterpretation ="discrete"; 它只能从左声道播放.我做错了什么?非常感谢你.我的代码:

      var audio;

function PlaySurround(){
  context = new AudioContext();
  audio = new Audio();
  audio.src = "a.mp3";
  var source = context.createMediaElementSource(audio);
  context.destination.channelCount = 6;
  audio.currentTime = Math.random() * 200;
  
  
  //Create a splitter to "separete" the stereo audio data to two channels.
  var splitter = context.createChannelSplitter(6);
  splitter.channelCount = 6;
  //splitter.channelInterpretation = "discrete";
  //splitter.channelCountMode = "explicit";
              
  console.log(splitter);
  //Connect your source to the splitter (usually, you will do it with the last audio node before context destination)
  source.connect(splitter);
  
  //Create two …
Run Code Online (Sandbox Code Playgroud)

javascript audio html5 web

7
推荐指数
0
解决办法
785
查看次数

标签 统计

audio ×1

html5 ×1

javascript ×1

web ×1