Git Product home page Git Product logo

piano's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

piano's Issues

Did you think of opening this design to other instruments ?

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.

MP3 compression incurs considerable latency

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:

image

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

No matching export in "node_modules/webmidi/dist/esm/webmidi.esm.min.js" for import "default"

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.

Error: Cannot find file: 'Tone.js'

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"
  ]
}

Cannot get samples to play correctly

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?

Play scales, chords and chord progressions

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

Doesn't work without webmidi

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

Wrap error with webpack

(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]

Logo design

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

How to cache samples ?

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

I'd like to help finish off refactor-wip

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.