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

Get pass line 116 of jumpcutter.py #1

Open
GirkovArpa opened this issue Mar 11, 2021 · 0 comments
Open

Get pass line 116 of jumpcutter.py #1

GirkovArpa opened this issue Mar 11, 2021 · 0 comments

Comments

@GirkovArpa
Copy link
Owner

Currently ported up to line 116 of jumpcutter.py:

sampleRate, audioData = wavfile.read(TEMP_FOLDER+"/audio.wav")
audioSampleCount = audioData.shape[0]
maxAudioVolume = getMaxVolume(audioData)

I'm not sure if my max volume finder function is doing what I think it's doing, though:

pub fn get_sample_rate(filename: String) -> Metadata {
  let mut reader = hound::WavReader::open(filename).unwrap();
  let metadata = reader.spec();
  let max_volume = reader.samples::<i32>().fold(0.0, |max_volume, s| {
      let sample = f64::from(s.unwrap());
      if sample > max_volume {
        return sample;
      }
      max_volume
  });
  Metadata {
    sample_rate: metadata.sample_rate,
    sample_count: reader.len(),
    max_volume: max_volume
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant