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

rework python api #28

Open
skewballfox opened this issue Jul 1, 2023 · 0 comments
Open

rework python api #28

skewballfox opened this issue Jul 1, 2023 · 0 comments
Labels
ergonomics python anything related to the python api or where python code is needed question Further information is requested

Comments

@skewballfox
Copy link
Collaborator

When we initially created the code, we wanted the match the API of speechpy exactly, so that it would be a drop in replacement for it. With the shift to emulating librosa, this isn't possible, at least not without handling some of the logic python side, as certain patterns like specifying an optional preexisting output in the arguments would be painful to try to emulate in rust. There is also the issue that we're making use of interior mutablity patterns as certain functions require state, but it's only possible to have mutable references to longer lived objects(rust structs as python objects). It's likely to break if they tried to call these functions in multiple threads but I'm not exactly sure of the semantics of calling clone on a struct containing refcell.

so given that it we have 2 options:

  1. stick to the function based api, where you call a function that is caching a rust struct under the hood.
  2. switch to a syntax where you create a python object where mfcc/mel_spec are called as methods with one arg: the signal

the latter has a few advantages in terms of design rust side, whereas the former is closer to what is common for the existing python libraries providing this functionality

@skewballfox skewballfox added python anything related to the python api or where python code is needed question Further information is requested ergonomics labels Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ergonomics python anything related to the python api or where python code is needed question Further information is requested
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant