GithubHelp home page GithubHelp logo

alemangui / pizzicato Goto Github PK

View Code? Open in Web Editor NEW
1.7K 1.7K 130.0 10.13 MB

Library to simplify the way you create and manipulate sounds with the Web Audio API.

Home Page: https://alemangui.github.io/pizzicato/

License: MIT License

JavaScript 84.49% CSS 3.78% HTML 11.73%
audio effects javascript sound

pizzicato's People

Contributors

alemangui avatar ggcaponetto avatar hcollin avatar jinjiang avatar johnpaulharold avatar kristianj avatar limonte avatar notepadwebdev avatar programmerino avatar skywhale avatar

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

pizzicato's Issues

The offset is imprecise in a sound with a file source that loops

This issue occurs with Pizzicato.Sound objects that have a file as a source and have the loop: true attribute. After the first looping occurs, the offset becomes imprecise

This can be evidenced by calling sound.pause(); sound.play();. After the first loop the cut will not be seamless and a jump will be heard.

Another way is to add and remove an effect to the sound: sound.addEffect(effect); sound.removeEffect(effect). After the first loop the operation will not be smooth. This is exemplified by @JohnPaulHarold in this demo site.

Uncaught TypeError: this.getRawSourceNode is not a function

On Google Chrome console:

Uncaught TypeError: this.getRawSourceNode is not a function
    at Pizzicato.Sound.value [as getSourceNode] (Pizzicato.js:733)
    at Pizzicato.Sound.value [as play] (Pizzicato.js:428)
    at pz2.html:26
var k1 = new Pizzicato.Sound("assets/piano/"+piano[0]+".wav");
k1.play()

There is a wave file existed and loading file is fine except getRawSourceNode is?

sound.release has no effect

Can anyone confirm that the release has no effect?

var sound = new Pizzicato.Sound();
sound.release = 0.9;

Attack works fine, but release does not. Even with a value of 10 the sound stops abruptly. There is no fade-out effect.

Render convolution effect on one master source?

If we have hundreds of audio files, attach convolution to each audio will consume huge memory usage. Not sure if there are ways to stream multiple sounds to master source and render realtime with convolution?

Preamp or loudness

Some audio source or wave may sound tinny, are there any way to increase loudness or preamp that found in music players? Would be great for improve music quality

Retrieve sound data for upload

Once a sound is recorded, and maybe some effects have been added, Is it possible to retrieve the sound data to be uploaded to server?

Bug in removeEffect

Hi,

While playing around with Pizzicato for my Web Audio Speech I ran into a problem. I created a simple page that uses microphone as an input and by pressing a button you can add effects to it. All fine and well and works great until you try to remove an effect. If the effect that is being removed is not the first effect the pizzicato produces an error:

Uncaught TypeError: this.effectConnectors is not a function

I traced the problem to this line 382 in file Sound.js:
var previousNode = (index === 0) ? this.fadeNode : this.effectConnectors(index - 1);

When index is not 0, this line fails as the this.effectConnectors is an array, not a function. So by changing the line to:

var previousNode = (index === 0) ? this.fadeNode : this.effectConnectors[index - 1];

fixed the problem. I have done this same mistake so many times...

Best Regards,

Henrik Collin

edit: fixed a typo

Same effect to multiple sounds

As far as I can read from the docs, an effect can be attached to a single sound. Is it also possible to attach an effect to multiple sounds at the same time?

The compressor for example should compress multiple sound inputs. Or how does that work exactly?

Test randomly failing: Sound actions should trigger 'end' when ended FAILED

The test on 'end' event tigger fail without a clear reproduction path. Travis CI build 99 failed and build 100 passed with exactly the same source code.

@JohnPaulHarold have you reproduced this locally? It might be related to the loading of the sound file used for the test. This test is the first in the suite to load an external file ('base/tests/click.wav') and the timeout parameter may not be large enough in some systems to correctly fetch it. If so, an idea would be to change the timeout parameter of that test (currently 5000ms) to something larger to make sure it has enough time to get the file.

use in angular/typescript

Hi there, I accidently discovered this lib and it really looks great, congratulations guys. But how to incorporate this lib into typescript? I'm developing with angular, so usually I import the classes I need. I have already tried
import {Pizzicato} from 'pizzicato'
but it didn't work. I get an error:
ERROR ReferenceError: Pizzicato is not defined
It only works when using the cdn-style. But I'd like to import pizzicato in a typescript-file. Any suggestions?

Is it possible to change an effect without removing it?

Im currently using effects something like this:

.removeEffect(effect); // remove old effect
effect = Create new effect // create new effect
.addEffect(effect); // add new effect

But is it also possible to change an effect? like effect(value: 1);
because removing and adding it again, creates alot of laggs and delays

iOS support

I tried the demo site on an iPhone (recent one, not sure the exact model), and the demos didn't work. While I've not gone through and done exhaustive tests to work out why, I'm fairly confident it's to do with Pizzicato initialising itself and therefore an AudioContext as soon as the script is processed.

For iOS, the context needs to be initialised inside a user invoked method, such as a touchend/click event.

callback after end of sound

Hi, me again :)
I just thought it would be a good idea if there would be a listener for the end of a soundfile. I searched in the docu for such a callback but couldn't see anything. There are use-cases, where you want to take some actions after the end of the file has been reached. It would be great to have something like:

let sound = new Pizzicato.Sound('audio.mp3', function () {            
    sound.play();	
    sound.on('end', function() {
        // do some stuff after reaching the end of the file
    });		
});

by the way, I've just found an issue right here about trigger-events at the end of a file. So is a trigger already implemented? I ask as I can't see anything in the official doc.

Pitch effect

