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

Rust Rewrite #13

Open
jonaylor89 opened this issue Feb 28, 2022 · 0 comments
Open

Rust Rewrite #13

jonaylor89 opened this issue Feb 28, 2022 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jonaylor89
Copy link
Owner

Rewrite everything except the pydub components in rust. There are three reasons for this

  • Safety
  • Speed
  • Personal Preference

To handle the pydub portion, the project will use pyo3. The proof of concept to make sure this worked is here

use pyo3::prelude::*;
use pyo3::types::IntoPyDict;

fn main() -> PyResult<()> {
    Python::with_gil(|py| {
        let sys = py.import("sys")?;

        let locals = [("os", py.import("os")?), ("pydub", py.import("pydub")?)].into_py_dict(py);
        let code = "pydub.AudioSegment.from_mp3('/home/johannes/Repos/cyberpunk/testdata/celtic_pt2.mp3')";
        let segment: PyObject = py.eval(code, None, Some(&locals))?.extract()?;

        println!("let's see - {}", segment);

        segment.call_method1(py, "export", ("two.wav", "wav")).unwrap();
        Ok(())
    })
}
@jonaylor89 jonaylor89 added enhancement New feature or request help wanted Extra attention is needed labels Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: No status
Development

No branches or pull requests

1 participant