sono
sono copied to clipboard
Are custom loop points supported?
Web Audio allows to set the .loopStart
and .loopEnd
properties on the AudioBufferSourceNode
. Can I use them with Sono?
Hi @tgrajewski you can access the AudioBufferSourceNode
of a sound via sound.sourceNode
so you could set it after creating the sound. If it's not loaded you'll need to wait for the 'ready' event.
Something like:
const sound = sono.create('my_sound.mp3')
sound.loop = true
sound.once('ready', () => {
sound.sourceNode.loopStart = 1
sound.sourceNode.loopEnd = 2
sound.play()
})
@ianmcgregor I've hoped that it would be that simple, but unfortunately it doesn't work. The .sourceNode
property is GainNode
and doesn't have the .loopStart
and .loopEnd
properties. I'm missing something?