Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c3bf684
Added setup files
jstoessel Oct 10, 2020
909cae9
added blank server file in case needed
jstoessel Oct 10, 2020
b2651f7
Modified project directory
jstoessel Oct 10, 2020
c62cea4
Created a template piano application.
jstoessel Oct 11, 2020
fbe0451
Piano working and added new color palette
jstoessel Oct 11, 2020
56a4e23
Basic UI done.
jstoessel Oct 11, 2020
90b68f4
Added express server
jstoessel Oct 11, 2020
d4e8ccd
Piano works but piano generation doesn't.
jstoessel Oct 11, 2020
eeea151
Removed old project files and injected new Audio Web API
jstoessel Oct 11, 2020
7cae96f
Keyboard implemented and works with key presses
jstoessel Oct 11, 2020
18d4a09
fixed json settings to new code
jstoessel Oct 11, 2020
6e7e585
created setSettings function
jstoessel Oct 11, 2020
d6e19dd
fixed number and range bug
jstoessel Oct 11, 2020
81ea8cb
buttons now set and apply settings as anticipated
jstoessel Oct 11, 2020
82fe8e8
Sectioned code with comments
jstoessel Oct 11, 2020
66178b7
Modal works, everything besides Piano centered
jstoessel Oct 11, 2020
55ef440
Added some style and fixed piano positioning.
jstoessel Oct 11, 2020
701be56
Added keyboard keys to piano
jstoessel Oct 11, 2020
b030f73
added easteregg
jstoessel Oct 11, 2020
6d261e8
Added to readme
jstoessel Oct 11, 2020
91b5f12
added project link to github
jstoessel Oct 11, 2020
456d96a
fixed naming convention
jstoessel Oct 11, 2020
57b300c
added link to readme
jstoessel Oct 11, 2020
1309f47
Added virtual_piano app png
jstoessel Oct 11, 2020
fe98c03
added capital PNG to file
jstoessel Oct 11, 2020
cb7aeb4
fixed html warnings
jstoessel Oct 11, 2020
6330d54
fixed css warnings
jstoessel Oct 11, 2020
1bbb661
credits
jstoessel Oct 11, 2020
2d40c29
credits sizing
jstoessel Oct 11, 2020
5dca57c
Added glitch in case heroku doesn't work
jstoessel Oct 11, 2020
c192030
Added Glitch deployment comment
jstoessel Oct 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.DS_Store
node_modules/
package-lock.json
59 changes: 13 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,26 @@
Assignment 4 - Creative Coding: Interactive Multimedia Experiences
===
Jordan Stoessel

Due: October 11th, by 11:59 PM.
For this assignment we will focus on client-side development using popular audio technologies; the server requirements are minimal. The goal of this assignment is to refine our JavaScript knowledge while exploring the multimedia capabilities of the browser.

For this assignment we will focus on client-side development using popular audio/graphics/visualization technologies; the server requirements are minimal. The goal of this assignment is to refine our JavaScript knowledge while exploring the multimedia capabilities of the browser.

Baseline Requirements
---

Your application is required to implement the following functionalities:

