Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #597047

    Hi,
    I am trying to use WebAudio capabilities in Enfold, and basically I got stuck with the basics: how to embed javascript. I tried with “Code Block”, but I have not been successful so far.

    As example, I would like to reuse the code in
    http://www.html5rocks.com/en/tutorials/webaudio/intro/js/rhythm-sample.js
    along with a button to play the function, such as
    <input type=”button” onclick=”RhythmSample.play();” value=”Play”/>

    I would appreciate tips on how to use “Code Block” for that.
    Thanks in advance,
    Luis

    #597051

    Hi kieslingerb!

    can u please explain us what you need to achieve, because adding so much javascript inside and need also to know what you want to call and how it will be called, what incendiaries it has as gallery etc..

    Regards,
    Basilis

    #597162

    Thanks Basilis. My knowledge on Web programming is quite limited.
    I pointed to the Web Audio examples as a good reference because I want to include some audio things. Not really important what.
    As a very first step, I would like to have a button displayed like this
    <input type="button" onclick="RhythmSample.play();" value="Play"/>
    No problem. I embedded in the “Code block” and the button gets displayed.
    However the function it calls is in an external JS file, that should be loaded as
    <script src="js/rhythm-sample.js"></script>
    And that’s when the problem starts because I do not how to upload external JS files in Enfold.
    I decided to put the whole JS code wrapped with the <script> tag in the “Code Block” but it is not working, as pressing the button does not play music. Moreover, I would like to reuse the function somewhere else.
    Please let me know if I was clear enough.
    Thanks!
    Luis

    #598769

    Hi Luis!

    The JavaScript needs to be uploaded as an external file. To achieve this you need to access the files you have on your server using an FTP client such as FileZilla to upload the JS file. Or depending on your web hosting provider, they may have a platform for you to access the files you have on their server and upload the file.

    After uploading the file, you need to get the file path to change the src in this code <script src=”js/rhythm-sample.js“></script>. Once you upload it externally and change the source properly then the button should function.

    Regards,
    Jordan

    #661723

    (A few months later) Thanks for the reply. It worked!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Web Audio in Enfold’ is closed to new replies.