tambien / piano Goto Github PK
View Code? Open in Web Editor NEWMultisampled Piano implementation using Salamander Grand Piano Sounds
Home Page: https://tambien.github.io/Piano
License: MIT License
Multisampled Piano implementation using Salamander Grand Piano Sounds
Home Page: https://tambien.github.io/Piano
License: MIT License
Hi,
I'm using Piano (love it, it's great!) in an app that creates musical dictations and was thinking of offering other instruments as well.
By the look of it, I was thinking there is a potential for using the program structure to create, say, a guitar, perhaps a flute, using other samples...
Did you already look into this? I'd be happy to work on it.
Christophe.
First, thanks for excellent piano, I'm going to use it in my project (https://chat.concert0x.com).
Just one hiccup:
Chrome complains:
Deprecation] GainNode.gain.value setter smoothing is deprecated and will be removed in M64, around January 2018. Please use setTargetAtTime() instead if smoothing is needed. See https://www.chromestatus.com/features/5287995770929152 for more details.
Could you fix it?
Thanks,
Alex
First of all, thank you for this awesome library. Super convenient to have a high-quality piano sampler easily available in the browser.
I've been investigating potential sources of latency a bit in hopes of making real-time performance feel a bit snappier. I noticed that the MP3 samples themselves have considerable delay before the actual onset of the note. In particular, the MP3 compression seems to have introduced about 50ms of delay to each file, which is present in neither the original uncompressed WAV nor the OGG files (which are not used by default).
Here is a comparison of the onset of one of the files (A4v6
) across WAV/OGG/MP3 from top to bottom:
I tried re-encoding to MP3 with both Audacity and FFmpeg but the delay was present in both. Is this a limitation of the MP3 codec? If so, what would be the easiest way to compensate for the latency on the JS side of things? I was hoping there would be an "offset" option for tone.Sampler
but I don't see it
Hi! 👋
Firstly, thanks for your work on this project! 🙂
I had been getting an error with Webmidi import, I had to do the below change to fix it. I can create a PR for the same :)
WebMidi is being exported as named export in webmidi 3.0.15
Here is the diff that solved my problem:
diff --git a/node_modules/@tonejs/piano/build/midi/MidiInput.js b/node_modules/@tonejs/piano/build/midi/MidiInput.js
index 7c5a066..ab69ffa 100644
--- a/node_modules/@tonejs/piano/build/midi/MidiInput.js
+++ b/node_modules/@tonejs/piano/build/midi/MidiInput.js
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
import { EventEmitter } from 'events';
-import WebMidi from 'webmidi';
+import {WebMidi} from 'webmidi';
export class MidiInput extends EventEmitter {
constructor(deviceId = 'all') {
super();
This issue body was partially generated by patch-package.
Can anyone help me with the correct installation process for this lib? I have tone.js installed and working, but when I run yarn install @tonejs/piano
, it gets added to the package.json
, but it seems to be looking for things inside node_modules
that are not there.
This is the error message:
Cannot find file: 'Tone.js' does not match the corresponding name on disk: './node_modules/Tone/build/tone'.
This is my package.json:
{
"name": "dotcom",
"version": "0.9.0",
"private": true,
"dependencies": {
"@tonejs/piano": "^0.1.0",
"fileapi": "^2.0.25",
"firebase": "^6.2.4",
"fuse.js": "^3.4.5",
"ismobilejs": "^0.5.2",
"lodash": "^4.17.14",
"prop-types": "^15.7.2",
"qs": "^6.7.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-redux": "^7.1.0",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1",
"react-scroll-parallax": "^2.1.0",
"react-waypoint": "^9.0.1",
"redux": "^4.0.4",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"styled-components": "^4.3.2",
"tone": "^13.8.25",
"uuid": "^3.3.2",
"validator": "^10.11.0",
"xml-js": "^1.6.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"stage": "env-cmd .env.development react-scripts build"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
I'm following the basic steps on the README, but when I play a tone I hear a low, rumbling sound instead of piano samples. I installed toneHere's my entire JS file:
import { Piano } from '@tonejs/piano';
document.getElementById('play-button').addEventListener('click', function() {
const piano = new Piano({
velocities : 5,
}).toDestination();
piano.load().then(() => {
piano.keyDown('C4', '+1');
});
});
Here's my package.json for reference:
{
"name": "tonejs-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "parcel",
"dev": "parcel index.html",
"build": "parcel build index.html"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@tonejs/piano": "^0.2.1",
"tone": "^14.7.58",
"webmidi": "^2.5.1"
},
"devDependencies": {
"parcel-bundler": "^1.12.4"
}
}
What am I doing wrong? I noticed that the code in the example folder passes the path to 'samples'. Not sure if I need to be passing that value as well. I looked in the @tonejs/piano folder inside node_modules/ and I didn't see any audio files. How are the samples being installed?
Hi,
Great library :)
Is there any way at all to play sequences like a scale or chords (simultaneously) or even chord progressions or do I have to schedule them myself?
Currently I do it like this:
piano.load().then(() => {
const notes = ['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5'];
notes.forEach((note, i) => {
piano
.keyDown({ note, time: `+${i}` })
.keyUp({ note, time: `+${i + 1}` });
});
});
Which I imagine could become flakey especially with longer progressions and lots of notes in chords.
Let me know what you think :)
Thanks!
David
Great to see project written on Typescript.
Would be possible to publish declaration file as well?
Thanks
Nodejs terminal gives me an error complaining about something like:
export { Piano } from './piano/Piano';
^^^^^^
SyntaxError: Unexpected token 'export'
I have tried the .mjs thing, the type: module thing, I have tried diffrent methods of compiling typescript etc, could somebody tell me how to use this I really want to try this thing out.
Hello! Thanks for the beautiful library!
You have mentioned in README
npm install --save tone
# optional
npm install --save webmidi
however If install only this package, and not installing webmidi, it fails with the following error message:
./node_modules/@tonejs/piano/build/midi/MidiInput.js
Module not found: Can't resolve 'webmidi' in '/Users/fletcherist/jamsandbox/node_modules/@tonejs/piano/build/midi'
is it yet optional or required? thanks in advance
https://github.com/tambien/Piano/blob/master/package.json says 0.2.0
Latest published version is 0.2.1
I'm not sure where the code is for the published version
(node:1044) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ webpack -p
(node:9492) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see webpack/loader-utils#56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
ERROR in ./build/Demo.js from UglifyJs
Unexpected token: operator (>) [./~/midiconvert/src/Util.js:20,0][./build/Demo.js:28240,15]
Your example html use cdn:
<script type="text/javascript" src="https://unpkg.com/@tonejs/piano"></script>
Compare two version:
Version 2.x returns wrong script
Hi,
I have read your work so I decided to creat a logo for you. I hope you like it and you want to use it. I can give you all the formats of the design free. If you want to make changes please specify.
Greetings
Hi !
I'm building a multiplayer game with your instrument (real time game with socket.IO). In my game, each player has it own instance of your piano to avoid note conflict.
So each time a user join a game, all clients loads all samples for this new player and it cause performance issues for other players (mainly delay on socket and UI).
How can I cache all samples to avoid unnecessarry redundant requests ?
Thanks
Hi,
Piano is at the core of an important project of mine (academic research about learning, cognitively).
I've been struggling with a bug lately. I'm not sure it has anything to do with Piano, but refactoring the code might vastly help me debug it.
I'm willing to help - I'm fairly familiar with the lib already, and by looking at the changes in the branch I think I can see what you're aiming at; at the very least, move to ES6, adapt the code to newer versions of the dependencies, write proper JSDoc etc.
It'd be smarter if I asked explicitly though - what are the goals of this branch, any points you'd like me to keep in mind, things to avoid etc?
Also, as you've put some effort JSDoc'ing function types, I'd happily convert some (all?) of the code to TypeScript, if you want.
Thanks,
Gilad
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.