Skip to content

Commit

Permalink
apply suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Yosshi999 committed Nov 10, 2024
1 parent a4e64db commit 7a4ad06
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/voicevox_core/src/synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ mod inner {
/// 音声特徴量の一部分を変換する際に左右それぞれに確保すべきマージン幅(f0フレーム数)
/// 使われているHifiGANのreceptive fieldから計算される
const MARGIN: usize = 14;
/// [start, end) の音声区間に対応する特徴量を両端にマージンを追加した上で切り出す
/// 与えられた音声区間に対応する特徴量を両端にマージンを追加した上で切り出す
fn crop_with_margin(
audio: &AudioFeature,
range: Range<usize>,
Expand Down Expand Up @@ -479,7 +479,11 @@ mod inner {
.render_audio_segment(spec_segment.to_owned(), audio.style_id)
.await?;
let wave = trim_margin_from_wave(&wave_with_margin)?;
return Ok(to_s16le_pcm(&wave.to_vec(), &audio.audio_query));
return Ok(to_s16le_pcm(
wave.to_slice()
.expect("`trim_margin_from_wave` should just trim an array"),
&audio.audio_query,
));

fn to_s16le_pcm(
wave: &[f32],
Expand Down

0 comments on commit 7a4ad06

Please sign in to comment.