- A server created using Express. This server can be as simple as needed.
- A client-side interactive experience using at least one of the following web technologies frameworks.
- [Three.js](https://threejs.org/): A library for 3D graphics / VR experiences
- [D3.js](https://d3js.org): A library that is primarily used for interactive data visualizations
- [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API): A 2D raster drawing API included in all modern browsers
- [SVG](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API): A 2D vector drawing framework that enables shapes to be defined via XML.
- [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API): An API for audio synthesis, analysis, processing, and file playback.
- A user interface for interaction with your project, which must expose at least six parameters for user control. [dat.gui](https://workshop.chromeexperiments.com/examples/gui/#1--Basic-Usage) is highly recommended for this. You might also explore interaction by tracking mouse movement via the `window.onmousemove` event handler in tandem with the `event.clientX` and `event.clientY` properties. Consider using the [Pointer Events API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events) to ensure that that mouse and touch events will both be supported in your app.
- Your application should display basic documentation for the user interface when the application first loads. This documentation should be dismissable, however, users should be able to redisplay it via either a help buton (this could, for example, be inside a dat.gui interface) or via a keyboard shortcut (commonly the question mark).
- Your HTML and CSS should validate. There are options/plugins for most IDEs to check validation.

The interactive experience should possess a reasonable level of complexity. Some examples:
### Three.js
- A generative algorithm creates simple agents that move through a virtual world. Your interface controls the behavior / appearance of these agents.
- A simple 3D game
- An 3D audio visualization of a song of your choosing. User interaction should control aspects of the visualization.
### Canvas
- Implement a generative algorithm such as [Conway's Game of Life](https://bitstorm.org/gameoflife/) (or 1D cellular automata) and provide interactive controls. Note that the Game of Life has been created by 100s of people using <canvas>; we'll be checking to ensure that your implementation is not a copy of these.
- Design a 2D audio visualizer of a song of your choosing. User interaction should control visual aspects of the experience.
### Web Audio API
- Create a screen-based musical instrument using the Web Audio API. You can use projects such as [Interface.js](http://charlie-roberts.com/interface/) or [Nexus UI](https://nexus-js.github.io/ui/api/#Piano) to provide common musical interface elements, or use dat.GUI in combination with mouse/touch events (use the Pointer Events API). Your GUI should enable users to control aspects of sound synthesis.
### D3.js
- Create visualizations using the datasets found at [Awesome JSON Datasets](https://github.com/jdorfman/Awesome-JSON-Datasets). Experiment with providing different visualizations of the same data set, and providing users interactive control over visualization parameters and/or data filtering. Alternatively, create a single visualization with using one of the more complicated techniques shown at [d3js.org](d3js.org) and provide meaningful points of interaction for users.

Deliverables
---

Do the following to complete this assignment:
## Virtual Piano using Web Audio API

1. Implement your project with the above requirements.
3. Test your project to make sure that when someone goes to your main page on Glitch/Heroku/etc., it displays correctly.
4. Ensure that your project has the proper naming scheme `a4-firstname-lastname` so we can find it.
5. Fork this repository and modify the README to the specifications below. *NOTE: If you don't use Glitch for hosting (where we can see the files) then you must include all project files that you author in your repo for this assignment*.
6. Create and submit a Pull Request to the original repo. Name the pull request using the following template: `a4-firstname-lastname`.
https://a4-jordan-stoessel.glitch.me

Sample Readme (delete the above when you're ready to submit, and modify the below so with your links and descriptions)
---
The Virtual Piano app was made to allow a Piano to be played on a computer's physical keyboard. It makes use of Web Audio API as seen in https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API. Virtual Piano features a Piano interface which was created using Web Dev Simplified's HTML & CSS tutorial. Playing notes can be done by pressing the key on the note that you want to play. There are also user parameters that can be controlled such as a volume bar, filter frequency bar, waveforms, and pass filter types. The volume and frequency bars are synced with the numberal input next to it and vice versa; this was done using a sync function to read changes in input from either inputs. The user can also save their current settings, load their last saved settings, or reset their current settings to default. This was done by creating a simple server that holds the default settings of 0.5 volume, sine waveform, low-pass pass filter type, and a frequency of 1,000. The server utilizes express and the body-parser middleware for ease of use. There is a modal that can be opened and closed at will for those who are confused about using the app. This modal can be found after clicking the "Help!" button at the bottom of the application. The Virtual Piano app can be seen below.
![Virtual Piano](https://github.com/jstoessel/a4-creative-coding/blob/master/virtual_piano.PNG?raw=true)

## Your Web Application Title
There were multiple challenges with creating this application. At first, I made use of .mp3 files to create and test the Piano while also trying to generate different amounts of octaves. This proved to be difficult as the Piano became unresponsive when generated with javascript into HTML. As such, I had to redo the project and salvage code while implementing the Web Audio API for the next attempt. Key presses and sound are disconnected, but synced to the same key presses. As such, pressing Z will both play the "C1" note while also making the lower C key highlighted. Adding and removing key presses proved to be difficult since it required a separate function to not give an error. Clicking was working for the broken code, but a click function would prove to be unecessary and also inefficient to add. Heroku deployment did not work, therefore I deployed to Glitch instead. The application makes use of Adobe's color palette which then led me to changing the sliders to stand out on the blue background. The color palette can be seen below.
![Color Palette](https://github.com/jstoessel/a4-creative-coding/blob/master/color_palette.png?raw=true)

your hosting link e.g. http://a4-charlieroberts.glitch.me

Include a very brief summary of your project here. Images are encouraged when needed, along with concise, high-level text. Be sure to include:
### Credits to:

- the goal of the application
- challenges you faced in realizing the application
- the instructions you present in the website should be clear enough to use the application, but if you feel any need to provide additional instructions please do so here.
Web Dev Simplified for Piano visual tutorial and modal tutorial
css-tricks.com for slider customization options
https://pages.mtu.edu/~suits/notefreqs.html for note frequencies
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API for Web Audio API tutorial
Binary file added color_palette.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
<title>Virtual Piano with Audio API</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<script src="scripts.js" type="module"></script>
</head>

<body>
<h1>Virtual Piano</h1>

<p class="footer">Application by <a href="https://github.com/jstoessel">Jordan Stoessel</a> for CS4241's Assignment
4<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">.</a></p>

<div class="modal" id="modal">
<div class="modal-header">
<div class="modal-title">Welcome to Virtual Piano!</div>
<button data-close-button class="close-button">&times;</button>
</div>
<div class="modal-body">
Here you can mess around on the Piano and play to your heart's content. The Piano is made using Web Audio API to create an oscillation. This oscillation can be controlled using the keyboard. The notes have a corresponding key to play the Piano. You may also control the Volume, Waveform, Pass Filter, and Filter Frequency below. If you find a setting you like, you can save the settings [Save Current Settings] and load the previously saved settings [Load Saved Settings] back at any time. If you mess up the settings you can always press the [Reset Default] button to reset the settings back to default. Click the [X] or off the modal to close.
</div>
</div>
<div id="overlay"></div>

<div class="piano" id='pianotable'>
<!-- First octave -->
<div data-note="C1" class="key white" id="C1">Z</div>
<div data-note="Db1" class="key black">S</div>
<div data-note="D1" class="key white">X</div>
<div data-note="Eb1" class="key black">D</div>
<div data-note="E1" class="key white">C</div>
<div data-note="F1" class="key white">V</div>
<div data-note="Gb1" class="key black">G</div>
<div data-note="G1" class="key white">B</div>
<div data-note="Ab1" class="key black">H</div>
<div data-note="A1" class="key white">N</div>
<div data-note="Bb1" class="key black">J</div>
<div data-note="B1" class="key white">M</div>

<!-- Second octave -->
<div data-note="C2" class="key white">Q</div>
<div data-note="Db2" class="key black">2</div>
<div data-note="D2" class="key white">W</div>
<div data-note="Eb2" class="key black">3</div>
<div data-note="E2" class="key white">E</div>
<div data-note="F2" class="key white">R</div>
<div data-note="Gb2" class="key black">5</div>
<div data-note="G2" class="key white">T</div>
<div data-note="Ab2" class="key black">6</div>
<div data-note="A2" class="key white">Y</div>
<div data-note="Bb2" class="key black">7</div>
<div data-note="B2" class="key white">U</div>

<!-- Third octave -->
<div data-note="C3" class="key white">I</div>
</div>

<br>

<!-- Settings for the webpage -->
<div class="controllers">
<span>Volume: </span>
<input type="range" min="0.0" max="1.0" step="0.01" value="0.5" id="volLevelRange">
<input class="volume-input" type="number" min="0.0" step="0.01" max="1.0" value="0.5" id="volLevelNumber">
<br>
<br>

<span>Waveform: </span>
<select id="waveform">
<option value="sine" selected="selected">Sine</option>
<option value="square">Square</option>
<option value="sawtooth">Sawtooth</option>
<option value="triangle">Triangle</option>
</select>
<br>
<br>

<span>Pass Filter Type: </span>
<select id="passType">
<option value="lowpass" selected="selected">Lowpass</option>
<option value="highpass">Highpass</option>
<option value="bandpass">Bandpass</option>
</select>
<br>
<br>
<span>Filter Frequency: </span>
<input type="range" min="27.5" max="10000.0" step="0.1" value="1000.0" id="freqLevelRange">
<input class="frequency-input" type="number" min="27.5" max="100000.0" value="1000.0" id="freqLevelNumber">
<br>
<br>

</div>

<div>
<button id='savebtn'>Save Current Settings</button>
<button id='loadbtn'>Load Saved Settings</button>
<button id='resetbtn'>Reset Default</button>
</div>
<br>
<button data-modal-target="#modal">Help!</button>

</body>

</html>
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "a4-jordanstoessel",
"version": "1.0",
"description": "The fourth assignment of my WebWare course that helps teach creative coding.",
"author": "Jordan Stoessel",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"nodejs": "0.0.0"
}
}
Loading