mirror of
https://github.com/snakers4/silero-vad.git
synced 2026-02-04 17:39:22 +08:00
Add haskell example
This commit is contained in:
22
examples/haskell/app/Main.hs
Normal file
22
examples/haskell/app/Main.hs
Normal file
@@ -0,0 +1,22 @@
|
||||
module Main (main) where
|
||||
|
||||
import qualified Data.Vector.Storable as Vector
|
||||
import Data.WAVE
|
||||
import Data.Function
|
||||
import Silero
|
||||
|
||||
main :: IO ()
|
||||
main =
|
||||
withModel $ \model -> do
|
||||
wav <- getWAVEFile "example.wav"
|
||||
let samples =
|
||||
concat (waveSamples wav)
|
||||
& Vector.fromList
|
||||
& Vector.map (realToFrac . sampleToDouble)
|
||||
let vad =
|
||||
(defaultVad model)
|
||||
{ startThreshold = 0.5
|
||||
, endThreshold = 0.35
|
||||
}
|
||||
segments <- detectSegments vad samples
|
||||
print segments
|
||||
Reference in New Issue
Block a user