- Fixes peaks not fading out in radial graph mode when
fadePeaksenabled; - Updated dev npm packages to address vulnerability reports;
- Updated the suggested CDN in the Usage section to jsDelivr, which can provide minified versions of both the ESM and UMD modules.
NOTE: If you're using this package from a CDN, make sure to pin the version to v4 (by adding
@4after the package name) to prevent breaking changes when stable v5 is released!
- Fixes peaks not being displayed in radial graph mode with
radialInvertenabled.
- Fixes visual glitches in radial mode, when
radialInvertandshowPeaksare enabled.
- Fixes audio context not being properly started in some cases, e.g., when a
clickevent is programmatically triggered before an actual user click; - Fixes optional
bgColorproperty in theGradientOptionstype definition - thanks jgabriel98 for reporting it (#82); - Adds a demo file for the UMD module.
fadePeaks- peaks fade out instead of falling down - thanks @TF3RDL for this idea;gravity- customize peak drop acceleration;peakFadeTime- customize peak fade-out time;peakHoldTime- customize peak hold time;- UMD module export - allows using the module via require() and provides a global variable for easier usage in the browser - thanks @shahkashani for the suggestion (#71 and #72); see the Usage section for more details.
The new gravity equation restores the original peak drop behavior and decay curve (using the default value) of versions 1.0.0 through 3.4.0.
Check out the peak drop analysis tool for more information on the evolution of the equation and to compare different values of gravity.
As usual, you can interact with all the new properties in the fluid demo.
canvasproperty in the constructor options to use your own canvas - thanks @orangecoding for the suggestion;getOptions()- retrieve all analyzer settings as an options object. Also added a getOptions() button to fluid and multi demos to copy the current settings to the clipboard - thanks @biigpongsatorn for the suggestion;radialInvert- render radial spectrum bars towards the center of the screen;radius- customize the size of the radial spectrum - thanks @orangecoding for the suggestion.
- The constructor can now take the options object as the first argument if you don't need to define the container;
starthas been explicitly marked as a constructor-specific property in the Options object description and will no longer work withsetOptions()as of the next major release.
- Bug preventing radial mode from working when set in the constructor options - thanks @lexterror and @ianrothmann for reporting it;
- Reverted an unintended property name change in the object passed to the onCanvasDraw callback, introduced in v4.2.0.
- 'dual-horizontal' option for
channelLayout;
- Fixed opacity for reflex effect on dual-combined channel layout.
- Improved
maxFPSframe rate throttling.
- new
stopTracksargument todisconnectInput()- thanks @hookedupjoe (#52); destroy()- thanks @lucienimmink for the suggestion;maxFPS- set the maximum desired animation frame rate;peakLine- show peaks as a continuous line for Graphmode;start()andstop()methods.
- Corrected ESM exports in
package.json- thanks @cprussin (#54).
- Peak hold and decay times and radial spin speed should now remain consistent on any frame rate;
showPeaksnow works for Graph mode in radial view;- Code quality and documentation improvements - also thanks @Staijn1 for #55.
- Fix a rendering bug when
roundBarsis combined withmirrorandradial; - Add a polyfill for
Array.findLastIndex()to restore compatibility with not-so-recent browsers.
colorMode- additional options for coloring analyzer bars: by bar amplitude (level) or bar position (index);roundBars- rounded corner analyzer bars;isRoundBarsread-only property;trueLeds- your LED bars now more vintage than ever!- New
levelproperty for registered gradients
- Avoid drawing the Y-axis scale and unlit LEDs twice, in 'dual-combined' channel layout.
- Improved frequency scales labeling (especially for
noteLabels) - label sizes were slightly reduced in fullscreen; - Code cleanup and optimizations.
-
Removed deprecated properties:
- useenergygetEnergy()instead- useisLedDisplayisLedBarsinstead- usepeakEnergygetEnergy('peak')instead- useshowLedsledBarsinstead
-
getBars()now includes an additionalfreqproperty for each element, representing the center frequency of the band. In addition, the range of each band has been adjusted so that frequencies that were previously at the lower edge (freqLo) are now located at the center of the band. -
stereohas been DEPRECATED and will be removed in version 5 - usechannelLayoutinstead.
ansiBands- use ANSI/IEC preferred frequencies for the octave bands;channelLayout- adds option for dual channel combined spectrum, with both channel graphs overlaid;frequencyScale- adds linear and perceptual (Bark/Mel) frequency scales;gradientLeftandgradientRight- allow to select different gradients for each channel;isBandsModeread-only property;linearAmplitude- use linear values instead of dB for spectrum amplitudes;linearBoost- amplify low energy values when using linear amplitude;noteLabels- display musical note labels instead of frequency values on the X-axis;weightingFilter- select from five different weighting filters for improved spectrum visualization;- Two new built-in gradients: orangered and steelblue.
Thank you @jonathan-annett (#28) and @TF3RDL (#30 and #38) for the suggestions that led to the implementation of several of these new features.
- LED peaks showing below zero level when
reflexRatio> 0.
- Optimized generation of octave bands, with more accurate ranges and center frequencies;
- Frequency labels on the X-axis now show different values depending on the value of
ansiBands, to properly match the bands' center frequencies; - The
onCanvasDrawcallback is now passed an additional object with timestamp and gradients information; - The prism and rainbow gradients were recreated using the beautiful 12-bit rainbow palette by Kate Morley - If you need the old colors check this post;
- Custom gradients can now register a single color;
splitGradientnow works for horizontal gradients inradialvisualization;maxFreqis now capped to half the AudioContext's sample rate (Nyquist frequency);- Export additional types and interfaces in the TypeScript definition file;
- Code optimizations, minor fixes and clean-up;
- Revised and improved demos and documentation.
- Minor update to fix wrong property names in the
LedParametersinterface in the TS definition file; - Improved documentation of
registerGradient()usage in TypeScript projects (#37).
alphaBarseffect, which is similar tolumiBarsbut preserves bars' amplitudes and also works on discrete frequencies mode and radial visualization;outlineBarseffect, which extends the usage oflineWidthandfillAlphato octave bands modes;isAlphaBarsandisOutlineBarsread-only properties.
showLedsandisLedDisplayhave been deprecated in favor ofledBarsandisLedBars, for consistent naming of effects.
getEnergy()would not accept a fractionary initial frequency.
- Regenerate the current gradient if/when it is re-registered (#21);
- The fluid demo now shows the status of read-only flags, for better visualization of interactions between different properties.
- Removed named tuples from the TS type definitions file, for improved compatibility (#20).
getBars()method, which provides real-time analyzer data;useCanvasproperty to disable rendering to the canvas - thanks @davay42 for suggesting this feature;- A tool to view/debug the generated octave bands - see the
/toolsfolder.
- Fine-tuned generation of octave bands;
- Improved FFT data interpolation;
- Improved peak rendering when changing visualization modes;
- Added a simple piano keyboard to the test tones section of the "fluid" demo;
- Added search funcionality to the documentation website.
fsElementconstructor option, for easily handling fullscreen on any element.
- Fixed radial analyzer too wide in vertical containers;
- Fixed out of bounds bar in mode 0 (discrete frequencies) with
mirrorset to -1; - Improved fullscreen rendering in portrait orientation displays;
- Improved font size adjustment for scale labels and FPS display on vertical containers.
- New horizontal mirroring effect; see
mirrorproperty - thanks @lexterror for suggesting this feature.
- Fixes an undefined property error.
getEnergy()method - see it in action on this pen - thanks @Staijn1 for suggesting this feature;setLedParams()method, which allows you to customize the look of the LEDs - you can try it in the fluid demo;connectSpeakersconstructor option - thanks @evoyy for the suggestion;connectedToread only property.
- When passing an AudioNode in the
sourceproperty of constructor, it's no longer necessary to explicitly provide theaudioCtx, as it will be inferred from the source node - thanks @evoyy for this idea; - Disconnecting the output from the speakers no longer prevents the analyzer from working on Chromium-based browsers;
- Expose the
GradientOptionsTypeScript interface for user scripts (props to @Staijn1); - Improved the look of the LEDs effect in very small containers (like in the multi-instance demo), especially when
loResis active; - Refactored some code for improved legibility, performance and file size (still below 20kB minified! 😎);
- Added compatibility with standardized-audio-context library - thanks @richclingman for reporting this issue.
energyandpeakEnergyproperties have been deprecated and will be removed in the next major release - usegetEnergy()andgetEnergy('peak')instead;- FPS display font size is now scaled relatively to the canvas height;
pixelRatiois now correctly reported for HiDPI devices with screen height <= 1080px.
- TypeScript definition file (props to @alex-greff).
- Generate only the currently selected gradient on mode/gradient changes.
- The
analyzerobject is no longer exposed - use the newconnectInput()method to connect all audio sources andconnectOutput()to connect the analyzer output to other nodes; audioSourceproperty has been renamed toconnectedSources, which now returns an array of all connected audio sources;binToFreq()andfreqToBin()methods have been removed;connectAudio()method has been replaced byconnectInput(), which now accepts either an HTML media element or any instance of AudioNode;dataArrayproperty is no longer exposed;showScaleproperty has been renamed toshowScaleX;versionis now a static property and should always be accessed asAudioMotionAnalyzer.version.
- Dual channel (stereo) analyzer option;
- Built-in volume control;
- New methods for easy connection/disconnection of input and output nodes:
- New properties:
isOctaveBands(read only)isLedDisplay(read only)isLumiBars(read only)stereosplitGradientvolume
- Automatically unlock/resume the AudioContext on first user click, so you don't need to handle this in your code anymore;
- Improved FFT data interpolation on low frequencies (especially noticeable in 1/12th and 1/24th octave bands);
- Corrected initial amplitude of line / area graph.
- A compatibility issue that could cause
reflexRationot to work in some environments.
- Behavior of the
onCanvasResizecallback is now consistent across different browsers. Changes worth of note:- on fullscreen changes, only a
'fschange'reason will be reported to the callback function - no more redundant'resize'calls; - the callback function is now executed only when canvas dimensions effectively change from the previous state - for example,
setting
loResorwidthto the same value they already have won't trigger a callback;
- on fullscreen changes, only a
- Canvas dimensions are now properly updated whenever the container element is resized, not only on window resize;
audioSourcenow returns the first audio source connected viaconnectAudio()method, if no source was provided during instantiation;- Size of scale labels on both axes is now scaled relatively to the canvas height;
- Added a new demo with only the minimal code required to use audioMotion-analyzer;
- Demo scripts are now loaded as native ES6 modules and no longer require bundling. See the README file for instructions on running the demos locally.
- New Radial visualization - see
radialandspinSpeedproperties and try them in the demos! - thanks @inglesuniversal for suggesting this feature; showScaleYproperty for displaying the level (dB) scale on the analyzer's vertical axis;energyandpeakEnergyread-only properties;- Known issues section added to the documentation.
setOptions()called with no argument now resets all configuration options to their default values (it used to raise an error);- The LED effect code has been refactored to improve appearance and compatibility with other (future) effects;
- "Unlit" LEDs are no longer displayed in overlay mode - see the notice in
showBgColordocumentation; - Canvas
fillStyleandstrokeStyleproperties are now set with the current gradient before calling theonCanvasDrawcallback function; - Updated all demos with more straightforward access to configuration options.
binToFreq()andfreqToBin()methods;reflexBrightproperty, which allows to adjust the brightness of the reflected image.
- Reverted the change to
reflexAlphaintroduced in v2.2.1 - Removed the forced black layer off the reflection background.
-
Improved the Reflex effect in(reverted in v2.3.0);overlaymode - thereflexAlphaproperty is now used to adjust the opacity of a dark layer applied over the reflection area, which prevents undesired transparency of the reflection itself and creates a consistent effect, whether overlay mode is on or off -
The package source code has been moved from the
distto thesrcfolder.
- Prevent showing leds below the 0 level, when both reflex and overlay are active.
- New
overlayandbgAlphaproperties allow displaying the analyzer over other contents. Check out the new demo!
- Corrected the documentation for the
registerGradient()method, which stated thebgColorproperty was required (it has always been optional).
- Customizable Reflex effect - see
reflexRatioand try it in the demo.
- New
lineWidthandfillAlphaproperties for mode 10 customization, so it can now work as an area graph (default), a line graph or a combination of both; - New
barSpaceproperty for customizable bar spacing in octave bands modes; - You can now provide an external AudioContext via
audioCtxproperty in the constructor'soptions, allowing you to share the same context among different instances; - Custom error codes;
- New
versionproperty;
- Increased default spacing between bars in octave bands modes - to get the previous look, set
barSpaceto 1; - Improved accuracy when positioning the X-axis scale labels in octave bands modes;
- Slightly improved vertical usage of canvas when the LED effect is active (removed the black line at the bottom of the screen);
- Canvas context is now saved before calling the user callback function and restored afterwards, to avoid undesirable changes;
- Several functions were refactored for improved legibility, memory usage and performance;
- Improved documentation and demos;
- The multi-instance demo should now work on browsers other than Firefox (it now uses a shared audio context);
isFullscreenproperty now correctly readsfalse(instead ofundefined) when the analyzer is not in fullscreen (potentially breaking change);- Setting one of the callback functions to
undefinedwithsetOptions()now properly unregisters the callback (potentially breaking change);
audioCtx,analyzer,canvasandcanvasCtxobjects are now read-only (canvasCtxproperties may be safely modified while inside the callback foronCanvasDraw);frameandtimeproperties are not exposed anymore, as they are intended for internal use only;registerGradient()method now enforces thenameargument being a non-emptystring(throws an error otherwise);- Errors now return a custom object and some error messages have changed - use the new
codeproperty to identify errors in a reliable way.
- Improves the look of bars at lower frequencies in octave bands modes (especially 1/12th and 1/24th);
- Minor tweak to the "Rainbow" gradient to make cyan and blue shades a little more balanced.
- New Area fill visualization mode (
mode: 10), which uses the same full-frequency data of the discrete frequencies mode, but generates a brighter filled shape; - New Luminance Bars option (
lumiBars: <boolean>) for octave bands modes, which displays analyzer bars always at full-height, with varying luminance instead.
- Minor cleanup to optimize npm package size.
- First stable release.