diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 58fc176..ebb7d43 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -17,9 +17,9 @@ jobs: - name: cache uses: Swatinem/rust-cache@v2 - name: Cargo build - run: cargo build --locked + run: cargo build --locked --no-default-features # I don't want to download an ortruntime so - name: Cargo test - run: cargo test --locked + run: cargo test --locked --no-default-features - name: Rustfmt run: cargo fmt --check - name: Clippy diff --git a/Cargo.toml b/Cargo.toml index 1d05fc4..614ff5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" edition = "2021" [features] +default = ["ort/load-dynamic"] [dependencies] anyhow = "1.0.65" @@ -22,7 +23,7 @@ ndarray = "0.15.6" ndarray-npy = "0.8.1" # Just for convenient moving to/from python for checking num2words = "1.0.1" once_cell = "1.15.0" -ort = { version = "2.0.0-rc.0", features = ["load-dynamic"] } +ort = { version = "2.0.0-rc.0" } regex = "1.6.0" serde = { version = "1.0.192", features = ["derive"] } serde_json = "1.0.108" diff --git a/src/bin/app.rs b/src/bin/app.rs index 6bf07c0..14a2ce6 100644 --- a/src/bin/app.rs +++ b/src/bin/app.rs @@ -1,14 +1,7 @@ use clap::Parser; -use griffin_lim::GriffinLim; -use hound::{SampleFormat, WavSpec, WavWriter}; -use std::fs::File; -use std::io::BufWriter; -use std::path::{Path, PathBuf}; -use std::time::{Duration, Instant}; -use tracing::{debug, error, info}; -use xd_tts::phonemes::Unit; -use xd_tts::tacotron2::*; -use xd_tts::text_normaliser::{self, NormaliserChunk}; +use hound::WavWriter; +use std::path::PathBuf; +use tracing::info; use xd_tts::*; #[derive(Parser, Debug)] @@ -30,17 +23,6 @@ pub struct Args { tacotron2: PathBuf, } -fn create_wav_writer(output: &Path) -> anyhow::Result>> { - let spec = WavSpec { - channels: 1, - sample_rate: 22050, - bits_per_sample: 16, - sample_format: SampleFormat::Int, - }; - - let w = WavWriter::create(output, spec)?; - Ok(w) -} fn main() -> anyhow::Result<()> { xd_tts::setup_logging(); @@ -49,7 +31,7 @@ fn main() -> anyhow::Result<()> { info!("Loading resources"); let tts_context = XdTts::new(&args.tacotron2, args.phoneme_input)?; - let mut wav_writer = create_wav_writer(&args.output)?; + let mut wav_writer = WavWriter::create(&args.output, xd_tts::WAV_SPEC)?; tts_context.generate_audio(&args.input, &mut wav_writer, args.output_spectrogram)?; Ok(()) diff --git a/src/lib.rs b/src/lib.rs index a3b49b3..2488f6d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,7 @@ pub mod training; pub use cmu_dict::CmuDictionary; -pub const wav_spec: WavSpec = WavSpec { +pub const WAV_SPEC: WavSpec = WavSpec { channels: 1, sample_rate: 22050, bits_per_sample: 16,