Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.dataset.audio.GriffinLim

class mindspore.dataset.audio.GriffinLim(n_fft=400, n_iter=32, win_length=None, hop_length=None, window_type=WindowType.HANN, power=2, momentum=0.99, length=None, rand_init=True)[source]

Approximate magnitude spectrogram inversion using the GriffinLim algorithm.

x(n)=m=w(mSn)yw(mS,n)m=w2(mSn)

where w represents the window function, y represents the reconstructed signal of each frame and x represents the whole signal.

Parameters
  • n_fft (int, optional) – Size of FFT (default=400).

  • n_iter (int, optional) – Number of iteration for phase recovery (default=32).

  • win_length (int, optional) – Window size for GriffinLim (default=None, will be set to n_fft).

  • hop_length (int, optional) – Length of hop between STFT windows (default=None, will be set to win_length // 2).

  • window_type (WindowType, optional) – Window type for GriffinLim, which can be WindowType.BARTLETT, WindowType.BLACKMAN, WindowType.HAMMING, WindowType.HANN or WindowType.KAISER (default=WindowType.HANN). Currently kaiser window is not supported on macOS.

  • power (float, optional) – Exponent for the magnitude spectrogram (default=2.0).

  • momentum (float, optional) – The momentum for fast Griffin-Lim (default=0.99).

  • length (int, optional) – Length of the expected output waveform (default=None, will be set to the value of last dimension of the stft matrix).

  • rand_init (bool, optional) – Flag for random phase initialization or all-zero phase initialization (default=True).

Examples

>>> import numpy as np
>>>
>>> waveform = np.random.random([201, 6])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.GriffinLim(n_fft=400)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])