nativeformat / NFPlayerJS

A JavaScript/TypeScript audio engine for the Web and Server capable of multitrack time stretching, pitch shifting, declarative effects, faster than realtime processing, and more!
https://nativeformat.github.io/NFPlayerJS
Apache License 2.0
129 stars 9 forks source link

If GainNode "gain" is 1, pass buffers through without modification #3

Open kirbysayshi opened 5 years ago

kirbysayshi commented 5 years ago

A GainNode could be optimized where if the gain value is exactly 1 it just passes audio through to save CPU, rather than iterating over the entire buffer needlessly.

Probably best to check if the starting, middle, and ending gain values are 1. Otherwise a rapid change could be missed.