ailiaAudioGetSpectrogram method

int ailiaAudioGetSpectrogram(
  1. Pointer<Void> dst,
  2. Pointer<Void> src,
  3. int sample_n,
  4. int fft_n,
  5. int hop_n,
  6. int win_n,
  7. int win_type,
  8. int max_frame_n,
  9. int center,
  10. double power,
  11. int norm_type
)

~japanese @brief 音響信号からスペクトログラムを生成します。 @param dst 出力データのポインタ、float 型、外側から freq_n, frame_n, 2(複素数: 実部, 虚部) 順のメモリレイアウト @param src 入力データのポインタ、float 型、要素数 sample_n @param sample_n 入力データのサンプル数 @param fft_n FFT点数 @param hop_n フレームのシフト数 @param win_n 窓関数の長さ @param win_type 窓関数の種類、AILIA_AUDIO_WIN_TYPE_* のいずれか @param max_frame_n 出力データの時間フレーム数の最大値 @param center 入力データの前後へのパディングの有無、AILIA_AUDIO_STFT_CENTER_* のいずれか @param power スペクトログラムの乗数(>= 0.0) 0.0: 複素スペクトログラム、1.0: 振幅スペクトログラム、2.0: パワースペクトログラム、その他: 任意の累乗値の出力に相当 @param norm_type FFT後の正規化処理、AILIA_AUDIO_FFT_NORMALIZE_* のいずれか @return 成功した場合は \ref AILIA_STATUS_SUCCESS 、そうでなければエラーコードを返す。 @details 時間フレームごとにFFT→正規化処理→累乗(振幅・パワーに変換)の順で処理を実行します。 出力データは実部と虚部の交互信号であり、長さは(fft_n/2+1)時間フレーム長2です。 powerが0.0以外の場合は虚部の値を全て0.0として出力します。

~english @brief Generate the spectrogram from the audio signal. @param dst pointer to the output data, of float format, of length (2 * freq_n * frame_n), and which memory layout is a sequence of pairs real part, imaginary part. (where freq_n = fft_n/2+1). Memory layout, using the row-major convention: (freq_n, frame_n, 2). @param src pointer to the input data, of float format, and of length sample_n @param sample_n count of samples in the input data @param fft_n size of the FFT at each frame (i.e. number of frequency bins at each frame) @param hop_n stride of each window shift (in number of samples). This is the size of the time increment for the spectrogram. @param win_n size of the window function @param win_type type of the window function: any of the AILIA_AUDIO_WIN_TYPE_* constants @param max_frame_n maximum value of the time frame index in the outputted data @param center whether to pad or not (and the type of padding) before and after the input data: any of the AILIA_AUDIO_STFT_CENTER_* constants @param power exponent to apply to the spectrogram (> = 0.0). A special case is for 0.0: complex spectrogram. For other cases the amplitude is just exponentiated accordingly: 1.0: amplitude spectrogram, 2.0: power spectrogram, etc, any other positive exponent value is allowed. @param norm_type normalization after the FFT: any of the AILIA_AUDIO_FFT_NORMALIZE_* constants @return In case of success, \ref AILIA_STATUS_SUCCESS , and else an error code is returned. @details For each time frame, the operations are processed in this order: FFT -> normalization -> power exponentiation. As the output data alternates real and imaginary parts, its length is 2*(fft_n/2+1)*frame_n. (where frame_n is the number of time frames outputted) When the power argument is a non-zero value, all the complex parts are set to 0 in the output.

Implementation

int ailiaAudioGetSpectrogram(
  ffi.Pointer<ffi.Void> dst,
  ffi.Pointer<ffi.Void> src,
  int sample_n,
  int fft_n,
  int hop_n,
  int win_n,
  int win_type,
  int max_frame_n,
  int center,
  double power,
  int norm_type,
) {
  return _ailiaAudioGetSpectrogram(
    dst,
    src,
    sample_n,
    fft_n,
    hop_n,
    win_n,
    win_type,
    max_frame_n,
    center,
    power,
    norm_type,
  );
}