alemangui / pizzicato Goto Github PK
View Code? Open in Web Editor NEWLibrary to simplify the way you create and manipulate sounds with the Web Audio API.
Home Page: https://alemangui.github.io/pizzicato/
License: MIT License
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
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?
Hi there,
thanks for the great plugin! The best for playing with effects :) I discovered it recently and now I try to implement it at a website. But at first load I preload multiple tracks with the preloader script from HTML5Rocks. https://www.html5rocks.com/en/tutorials/webaudio/intro/js/buffer-loader.js
And now I'm not sure how to use these buffer objects instead of an url at init. I tried to edit the initializeWithUrl function but no succes.
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?
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?
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.
How do i get a volume and other such information out of individual sound sources? Please list all of the available data..
is there any way to calculate if the object is currently playing and what play time it got?
Is it possible to change a sound's file path and have it load the new sound?
I would like to use Pizzicato with local files, like with Howler.
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
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
?
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.
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.
How do I import this great module via a node/angular setup?
If the same effect is used for multiple sounds, using addEffect()
or removeEffect()
will disconnect the effect from other sounds where it might be used.
This fiddle describes one of the side effects: https://jsfiddle.net/9yjm84tm/2/
The correct terms are attack and release, not sustain. Check wikipedia for a more complete explanation.
The links in the upper left corner of at https://alemangui.github.io/pizzicato/ point to version 0.3.2, which is missing some effects. Looks like 0.6.1 is the current version according to Github.
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?
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?
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!
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.
First i got to say that pizzicato is awesome till now, awesome work on it :)
But is there also a way to set the play rate? (play speed)
Something like this example:
http://webaudiodemos.appspot.com/wubwubwub/index.html
you can set rate 1 for normale speed, 0 for pause and -1 for going backwards.
Is that something that can also be accomplished with pizzicato?
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.
I wonder how did most recording could sound coming from the center to the left and right without harsh sounding? Limiter effect does the job and what other possible effects?
https://www.youtube.com/watch?v=A8LoaOjgn9E
https://www.youtube.com/watch?v=tuvWpVCUbr0
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
Sound
and Effect
objects should be able to interact with AudioNodes.
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?
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.
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!
One a sound is recorded, and edited with the effects, can i save it? transform to a blob representing the audio data or to a base64?.
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?
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.
Do you have any plans to add convolver effects to Pizzicato? Reverb and the like.
I ask, partly to find out if you're working on it already. I've also spent the evening hacking it in myself,
https://github.com/JohnPaulHarold/pizzicato/tree/effect_reverb
The function should be replaced by navigator.mediaDevices.getUserMedia
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
I've made a quick modification for my own project using createPanner() instead. Just posting it here in case you'd like to add it in as a fallback.
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
Adding option to play sound in milliseconds precision?
Sound.play(500, 500, "ms")
When changing the time parameter of delay effects we get an unusual noise. The change in parameters should be smooth enough to avoid unwanted side effects.
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?
Tested on Google Chrome Stable and newest update, macOS 10.12.
var groupR = new Pizzicato.Group(allkeysRight);
var groupL = new Pizzicato.Group(allkeysLeft);
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)
}
The possibility to chain addEffect
calls should be added into Pizzicato.
E.g.,
sound.addEffect(delay).addEffect(flanger).addEffect(distortion)
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?
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?
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?
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.
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?
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?
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.