Skip to content

Commit

Permalink
Revise wording
Browse files Browse the repository at this point in the history
  • Loading branch information
TenghuiZhang committed Jul 5, 2023
1 parent 29146a1 commit 46eed1b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
9 changes: 4 additions & 5 deletions src/library/FIFO.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/**
* A First-In-First-Out (FIFO) class that only design for vu-meter to
* maintains a queue of elements. In class does not has pull,
* getBufferLength function. It includes the getMinValue function for
* tracking the minimum value in the FIFO class.
* @class
* @classdesc A FIFO (First-In-First-Out) class that is specifically
* designed for the VUMeter class in the library directory. This class
* does not have a method to get or drop a head value, but it includes
* one for getting a minimum value form the queue.
*/
class FIFO {

Expand Down
11 changes: 5 additions & 6 deletions src/library/VUMeter.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import FIFO from './FIFO.js';

/**
* This VUMeter class implements a volume level meter UI. To
* initialize it, developers need to provide the ID of the canvas
* @classdesc This VUMeter class implements a volume level meter UI.
* To initialize it, developers need to provide the ID of the canvas
* element where the VUMeter will be rendered, the minimum decibel
* value for the VUMeter, an AnalyserNode, fftSize of the
* analyserNode, and fifoSize to control the VMMeter update speed. The
* minimum decibel value defines the range of the VUMeter that will be
* considered silent. When the VUMeter is created, it requires an
* AnalyserNode for real-time audio input data. This class requires a
* canvas element and FIFO class. The FIFO class is used to determine
* how fast the VUMeter gets updated. The height of vu-meter bar is
* how fast the VUMeter gets updated. The height of the VUMeter is
* determined by the minimum number in the FIFO class.
* @class
*/
class VUMeter {

Expand Down Expand Up @@ -49,8 +48,8 @@ class VUMeter {
/** @private @const {!fifo} An instance of FIFO class for caching
* RMS values and extracting a minimum value over time. */
this.fifo_ = new FIFO(fifoSize);
/** @private @const {!analyser} AnalyserNode that will be used
* for visualization */
/** @private @const {!analyser} AnalyserNode that will be used for
* visualization */
this.analyser_ = analyserNode;
this.analyser_.fftSize = fftSize;
/** @private @const {!dataArray} Array to store the frequency data
Expand Down
26 changes: 12 additions & 14 deletions src/library/Waveform.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/**
* This Waveform class implements a waveform UI. To initialize it, you
* need to provide the ID of the canvas element where the waveform
* will be rendered and the fftSize value for the analyserNode. The
* fftSize value defines the window size in samples used when
* performing a Fast Fourier Transform (FFT) to obtain frequency
* domain data in the AnalyserNode. When the waveform is created, it
* requires an AnalyserNode for real-time audio input data. This class
* only requires a canvas element, and there are no additional
* dependencies.
* @class
* @classdesc This Waveform class implements a waveform UI. To
* initialize it, you need to provide the ID of the canvas element
* where the waveform will be rendered and the fftSize value for the
* analyserNode. The fftSize value defines the window size in samples
* used when performing a Fast Fourier Transform (FFT) to obtain
* frequency domain data in the AnalyserNode. When the waveform is
* created, it requires an AnalyserNode for real-time audio input
* data. This class only requires a canvas element, and there are no
* additional dependencies.
*/
class Waveform {

Expand All @@ -26,8 +25,7 @@ class Waveform {
* AnalyserNode.
*/
constructor(canvasId, analyserNode, fftSize) {
/** @private @const {!canvas} Selected waveform canvas
* element */
/** @private @const {!canvas} Selected waveform canvas element */
this.canvas_ = document.querySelector(canvasId);
/** @private @const {!canvasContext} Canvas context */
this.canvasContext_ = this.canvas_.getContext('2d');
Expand All @@ -39,8 +37,8 @@ class Waveform {
this.currentX_ = 0;
/** @private {!previousY} Previous Y axis in the waveform */
this.previousY_ = this.height_ / 2;
/** @private @const {!analyser} AnalyserNode that will be used
* for visualization */
/** @private @const {!analyser} AnalyserNode that will be used for
* visualization */
this.analyser_ = analyserNode;
this.analyser_.fftSize = fftSize;
/** @private @const {!dataArray} The array that the time domain
Expand Down

0 comments on commit 46eed1b

Please sign in to comment.