Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Nanashi. <[email protected]>
  • Loading branch information
Hiroshiba and sevenc-nanashi authored Oct 29, 2024
1 parent b6fcc3b commit 9720cbc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/voicevox_core/src/engine/audio_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn wav_from_s16le(pcm: &[u8], sampling_rate: u32, is_stereo: bool) -> Vec<u8
cur.write_all(&(wave_size - 8).to_le_bytes()).unwrap();
cur.write_all("WAVEfmt ".as_bytes()).unwrap();
cur.write_all(&16_u32.to_le_bytes()).unwrap(); // fmt header length
cur.write_all(&1_u16.to_le_bytes()).unwrap(); //linear PCM
cur.write_all(&1_u16.to_le_bytes()).unwrap(); // linear PCM
cur.write_all(&num_channels.to_le_bytes()).unwrap();
cur.write_all(&sampling_rate.to_le_bytes()).unwrap();

Expand Down
6 changes: 3 additions & 3 deletions crates/voicevox_core/src/synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ pub(crate) mod blocking {

const DEFAULT_SAMPLING_RATE: u32 = 24000;

/// 音声の中間物
/// 音声の中間表現
pub struct AudioFeature {
/// (フレーム数, 特徴数)の形を持つ音声特徴量。
internal_state: ndarray::Array2<f32>,
/// 生成時に指定したスタイル番号。
style_id: crate::StyleId,
/// workaround paddingを除いた音声特徴量のフレーム数。
pub frame_length: usize,
/// サンプリングレート。全体の秒数は`frame_length / frame_rate`で表せる。
/// フレームレート。全体の秒数は`frame_length / frame_rate`で表せる。
pub frame_rate: f64,
/// workaroundとして付け足されているパディング長。
padding_frame_length: usize,
Expand Down Expand Up @@ -516,7 +516,7 @@ pub(crate) mod blocking {
if MARGIN > audio.padding_frame_length + clipped_start
|| MARGIN > audio.padding_frame_length + (audio.frame_length - clipped_end)
{
unimplemented!("Validation error: Too short padding for input, please report this issue on GitHub.");
unreachable!("Validation error: Too short padding for input, please report this issue on GitHub.");
}
let left_margin = MARGIN;
let right_margin = MARGIN;
Expand Down
4 changes: 2 additions & 2 deletions example/python/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def main() -> None:
chunk_frames = int(intermediate.frame_rate * chunk_sec)
pcm = b""
for i in range(0, intermediate.frame_length, chunk_frames):
logger.info("%s", f"synthesis {i/intermediate.frame_length:.2%}")
logger.info("%s", f"{i/intermediate.frame_length:.2%}")
pcm += synthesizer.render(intermediate, i, i + chunk_frames)
logger.info("%s", f"synthesis 100%")
logger.info("%s", f"100%")
wav = wav_from_s16le(
pcm, audio_query.output_sampling_rate, audio_query.output_stereo
)
Expand Down

0 comments on commit 9720cbc

Please sign in to comment.