Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mrclay committed Oct 5, 2017
0 parents commit fabc6a3
Show file tree
Hide file tree
Showing 21 changed files with 7,642 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitignore
@@ -0,0 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Empty file added README.md
Empty file.
19 changes: 19 additions & 0 deletions package.json
@@ -0,0 +1,19 @@
{
"name": "piano2",
"version": "0.1.0",
"private": true,
"homepage": "http://machine1.test/piano2/build/",
"dependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.0.14",
"tone-piano": "^0.0.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
6 changes: 6 additions & 0 deletions public/.htaccess
@@ -0,0 +1,6 @@
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
</IfModule>
Binary file added public/favicon.ico
Binary file not shown.
56 changes: 56 additions & 0 deletions public/index.html
@@ -0,0 +1,56 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web App is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<section style="text-align:left">
<hr>
<h2>About</h2>
<p>Need to capture a short musical idea or share it with others? Just tap some notes or play your MIDI keyboard, and click <i>Save to URL</i>. You can share the resulting page URL or bookmark it.</p>
<p><a href="https://github.com/mrclay/Piano/tree/piano_prod">Source</a></p>
<h3>Limitations</h3>
<p><strong>No velocity is captured (yet).</strong> There are a <i>lot</i> of piano samples and I'd have to pull a ton more of them in on the initial page load, or hack the velocity by playing the existing ones at different volumes, probably not sounding great. I've also considered just bailing on the piano sound and generating something pleasant with Tone.js. I'm open to suggestions.</p>
<p><strong>Captured timing is imperfect</strong>. Due to the reliance on setTimeout() to play back notes, timing was never going to be great, plus, more exact timing makes the URLs much bigger, so I've sacrificed some granularity. This isn't for professional work.</p>
<h3>Credits</h3>
<ul>
<li><a href="https://yotammann.info/">Yotam Mann</a>: <a href="https://github.com/tambien/Piano">API modeling a piano</a> using <a href="https://archive.org/details/SalamanderGrandPianoV3">Salamander samples</a>, based on <a href="https://tonejs.github.io/">Tone.js</a>.</li>
<li><a href="http://www.mrclay.org/">Steve Clay</a>: Page UI, logic to play the piano API, capture notes, encode to URLs.</li>
</ul>
</section>
</body>
</html>
15 changes: 15 additions & 0 deletions public/manifest.json
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
107 changes: 107 additions & 0 deletions src/App.css
@@ -0,0 +1,107 @@
body {
width: 1246px;
text-align: center;
margin: 50px auto;
}

h1 {
font-style: italic;
}
h1.unsaved {
color: #ccc;
}

#piano {
width: 1246px;
margin: 0 auto;
position: relative;
background: #444;
}
.white {
z-index: 1;
padding-left: 10px;
border: 1px solid #ccc;
overflow: auto;
}
.black {
position: absolute;
top: 0;
left: 0;
}
.white a {
float: left;
margin-left: 2px;
width: 32px;
height: 160px;
-moz-border-radius: 2px 2px 5px 5px;
-webkit-border-radius: 2px 2px 5px 5px;
border-radius: 2px 2px 5px 5px;
background: #fff;
color: #000;
font-weight: 700;
}
.black a {
position: absolute;
top: 0;
width: 16px;
height: 100px;
border: 2px solid #000;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
background: #000;
color: #fff;
}
.white > a.active,
.black > a.active {
background: #74c674;
}

section {
margin: 20px auto;
width: 600px;
}

#play, #stop {
width: 300px;
}
#record {
display: inline-block;
width: 150px;
padding: 6px 12px;
opacity: .5;
}
#record.new_recording {
color: #600;
opacity: 1;
}

#record.new_recording i {
animation: record-pulse 1s infinite;
}

@keyframes record-pulse {
0% {
color: #fff;
}
50% {
color: #900;
}
100% {
color: #fff;
}
}

#record.active {
background: #600;
}

.progress-bar {
transition: none;
}​

#chord {
width: 7em;
font-size: inherit;
}

0 comments on commit fabc6a3

Please sign in to comment.