WAVE 0.1.4 → 0.1.5
raw patch · 4 files changed
+38/−38 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +6/−1
- WAVE.cabal +2/−2
- readtest.hs +4/−35
- writetest.hs +26/−0
README.md view
@@ -1,5 +1,5 @@ # WAVE format audio file IO library-Copyright © 2008-2014 Bart Massey+Copyright © 2008-2020 Bart Massey This library provides `Data.WAVE`, a module for reading and writing audio files in the@@ -11,6 +11,11 @@ nonlinear encodings), and non-WAVE audio files are in no way supported. I thought others might find it useful, though. I also have released other code that depends on it.++The source distribution contains a couple of demo programs:++* `writetest.hs`: Writes a square wave into a file.+* `readtest.hs`: Displays information for a given WAVE file. This program is licensed under the "3-clause 'new' BSD License". Please see the file `COPYING` in this distribution
WAVE.cabal view
@@ -1,7 +1,7 @@ Name: WAVE Description: Module for reading and writing audio files in WAVE format. Build-Type: Simple-Version: 0.1.4+Version: 0.1.5 License: BSD3 License-File: COPYING Author: Bart Massey <bart@cs.pdx.edu>@@ -11,7 +11,7 @@ Category: Data, Sound Synopsis: WAVE audio file IO library Stability: Alpha-Extra-Source-Files: README.md readtest.hs+Extra-Source-Files: README.md readtest.hs writetest.hs Cabal-Version: >=1.10 Library
readtest.hs view
@@ -1,7 +1,8 @@---- Copyright (C) 2007 Bart Massey---- ALL RIGHTS RESERVED---- Please see the end of this file for license information.+--- Bart Massey 2007 +--- Show some information about a WAVE file given as an+--- argument.+ import System.Environment import ParseArgs import WAVE@@ -26,35 +27,3 @@ putStrLn ("Samples: " ++ (show n')) else do mapM_ (putStrLn . show) samples------- Redistribution and use in source and binary forms, with or---- without modification, are permitted provided that the---- following conditions are met:---- * Redistributions of source code must retain the above---- copyright notice, this list of conditions and the following---- disclaimer.---- * Redistributions in binary form must reproduce the---- above copyright notice, this list of conditions and the---- following disclaimer in the documentation and/or other---- materials provided with the distribution.---- * Neither the name of Bart Massey, nor the names---- of other affiliated organizations, nor the names---- of other contributors may be used to endorse or promote---- products derived from this software without specific prior---- written permission.---- ---- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND---- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,---- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF---- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE---- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR---- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,---- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT---- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;---- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)---- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN---- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR---- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS---- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ writetest.hs view
@@ -0,0 +1,26 @@+--- Bart Massey 03/2020++--- Write a 1-second 48Ksps 240Hz half-amplitude mono square+--- wave into "square.wav".++import Data.Bits+import Data.WAVE++main :: IO ()+main = do+ let header =+ WAVEHeader {+ waveNumChannels = 1,+ waveFrameRate = 48000,+ waveBitsPerSample = 16,+ waveFrames = Nothing+ }+ let ampl = 1 `shiftL` 30+ let samples = concat $ replicate 240 $+ replicate 100 [-ampl] ++ replicate 100 [ampl]+ let square =+ WAVE {+ waveHeader = header,+ waveSamples = samples+ }+ putWAVEFile "square.wav" square