theodeus / tuna Goto Github PK
View Code? Open in Web Editor NEWAn audio effects library for the Web Audio API.
An audio effects library for the Web Audio API.
Seems to clip all the time..
I'm experiencing a very strange bug with the WahWah effect in Tuna.js. When I compile my electron app which uses WahWah. No matter what options I pass in (Even just bypass). I get the following error:
TypeError: Cannot assign to read only property 'Q' of object '#'
Web Tools debugging tracks the error down to this line:
https://github.com/Theodeus/tuna/blob/master/tuna.js#L1978
I really appreciate the work put into this library, it's been great to use, this one is just a bit of a head scratcher.
Hi,
Great bunch of effects! I'm having a lot of fun playing around with them. However, I am having trouble figuring out how to automate parameters of a particular effect. For example if I have a chorus effect like so -
//////////////////////////////////////////////////////////////////////////////////////////
var chorus = new tuna.Chorus({
rate: 1.5, //0.01 to 8+
feedback: 0.2, //0 to 1+
delay: 0.0045, //0 to 1
bypass: 0 //the value 1 starts the effect as bypassed, 0 or 1
});
soundSource.buffer = buffer;
soundSource.connect(chorus.input);
chorus.connect(context.destination);
chorus.automate("feedback", 0.8,10,5);
//////////////////////////////////////////////////////////////////////////////////////////
Could someone tell me whats the right way to go about automation of the feedback parameter as this does not seem to work.
Thanks,
Anand
First of all, thanks for sharing this great code with everyone and demonstrating the potential of the Web Audio API.
I have a working implementation of Tuna on my development server. Playing with the effects, it seems the "bypass" parameter either doesn't work, or that I'm misinterpreting what it is supposed to do.
My assumption is that "bypass" is supposed to operate like the toggle on/off switch on a real effects pedal. But my experience is that any Tuna effect is always "on" any time the effect is present in the signal chain. That is, setting "bypass" to 0 or 1 seems not to do anything at all; the effect is always on.
For example, if I have something like this...
source.connect(chorus.input);
chorus.connect(delay.input);
delay.connect(audioContext.destination);
...it makes no difference whether the delay and/or chorus effects are set to bypass (0 or 1); either way, both delay and chorus are present in the output.
That's also true for single-effect chains. For example...
source.connect(delay.input);
delay.connect(audioContext.destination);
...results in delay regardless of the delay's bypass setting.
I'm using Chrome 25 on an XAMPP server.
Hello everyone.
I tried to open the Tuna demo in Firefox and Chrome, both locally and on a webserver, but it shows me a message saying the web audio API is not supported, and to download Chrome to enjoy the demo.
Note I'm on Linux.
Thanks in advance for either.
Bye, Ivano.
I've created a test effect and tried to connect a gain node to its input. I receive the following error:
"Failed to execute 'connect' on 'AudioNode': No function was found that matched the signature provided."
Here is an example of the code:
var testFX = new app.tuna.Phaser({
rate: 1.2, //0.01 to 8 is a decent range, but higher values are possible
depth: 0.3, //0 to 1
feedback: 0.2, //0 to 1+
stereoPhase: 30, //0 to 180
baseModulationFrequency: 700, //500 to 1500
bypass: 0
});
this.masterGainNode.connect(testFX);
Have I done something wrong here? I can connect the masterGainNode to the destination fine. Also, I can do a console.log() on testFX and see that a tuna node has been created.
Hello Oskar,
It appears that there is additional zero in your docs in regards to PingPongDelay
It reads:
delayTimeLeft: 150, //1 to 10000 (milliseconds) delayTimeRight: 200 //1 to 10000
while it should be:
delayTimeLeft: 150, //1 to 1000 (milliseconds) delayTimeRight: 200 //1 to 1000
Hello there.
My name is Ivano Arrighetta and I'm Italian.
I wonder if Tuna supports the following effects:
bass boost
delay
waveshaper
amplifier
chorus
compressor
equalizer
noise gate
flanger
phaser
sidechaining (with or without compressor)
limiter
vocoder
Thanks in advance for any help.
Bye, Ivano.
Thanks for tuna - it's a great FX lib!
In my tests, using Tuna FX on Firefox gives bad results (Mac and PC). The sound is warbling (fluctuating in and out rapidly). Is this something you are aware of? Any suggested fixes?
Tuna effect instances should have a disconnect
method that handles disconnecting it's inputs and outputs.
.
Some effects depend on BPM. Need to figure out how to deal with this in a consistent way. A global BPM for Tuna (pass to constructor etc.) or set per node?
Hey!
I just started to check out this package, and I'm very excited about it. :)
I use Webpack to bundle my app, but importing Tuna causes the self-invoking function to receive a window
argument that is not the browser's window
. This leads to window.[webkit]AudioContext
being undefined, and the module will exit with an error if no context
argument is passed.
import Tuna from 'tunajs'
const tuna = new Tuna()
// Will throw "Tuna cannot initialize because this
// environment does not support web audio", although
// it's executed in the browser
It would be really cool if tuna supported UMD (Universal Module Definition). In this case it will be possible to run in within different environments and module systems.
I'd like to keep the version number in the tuna.js file, but don't want to update it manually each time. Should be done in sync with the npm updates.
Hello,
I'm using Tuna in one project and I got some deprecations, let me know if I can help to fix it:
[Deprecation] Styling master document from stylesheets defined in HTML Imports is deprecated, and is planned to be removed in M65, around March 2018. Please refer to https://goo.gl/EGXzpw for possible migration paths.
[Deprecation] DelayNode.delayTime.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.
[Deprecation] AudioParam value setter will become equivalent to AudioParam.setValueAtTime() in M65, around March 2018 See https://webaudio.github.io/web-audio-api/#dom-audioparam-value for more details.
[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.
[Deprecation] BiquadFilterNode.frequency.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.
[Deprecation] BiquadFilterNode.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.
[Deprecation] BiquadFilterNode.Q.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.
I could be totally wrong about this, but just noticed it when i was trying to build an angularJs app using Tremolo.
https://github.com/Theodeus/tuna/blob/master/tuna.js#L1643
This line should be returning this._stereoPhase not this._rate.
Can anybody guide which effect can be used create concert hall effect, or where output comes from microphone with some mixing effect
the wiki for nodes does not show defaults (or it's showing old defaults that have now changed)
e.g. Chrorus feedback in wiki shows 0.2 but the default in the code is 0.4.
Reading the documentation should be really helpful to see the defaults.
If the wiki should indeed show defaults I'm happy to update them.
Hi,
i really like you library but recently my app moved to using Browserify and it would be great to have package there.
Hello there again.
I wonder if I can use Tuna with plain HTML, without Node/js or any framework.
Thanks in advance for any help.
Bye, Ivano.
Hello there again.
After my request to list available effects was responsed, I'm still missing the following effects:
bass boost
waveshaper
chorus
equalizer
noise gate
flanger
sidechaining
limiter
vocoder
Please, add them.
Thanks in advance for either.
Bye, Ivano.
When increasing the normfreq, the bitcrusher processing increases many times over. Maybe worklets will help with some of it, but should be investigated.
I've been struggling to get tuna working with an OfflineAudioContext
. It works great for playback with an AudioContext
but the effects are not applied when rendering audio offline. Gain()
seems to be the only module that works correctly when offline.
Can anyone confirm if tuna is working for them offline? It's possible I'm doing something silly, though I've pored over the WebAudio docs numerous times now and am fairly certain I'm doing things correctly.
I'm chaining my audio nodes in this fashion, via connect()
:
[source node] -> [Gain] -> [One or more tuna effects, such as Delay] -> [ctx.destination]
This works fine for normal playback however when I use an offline ctx and ctx.startRendering()
I get back the original source audio, though as I said, Gain
appears to be working fine. It's weird, almost like the effects are just passing the buffer straight through transparently.
I'd like to use this on a project. Need confirmation on what the official license is, if there is any.
When building effect chains, it would be handy to be able to use Tuna all the way. I suggest adding a Panner
(based on StereoPannerNode
) and a simple Gain
(GainNode
).
This would:
effect.param.value = val
and effect.param = val
); andWhat do you think? I'd be happy to submit a PR!
On line 1438, this._excursionOctaves
is undefined
, so the result of the calculation is NaN
, giving the error Uncaught TypeError: Failed to set the 'value' property on 'AudioParam': The provided float value is non-finite.
I'm guessing this is a new error that was introduced, and the library was depending on the NaN
being ignored, and the useful value being calculated in the setter from the next line
I am trying to get Convolver effect and I am successful to get some variations in the output.
But i am looking for better output.
Can any body please help me with a good concert hall effect impulse file and corresponding values to get good effect
var convolver = new tuna.Convolver({ highCut: 22050, //20 to 22050 lowCut: 20, //20 to 22050 dryLevel: 1, //0 to 1+ wetLevel: 1, //0 to 1+ level: 1, //0 to 1+, adjusts total output of both wet and dry impulse: "impulses/impulse_rev.wav", //the path to your impulse response bypass: 0 });
I plan on having sliders and fancy buttons to set the node config.
Can I update the playing nodes with the changes without stopping the audio?
I checked this example: http://codepen.io/Theodeus/pen/WbmXgV?editors=0010
but I don't understand how I can adjust a normal mp3/ogg audio element.
Is this possible?
This'd enable us to push to v1.0.0 with confidence.
I suggest line 518:
this.release = properties.release || this.defaults.release.value;
to be changed to:
this.release = initValue(properties.release, this.defaults.release.value);
otherwise the 0 value isn't managed properly.
Moreover. I think the line 647:
this.compNode.release = value / 1000;
should be
this.compNode.release.value = value / 1000;
I found some examples created by @Theodeus , may be useful for beginners like me.
http://codepen.io/Theodeus/pen/WbmXgV?editors=0010
Play some music with keyboard keys ( z,s,d,c . . etc)
http://codepen.io/Theodeus/pen/EjLPrY
I have written a pitch shift piece of code.
It changes the pitch of the sample without affecting the playback rate.
Is this of interest? I can contribute it if so.
First, thanks so much for building such an awesome library!
I'm having an issue where Phaser and Tremolo are both only audible on the Left channel. Bitcrusher does not share the issue.
The value I set for stereoPhase
does not seem to have any effect.
To check what was going on, I set up an interval to log out the values for L/R channels, but nothing appears to be amiss:
window.setInterval(() =>
console.log(tremoloNode.amplitudeL.gain.value, tremoloNode.amplitudeR.gain.value),
500
);
/*
0.10021287947893143 0.11322055757045746
0.4889722168445587 0.3630233705043793
1.0914888381958008 0.9738174676895142
1.2686258554458618 1.2976855039596558
0.7367117404937744 0.8762662410736084
*/
Beyond that, I'm pretty stumped. My setup is fairly straightforward; After creating the node I connect it to an output (either another effect node, or context.destination).
When I use Bitcrusher or native Web Audio nodes, stereo works properly. When I set bypass
to 1, as well, the stereo works.
If seeing the source would help, the tremolo node is created here, and updated here.
EDIT:
It appears that the issue is just with Web Audio oscillators. I updated the example pen to use a Tremolo and a simple sine oscillator, and the left-channel-only bug exists:
http://codepen.io/anon/pen/JRYawk?editors=0010
Can we export output ?
All instances of userContext.createGainNode()
need to be replaced with userContext.createGain()
— otherwise this doesn't work at all in Firefox. userContext.createDelayNode()
and userContext.createJavaScriptNode()
need to be updated as well.
First instance on line 185.
I noticed Tuna defines a named module ("Tuna") when AMD is detected. This is discouraged in the requirejs docs:
These are normally generated by the optimization tool. You can explicitly name modules yourself, but it makes the modules less portable -- if you move the file to another directory you will need to change the name. It is normally best to avoid coding in a name for the module and just let the optimization tool burn in the module names. The optimization tool needs to add the names so that more than one module can be bundled in a file, to allow for faster loading in the browser.
Also, projects like jspm won't work with named modules.
Is there a reason to define the module as a named one? Wouldn't be more portable and AMd-esque using an anonyomous module instead?
Hi, i having this error when active cabinet effect.
Uncaught TypeError: Failed to set the 'value' property on 'AudioParam': The provided float value is non-finite.
```
set: function(value) {
this.makeupNode.gain.value = value;
}
line causes this error. anyone know this why happening?
This isn't a huge problem but since enums on .FilterNode.type has changed and no longer supports just a number like before. We have to use the full name of the type of filter we want to use.
Like this: filterType: 'lowshelf', etc.
I looked thru the code and was thinking about adding a fix but I realised the fix would probably slow down tuna since it was based on a switch case. Anyway maybe a change in the readme.md is enough for new users.
Ha det så bra!
The live example in README file is broken since it cannot load the audio file. Please fix it.
Getting huge commit diff's due to auto-formatting that differ between different peep (and probably between editors, on my own machine). Need to enforce formatting to avoid this.
Hi
Just trying the tuna.js features but cant seem to get the simple usage setup.
Im running this:
var context = new AudioContext();
var tuna = new Tuna(context);
var chorus = new tuna.Chorus({
rate: 1.5,
feedback: 0.2,
delay: 0.0045,
bypass: 0
});
and getting this error:
Uncaught TypeError: Failed to execute 'connect' on 'AudioNode': 1 argument required, but only 0 present.
something Im missing?
When increasing both depth and baseModulationFrequency the Phaser can start acting up.
BiquadFilter.frequency.value 130024 outside nominal range [0, 24000]; value will be clamped.
tuna.js?122:1510 Uncaught TypeError: Failed to set the 'value' property on 'AudioParam': The provided float value is non-finite.
at value (tuna.js?122:1510)
at ScriptProcessorNode.<anonymous> (tuna.js?122:2242)
I have developed an app using MIDI.js, Tuna effects are supported in MIDI.js. I have requirement of changing frequency (Slightly) of note from its standard frequency while playing. Which Tuna effect will help to achieve this?
If not Tuna, is there any other way?
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.