Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are custom loop points supported? #55

Open
tgrajewski opened this issue Dec 7, 2018 · 2 comments
Open

Are custom loop points supported? #55

tgrajewski opened this issue Dec 7, 2018 · 2 comments

Comments

@tgrajewski
Copy link

Web Audio allows to set the .loopStart and .loopEnd properties on the AudioBufferSourceNode. Can I use them with Sono?

@ianmcgregor
Copy link
Contributor

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()
})

@tgrajewski
Copy link
Author

tgrajewski commented Dec 11, 2018

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants