calmChan :: Int -> Chan a -> IO (Chan a)
calmChan msDelay inChan = do
  outChan <- newChan
  sample <- newEmptySampleVar
  forkIO $ forever $ do
    v <- readChan inChan
    writeSampleVar sample v
  forkIO $ forever $ do
    v <- readSampleVar sample
    writeChan outChan v
    threadDelay (msDelay * 1000)
  return outChan
calmChan :: Int -> Chan a -> IO (Chan a)
calmChan msDelay inChan = do
  outChan <- newChan
  sample <- newEmptySampleVar
  forkIO $ forever $ do
    v <- readChan inChan
    writeSampleVar sample v
  forkIO $ forever $ do
    v <- readSampleVar sample
    writeChan outChan v
    threadDelay (msDelay * 1000)
  return outChan
calmChan msDelay inChan = do
  outChan <- newChan
  sample <- newEmptySampleVar
  forkIO $ forever $ do
    v <- readChan inChan
    writeSampleVar sample v
  forkIO $ forever $ do
    v <- readSampleVar sample
    writeChan outChan v
    threadDelay (msDelay * 1000)
  return outChan