Please sign in to comment.
Initial code for loading wave file and printing first 1000 samples
- Loading branch information...
Showing with 23 additions and 0 deletions.
|@@ -0,0 +1,22 @@|
|+import System.Environment (getArgs)|
|+-- Gets a list of samples for the specified channel from the wave file|
|+getChannel :: Int -> WAVE -> [Double]|
|+getChannel channel wave = map (\x -> sampleToDouble $ x !! channel) $ waveSamples wave|
|+-- Plays a specified sound file|
|+playSound :: String -> IO()|
|+playSound file = do|
|+ putStrLn $ "playing sound " ++ file|
|+ wave <- getWAVEFile file|
|+ print $ take 256 $ getChannel 1 wave|
|+-- Entry point for the application|
|+main = do|
|+ args <- getArgs|
|+ case args of|
|+ [input] -> playSound input|
|+ _ -> putStrLn "One argument required (wav file name)"|
|@@ -0,0 +1 @@|
|+This is a simple project which reads in a wave file and plays it whilst visualizing the frequency content with openGL. It is written in response to a Hoodlums meetup in London on May 12th 2011.|
Binary file not shown.