How can i get a pitch effect? I am working on create a simple music production app like that of Figure by Propellerhead. But i need a pitch effect without changing the speed or bpm. how can i get it?

Effects don't stop when removed

When removing an effect from a sound, I'd have expected the effect to stop, but instead the effect carries on modifying the source. You can see that the EffectsNode has been removed, it's not that removeEffect is doing nothing, just that it's not cancelling the effect that's been added.

I'd offer up sample code, but following the first example in the Effects section highlights the issue.

Is the above expected behaviour?

Sprites - Time/duration within wave file

We can modify attack and release time, how about modifying duration? I do often have unequal wave file duration e.g. preview audio track that will play 5 seconds (offset fade-in, duration: 5 secs and release fade-out) instead of full length.

Change path source file

how do i change the source path ( from external file )?

source = new Pizzicato.Sound();
source.path = "/link/to/steam.mp3";

Sadly this does not work.

Group don't work

Hi team, first: thanks for this library it's rock!
Second: I have a issue with group.play()

I test this code:

var drums = new Pizzicato.Sound('./audio/drums.mp3');
var guitar = new Pizzicato.Sound('./audio/guitar.mp3');
var bass = new Pizzicato.Sound('./audio/bass.mp3');

var group = new Pizzicato.Group([drums, guitar]);

group.addSound(bass);
group.play();

And I have a error... I test others method ('wave') and individual sound and work! But group cause an error for me...

Please I need your help.
Thanks!

start offsets

Currently, you can make a Sound, and play it. But what if I want to make the Sound, and play it 10 seconds later, or at a specific context.currentTime?

What's stopping Pz from doing this, if anything?

SFZ wave files in Pizzicato

What is the recommendation to load 88 wave files that use with SFZ format, contains wave files of 1MB+ each and good enough to run on Pizzicato?

What is the maximum channels we can play from wave file?

Setting an effect's object parameters after it is created

Hi @alemangui . Thanks for creating Pizzicato. It is a nice and friendly API that makes working with web audio painless! :)

I'm using it to make a sampler where I want the users to be able to change the effects parameters to craft their sound. So far, I've been able to do this with the sound object's "options" (for example, setting a new attack value works), but not by assigning new values to an effect's "options" object. I assume that these parameters are assigned to the nodes of the effect chain upon creation, and then they won't set their corresponding values again.

So, is there a way to set an effect parameters after they're created other than messing directly with the effect's audio nodes?

Here's a small sample of what I'm trying to do:

var tremolo = new Pizzicato.Effects.Tremolo({
    speed: 5,
    depth: 1,
    mix: 1
});
sound.addEffect(tremolo );
tremolo.speed = 15;

sound.play(); 
//Speed is still 5. Can I set it to 15 without directly manipulating the nodes?

Thanks in advance!

Create more than one stereopanner?

Tested on Google Chrome Stable and newest update, macOS 10.12.

  1. Multi-stereo panner?
    I tried to create 2 groups and apply stereopanner effect seem it only one effect can be used?
    Can we apply individual panner for individual instruments?
var groupR = new Pizzicato.Group(allkeysRight);
var groupL = new Pizzicato.Group(allkeysLeft);
  1. Distortion with >0 value? Only certain file can produce distortion, for example a piano has 88 keys, the few keys on the bass range will result in distorted sound, the mid to high range is fine.

Negative value in stereo panner across all keys is working fine.

//allkeys load wave files

var stereoPanner = new Pizzicato.Effects.StereoPanner({pan: -0.4});
var stereoPanner2 = new Pizzicato.Effects.StereoPanner({pan: 0.1});

var group = new Pizzicato.Group(allkeys);
for(var i=0;i<24;i++) {
    allkeys[i].addEffect(stereoPanner2)
}

playing sound at a precise timeline value

I have the following scenario:
1- Open an audio file with pizzicato
2- Get the desired starting point time on the timeline from a user triggered event
3- Pass the time to pizzicato to start playing the audio at the exact time specified

Now the question is how can i do that i didn't see an example showing that and is it even possible to do it with pizzicato?

Creating Too Many Sounds Mutes Audio

Hello,

I am creating a lot of sounds, each with their own effects. When their settings change, I create new sounds instead of modifying the existing ones. After the second settings change, all sounds stop playing with no errors printed to the console.

I think that this is due to the amount of sounds being created, and Pizzicato holding on to them even though I stopped referencing them in my code. Is there any way I can clear unused sounds from the audio context?

initializeWithBuffer

for a project, I found myself needing a way to load in a set of sounds, but then to duplicate those sounds. It's for a simple loops based sequencer of sorts. What I ended up doing was loading in the sound files once, and then duplicating them as needed by copying the buffers from getRawSourceNode(), bypassing the need to create a whole new Sound object again. This might have been particular to my use case, and perhaps there's another way, but I added in initializeWithBuffer function, and then the option to create a Sound where the source: is 'buffer'

If you feel like examining this some more, I can push my quick branch and then review it.

Repetition on the same wave files

If the piano will need to play fast on the same notes, if I use sound.stop() when keys is release, the sound is cut off absurdly which is not right for sustain playing. How do I repeat the same wave that can overlap a bit of each tone?

While playing, how can I set the play timing back to certain time to continue from there?

Max buffer audio

What is the max limit of sounds can be play at the same time? Can play up to 128 or unlimited voices/polyphonic just like the keyboards?

Reroute Sound destinations

I have a need to create Sound objects, but send them to a splitter, and then connect the splitter to the context.destination, but I'm not seeing how this can be done currently.

My use case is that I'd like to split the signal of many/some/one Sound object(s), add an analyser to each channel of the splitter, and then connect the splitter to destination. I don't have a need for analysers per Sound object. Is this possible in the current Pizzicato?

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.