This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Dan Clarke
Posted Apr 14 - Read on Facebook

Following on from my earlier question. How can I trigger audio snippets? Say the user clicks on a button, how can I trigger a 'k-click' sound?

8 Comments

Jonas Treub

audio = new Audio("pathToFile")
audio.play()

Dan Clarke

thanks!

Dan Clarke

question....is there a way to retrigger the audio. if i press the button twice quickly then it only plays the sound once....

Dan Clarke

it seems the only way around this is reloading the file each time? audio.load()

Dan Clarke

also wondering if I can load the audio in to a buffer on launch? sometimes the audio plays slightly after the button is clicked....

Jon Madison

you might want to try to just bring in a 3rd party library, i.e. http://www.createjs.com/soundjs

Dan Clarke

Unfortunately I am having trouble brining in the soundjs library. I've followed the instructions in the framer docs (https://framer.com/docs/#modules.npm) and I can get it working based on the example using 'moment.

However, soundjs doesn't have a .js in it's main directory. In it's library it has a great many, but each has a name that is hyphenated or includes numbers that framer doesn't seem to like. Please see the images showing the different folder states and the different responses from framer.

N.B. In each example I am only using one of the libraries in my npm.coffee. Including soundjs in the module but not in the main code still throws errors. So I'm thinking it's something to do with the module?

Jordan Robert Dobson

Send me a simplified file and I'll help you out. :)

Read the entire post on Facebook