JavaScript for Sound Artists: Learn to Code with the Web Audio API by Turner William & Leonard Steve
Author:Turner, William & Leonard, Steve [Turner, William]
Language: eng
Format: azw3, epub
Publisher: CRC Press
Published: 2017-01-20T05:00:00+00:00
HTML
<input type="button" value = "Play">
<input type="button" value = "Pause">
<input type="button" value = "Stop">
JQuery/JavaScript
$(function() {
$("input").on("click",function(){ /*assign event listener to all
input elements*/
console.log($(this).val()); /*use the this keyword to access the
element clicked and return its value property*/
});
});
Refactoring the Oscillator Player to Use JQuery
Now that you understand some JQuery basics, you are going to refactor the application you created in the previous chapter by replacing the built-in JavaScript DOM methods with JQuery selectors and methods.
Copy the completed code from the previous chapter to a new directory. In your index.html file reference the JQuery library.
<head>
<meta charset="UTF-8">
<title>CSS and HTML</title>
<script type="text/javascript" src="https://ajax.googleapis.
com/ajax/libs/jquery/2.1.0/jquery.js" charset="utf-8">
</script>
<script src="js/app.js"></script>
<link rel="stylesheet" href="css/app.css">
</head>
Replace the app.js file with a new empty file with the same name.
In the old application, you used this function to encapsulate your code:
window.onload = function() {
}
In the new version of your code, make sure you replace window.onload with the equivalent JQuery function. Also put "use strict" and the AudioContext instantiation at the top of the file, as in the following example:
"use strict";
var audioContext = new AudioContext();
$(function(){
// all code will go here
});
Next, modify the first three variables of the JavaScript file to use JQuery selectors.
Download
JavaScript for Sound Artists: Learn to Code with the Web Audio API by Turner William & Leonard Steve.epub
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9913)
The Mikado Method by Ola Ellnestam Daniel Brolund(9777)
Dependency Injection in .NET by Mark Seemann(9337)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7778)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Svelte with Test-Driven Development by Daniel Irvine(7137)
Test-Driven Development with PHP 8 by Rainier Sarabia(6864)
Layered Design for Ruby on Rails Applications by Dementyev Vladimir;(6731)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6532)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6413)
Web Development with Django by Ben Shaw Saurabh Badhwar(6199)
React Application Architecture for Production by Alan Alickovic(5923)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5806)
Kotlin in Action by Dmitry Jemerov(5062)
Audition by Ryu Murakami(4583)
Software Architecture for Web Developers by Mihaela Roxana Ghidersa(4440)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4316)
Accelerating Server-Side Development with Fastify by Manuel Spigolon Maksim Sinik & Matteo Collina(4286)
Functional Programming in JavaScript by Mantyla Dan(4038)
