HISE Logo Forum
    • Categories
    • Register
    • Login
    1. HISE
    2. dejaru
    3. Posts
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Get wav length in milliseconds OR sample rate

      Appreciated guys, can't believe I missed these! Also got a bit confused with getting getSampleLength and getSampleRate.
      Case of the mondays I guess.

      const var SamplePlayer1 = Synth.getAudioSampleProcessor("SamplePlayer1");
      const var audioFile1 = SamplePlayer1.getAudioFile(0);
      const var samples = SamplePlayer1.getSampleLength();
      const var sampleRate = audioFile1.getSampleRate();
      const var lengthMs = (samples / sampleRate) * 1000;
      

      Thanks again.

      posted in Scripting
      D
      dejaru
    • Get wav length in milliseconds OR sample rate

      Hey all.
      I'd like to get my wav file's length in milliseconds. I can do sample.getSampleLength() and get the length in samples and then do:

      var ms = (samples/samplerate) * 1000
      

      However, how can I get the samplerate of the wav?

      posted in Scripting
      D
      dejaru