async _get_input_mel(waveform, max_length, truncation, padding) {

        /** @type {Tensor} */
        let input_mel;
        let longer = false;
        const diff = waveform.length - max_length;
        if (diff > 0) {
            if (truncation === 'rand_trunc') {
                longer = true;
                const idx = Math.floor(Math.random() * (diff + 1));
                waveform = waveform.subarray(idx, idx + max_length);

                input_mel = await this._extract_fbank_features(waveform, this.mel_filters_slaney, this.config.nb_max_samples);
            } else {
                // TODO implement fusion strategy
                throw new Error(`Truncation strategy "${truncation}" not implemented`)
            }
        } else {
            if (diff < 0) {
                let padded = new Float64Array(max_length); // already padded with zeros
                padded.set(waveform);

                if (padding === 'repeat') {
                    for (let i = waveform.length; i < max_length; i += waveform.length) {
                        padded.set(waveform.subarray(0, Math.min(waveform.length, max_length - i)), i);
                    }
                } else if (padding === 'repeatpad') {
                    for (let i = waveform.length; i < -diff; i += waveform.length) {
                        padded.set(waveform, i);
                    }
                }
                waveform = padded;
            }

            if (truncation === 'fusion') {
                throw new Error(`Truncation strategy "${truncation}" not implemented`)
            }

            input_mel = await this._extract_fbank_features(waveform, this.mel_filters_slaney, this.config.nb_max_samples);
        }

        return input_mel.unsqueeze_(0);
    }
Extracts the mel spectrogram and prepares it for the mode based on the `truncation` and `padding` arguments.

Four different path are possible:
  - `truncation="fusion"` and the length of the waveform is greater than the max length: the mel spectrogram
    will be computed on the entire audio. 3 random crops and a dowsampled version of the full mel spectrogram
    are then stacked together. They will later be used for `feature_fusion`.
  - `truncation="rand_trunc"` and the length of the waveform is smaller than the max length: the audio is
    padded based on `padding`.
  - `truncation="fusion"` and the length of the waveform is smaller than the max length: the audio is padded
    based on `padding`, and is repeated `4` times.
  - `truncation="rand_trunc"` and the length of the waveform is greater than the max length: the mel
    spectrogram will be computed on a random crop of the waveform.

@param {Float32Array|Float64Array} waveform The input waveform.
@param {number} max_length The maximum length of the waveform.
@param {string} truncation The truncation strategy to use.
@param {string} padding The padding strategy to use.
@returns {Promise<Tensor>} An object containing the mel spectrogram data as a Float32Array, its dimensions as an array of numbers, and a boolean indicating whether the waveform was longer than the max length.
@private