Safe Haskell | None |
---|---|
Language | Haskell2010 |
PitchTrack.Track
Contents
Description
This module provides a high-level interface for the most common cases.
The default number of samples used for each computation is 2048,
which should be enough if you never go below 65Hz.
If you need a different number, you should use the functions whose name ends with N
,
which take the number of samples as a first parameter.
- trackFile :: FilePath -> (Double -> PitchTrack ()) -> IO ()
- trackFileN :: Int -> FilePath -> (Double -> PitchTrack ()) -> IO ()
- trackFileToList :: FilePath -> IO [Double]
- trackStdin :: (Double -> PitchTrack ()) -> IO ()
- trackStdinN :: Int -> (Double -> PitchTrack ()) -> IO ()
- trackHandle :: Handle -> (Double -> PitchTrack ()) -> IO ()
- trackHandleN :: Int -> Handle -> (Double -> PitchTrack ()) -> IO ()
- trackLBS :: ByteString -> (Double -> PitchTrack ()) -> IO ()
- trackLBSN :: Int -> ByteString -> (Double -> PitchTrack ()) -> IO ()
- defaultSampleNum :: Int
Reading from a file
trackFile :: FilePath -> (Double -> PitchTrack ()) -> IO () Source
Track a file and apply a function to each computed pitch
>>>
trackFile "a440.raw" $ \pitch -> liftIO $ putStr (show pitch ++ ",")
440.0,440.0,440.0,440.0,440.0,440.0,440.0,440.0,440.0,440.0,440.0,440.0,
trackFileN :: Int -> FilePath -> (Double -> PitchTrack ()) -> IO () Source
Same as trackFile
, but takes the number of samples as a first parameter
trackFileToList :: FilePath -> IO [Double] Source
Track a file and return a list of all the computed pitches
Note: the whole list is loaded into memory
Reading from stdin
trackStdin :: (Double -> PitchTrack ()) -> IO () Source
trackStdinN :: Int -> (Double -> PitchTrack ()) -> IO () Source
Same as trackStdin
, but takes the number of samples as a first parameter
Reading from a handle
trackHandle :: Handle -> (Double -> PitchTrack ()) -> IO () Source
Same as trackFile
but reads from a handle instead of a file
trackHandleN :: Int -> Handle -> (Double -> PitchTrack ()) -> IO () Source
Same as trackHandle
, but takes the number of samples as a first parameter
Reading from a lazy ByteString
trackLBS :: ByteString -> (Double -> PitchTrack ()) -> IO () Source
Track a lazy ByteString
and apply a function to each computed pitch
trackLBSN :: Int -> ByteString -> (Double -> PitchTrack ()) -> IO () Source
Same as trackLBS
, but takes the number of samples as a first parameter
Other definitions
defaultSampleNum :: Int Source
The default number of samples used for each computation (2048)