Closed jescalan closed 9 years ago
It wasn't possible previously, but I just added that feature in. If you pull down fresh code, it should work how you want it to.
You can still set effects when the mic is initialized, but if you pass arguments to the play()
method, then the previous effects will be discarded, and the effects from the play()
arguments will be used instead. You should be able to change the effects as much as you want, but you will only need to give your browser access to your microphone once.
I've updated the readme to reflect this change. Let me know if this fix doesn't meet your needs.
Woah, this is amazing! Thanks so much @rserota -- this saved me hours of time. I owe you a :beer: no question. :sparkling_heart:
You're welcome! I'm glad this worked for you.
So I just tested this out with code like this:
voice.play({
reverb: {
wet: 0.4,
impulse: '/path/to/impulse.wav'
}
});
and sadly it had no effect on the output, just sounds like normal. Passing the same thing to the constructer made a clear difference though. Am I doing something wrong in the way I'm passing the arguments or something? I dug into the code and made sure the constructReverb
function was firing and it was...
I also tried it with a delay effect, and got undefined is not a function
throwing from this line :cry:
It was working when I tested it recently. Can you post more of your code? I'd like to see how you initialize all the objects, what order you call methods, etc.
It sounds like you stumbled on a bug, but I think I know what's going on here. I'll have some time to investigate this issue tonight.
Sure, I can reproduce it with the following code:
var voice = new Wad({ source: 'mic' });
// for reverb (plays, but no effect)
voice.play({
reverb: {
wet: 0.4,
impulse: '/path/to/impulse.wav'
}
});
// for delay (errors out, does not play)
voice.play({
delay: {
delayTime: .5,
wet: .25,
feedback: .25,
}
});
Both of those bugs should be fixed now. If you pull down the latest version of Wad.js, your code should work as you expect.
Let me know if you continue having trouble.
Working perfectly now, thank you! :sparkles: :sparkling_heart: :sparkles:
Just a quick question -- it doesn't appear as if there is a way to, but can you apply effects for mic recording when
play
is called, rather than when the mic is initialized? The use case for this is if you want to allow the user to choose a vocal effect without having to re-initialize/accept the mic usage thing each time.If there isn't, could you potentially push me in the right direction for implementation? I'd be happy to pull request it in, but don't have a vast amount of experience with the web audio API.