<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Get wav length in milliseconds OR sample rate]]></title><description><![CDATA[<p dir="auto">Hey all.<br />
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:</p>
<pre><code>var ms = (samples/samplerate) * 1000
</code></pre>
<p dir="auto">However, how can I get the <strong><strong>samplerate</strong></strong> of the wav?</p>
]]></description><link>https://forum.hise.audio/topic/11171/get-wav-length-in-milliseconds-or-sample-rate</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Mar 2026 20:42:49 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/11171.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 25 Nov 2024 11:27:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Get wav length in milliseconds OR sample rate on Tue, 26 Nov 2024 10:37:42 GMT]]></title><description><![CDATA[<p dir="auto">Appreciated guys, can't believe I missed these! Also got a bit confused with getting getSampleLength and getSampleRate.<br />
Case of the mondays I guess.</p>
<pre><code>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;
</code></pre>
<p dir="auto">Thanks again.</p>
]]></description><link>https://forum.hise.audio/post/91918</link><guid isPermaLink="true">https://forum.hise.audio/post/91918</guid><dc:creator><![CDATA[dejaru]]></dc:creator><pubDate>Tue, 26 Nov 2024 10:37:42 GMT</pubDate></item><item><title><![CDATA[Reply to Get wav length in milliseconds OR sample rate on Mon, 25 Nov 2024 21:30:35 GMT]]></title><description><![CDATA[<p dir="auto">You could also use <code>Engine.getMilliSecondsForSamples()</code></p>
]]></description><link>https://forum.hise.audio/post/91888</link><guid isPermaLink="true">https://forum.hise.audio/post/91888</guid><dc:creator><![CDATA[David Healey]]></dc:creator><pubDate>Mon, 25 Nov 2024 21:30:35 GMT</pubDate></item><item><title><![CDATA[Reply to Get wav length in milliseconds OR sample rate on Mon, 25 Nov 2024 21:10:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/3864">@dejaru</a> there's a method called <code>AudioFile.getSampleRate()</code></p>
]]></description><link>https://forum.hise.audio/post/91884</link><guid isPermaLink="true">https://forum.hise.audio/post/91884</guid><dc:creator><![CDATA[ustk]]></dc:creator><pubDate>Mon, 25 Nov 2024 21:10:07 GMT</pubDate></item></channel></rss>