Sunday 15 August 2010

html5 - Playing parts of an audio file in WebAudio -


Instead of loading 9 different audio files with a different sound effect, I changed my sound effects into a .ogg file Compiled and I have different start and stop times for each effect, however, I do not see any way to manage it in the WebAudio API. I'm sure there is anyone there?

How to do it here

  var reference = new audiotent (); Var mainNode = context.createGainNode (0); MainNode.connect (context.destination); Function play_sound (sound, start, length) {var source = context.createBufferSource (); Source.buffer = get_buffer (sound); // value get_buffer is a file that has already become source.connect (mainNode); // context.ecodeAudioData () with load and decode source. Start (0, start, length); } // says that I want to play 0.2 second sound effect in sfx.ogg, which starts in 0.5 seconds. Play_sound ('sfx.ogg', 0.5, 0.2);    

No comments:

Post a Comment