Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we pass an argument like transpose? #6

Open
yuikns opened this issue Mar 29, 2022 · 1 comment
Open

Can we pass an argument like transpose? #6

yuikns opened this issue Mar 29, 2022 · 1 comment

Comments

@yuikns
Copy link

yuikns commented Mar 29, 2022

The origin API was

  static std::vector<std::vector<float>> melspectrogram(
      std::vector<float> &x, int sr, int n_fft, int n_hop,
      const std::string &win, bool center, const std::string &mode, float power,
      int n_mels, int fmin, int fmax) {
    Matrixf mel = internal::melspectrogram(); // do some stuff here
    std::vector<std::vector<float>> mel_vector();
    // 'cast' to vector of vector
    return mel_vector;
}

However, it is not easy to transpose a vector of vector in C++.

Is it possible to add a special args like transpose:

  static std::vector<std::vector<float>> melspectrogram(
      std::vector<float> &x, int sr, int n_fft, int n_hop,
      const std::string &win, bool center, const std::string &mode, float power,
      int n_mels, int fmin, int fmax, bool transpose = false) {
    Matrixf mel = internal::melspectrogram(); // do some stuff here
    if (transpose) {
      mel.transposeInPlace();
    }
    std::vector<std::vector<float>> mel_vector();
    // 'cast' to vector of vector
    return mel_vector; // return origin_mel_vector.T
}

It may make the result easier for me.

Have a nice day!

@ewan-xu
Copy link
Owner

ewan-xu commented Apr 2, 2022

good idea, I will add this feature when I have time recently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants