rserota / wad

Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.
MIT License
1.88k stars 160 forks source link

connect output of wads (post processing) #149

Closed Kris-rmw closed 1 year ago

Kris-rmw commented 1 year ago

I am building an instructional app which compares students singing/playing with the instructor's pre-recorded take. Wad has been extremely useful.

However now I have realised I need more control of pitch analysis, and would therefore like to connect my existing wads ( I have a bunch of them ) with a separate pitch analysis functionality - after effects processing, so that I can re-use my work so far.

Is there a way to accomplish this, ie with Wad.audioContext / createMediaElementSource, or similar?

rserota commented 1 year ago

Sure, you can have multiple tuners, analyzing the pitch at multiple points in the effects pipeline. It all depends on how your group wads/polywads together, and where you put the pitch analyzers.

Kris-rmw commented 1 year ago

So how would I access a wad's analyser node? I need to send it, as well as the sample rate, to a custom updatePitch() function like this:

updatePitch(analyserNode, Wad.audioContext.sampleRate)
rserota commented 1 year ago

I'm not sure if I understand your use case? Every polywad has a list of the wads it contains in an array called nodes. The last node in this list is an analyzer, which is used for pitch detection.

Kris-rmw commented 1 year ago

Thanks - it makes more sense to me now, I ended up using a workaround but will test this next time (being a rookie programmer I am still struggling to get my head around js classes etc).