-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Easy voice activity detection
--   
--   A simple library wrapping WebRTC's voice activity detection engine.
@package webrtc-vad
@version 0.1.0.3

module Sound.VAD.WebRTC

-- | A VAD instance with a state token (like <tt>MVector</tt>).
data VAD s

-- | A VAD instance for use in <a>IO</a>.
type IOVAD = VAD RealWorld

-- | Create and initialize a VAD instance.
create :: PrimMonad m => m (VAD (PrimState m))

-- | Aggressiveness mode (0, 1, 2, or 3).
type Aggressiveness = Int

-- | <pre>
--   setMode mode vad
--   </pre>
--   
--   Sets the VAD operating mode. A more aggressive (higher mode) VAD is
--   more restrictive in reporting speech. Put in other words the
--   probability of being speech when the VAD returns 1 is increased with
--   increasing mode. As a consequence also the missed detection rate goes
--   up.
setMode :: PrimMonad m => Aggressiveness -> VAD (PrimState m) -> m ()

-- | <pre>
--   validRateAndFrameLength rate frameLength
--   </pre>
--   
--   Checks for valid combinations of <tt>rate</tt> and
--   <tt>frameLength</tt>. We support 10, 20 and 30 ms frames and the rates
--   8000, 16000 and 32000 Hz.
--   
--   <tt>rate</tt>: Sampling frequency (Hz).
--   
--   <tt>frameLength</tt>: Speech frame buffer length in number of samples.
validRateAndFrameLength :: Int -> Int -> Bool

-- | <pre>
--   process sampleRate audioFrame vad
--   </pre>
--   
--   Calculates a VAD decision for the <tt>audioFrame</tt>. For valid
--   sampling rates frame lengths, see the description of
--   <tt>validRatesAndFrameLengths</tt>.
--   
--   <tt>sampleRate</tt>: Sampling frequency (Hz): 8000, 16000, or 32000
--   
--   <tt>audioFrame</tt>: Audio frame buffer (mono signed 16-bit).
process :: PrimMonad m => Int -> Vector Int16 -> VAD (PrimState m) -> m Bool
newtype VADException
VADException :: String -> VADException
instance GHC.Show.Show Sound.VAD.WebRTC.VADException
instance GHC.Exception.Exception Sound.VAD.WebRTC.VADException
