0

The following code is where I can put the current TimeDomainData into an array.

    fbc_array = new Uint8Array(analyser.frequencyBinCount);
    analyser.getByteTimeDomainData(fbc_array);

And then I can use the for statement to let each fbc_array[i] value (Time Domain waveform) being displayed on canvas.

Question:

I want to use the mouse events to trigger the sound where the mouse hovers on the Time Domain waveform.

Is there any method inside the AudioContext can let the fbc_array[i] value back to the sound?

JHONGO
  • 11
  • 4
  • Why not normalize the mouse position and map it to time, then play from that time to n length? If you want to *change* the data you would need to go through the scripting node. –  Nov 28 '14 at 04:11
  • I've think about your solution… And it's intutive one! I'll give it a try! – JHONGO Nov 29 '14 at 05:39
  • BTW, what's the scripting mode you've talked about? Is that inside the AudioContext? Thanks first~~ – JHONGO Nov 29 '14 at 05:43
  • yes, it's on the context. See [createScriptProcessor](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext.createScriptProcessor) for details. Are you playing a long audio track, ie. using the Audio element as source for its buffering capability? If so, you can set the new time directly on the audio element from the normalized mouse position. –  Nov 29 '14 at 09:35
  • 1
    OK! I'll try~ because I wanna try to create the granular effect by using this technique inside the UI performing ! Thanks a lot for your help!! – JHONGO Nov 30 '14 at 13:36

0 Answers0