Skip to content

tapochqa/lufs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LUFS Meter in Clojure. Measures Integrated, Short-Term, Momentary LUFS and LRA.

Clojars Project

(ns lufsomer.core
    (:require [lufs.core :as lufs]))



; Measure LUFS from file or filename

(lufs/integrated "audio.wav") ; -18.860580104601013



; Measure LUFS of provided sample arrays and sample-rate.
; All values in arrays must be doubles between -1 and 1.

(defn gen-data [len rate]
      (repeatedly
      	(* len rate)
      	#(-> 	(rand-int 2000)
      			(- 1000)
      			(/ 1000.0))))

(let [sr 44100 len 10]
    (lufs/lufs* 
      [(gen-data len sr)
      		(gen-data len sr)]
      		sr)) ; 1.4325250705544224

For now it's relatively slow. Works with 2-channel WAV and MP3.

Algorithm is copied from csteinmetz1/pyloudnorm.

WAV to double arrays converter copied from kunstmusik/pink with a bugfix.