rserota / wad

Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.
MIT License
1.9k stars 160 forks source link

Plays an audio source file for a few seconds then cuts off #28

Closed jescalan closed 9 years ago

jescalan commented 9 years ago

Weird issue, just curious if you quickly know a fix for this. When I load in an audio file as the source, it does play it for a few seconds, but then it stops. I would expect it to play the whole thing through, of course.

Here's a very simple example to demonstrate this issue. I have tested it with different audio sources, and with wav files as well but each time I get the same behavior, it stops abruptly after a few seconds :confused:

http://wad-test.netlify.com

rserota commented 9 years ago

I think I know what your problem is.

You need to make sure that the 'hold' parameter on the wad's envelope is longer than your audio clip. var song = new Wad({ source : 'http://www.myserver.com/audio/song.wav', env : { hold : 400 } })

For performance reasons, the default hold period is about 3 seconds long, but if you need to play a whole song as an audio clip, you will need to override the default setting.

jescalan commented 9 years ago

Ah awesome, thank you! Will try this out and report back shortly

jescalan commented 9 years ago

Working perfectly with this additional param