packages feed

hsc3-plot (empty) → 0.12

raw patch · 5 files changed

+102/−0 lines, 5 filesdep +basedep +gnuplotdep +hsc3setup-changed

Dependencies added: base, gnuplot, hsc3, statistics, vector

Files

+ README view
@@ -0,0 +1,18 @@+hsc3-plot+---------++[Haskell][hs] [SuperCollider][sc3] plotting ([Gnuplot][gnuplot]).++There is an+[entry](?t=hsc3-texts&l=lhs/hsc3-tutorial.lhs#plotting)+at the [hsc3-texts](?t=hsc3-texts)+[tutorial](?t=hsc3-texts&l=lhs/hsc3-tutorial.lhs).++[hs]: http://haskell.org/+[sc3]: http://audiosynth.com/+[gnuplot]: http://www.gnuplot.info/++© [rohan drape][rd], 2012, [gpl][gpl].++[rd]: http://rd.slavepianos.org/+[gpl]: http://gnu.org/copyleft/
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ Sound/SC3/Plot.hs view
@@ -0,0 +1,39 @@+module Sound.SC3.Plot where++import qualified Graphics.Gnuplot.Simple as G {- gnuplot -}+import qualified Graphics.Gnuplot.Value.Tuple as G+import Sound.SC3.Plot.Histogram+import Sound.SC3.UGen.Envelope {- hsc3 -}++eps :: G.Attribute+eps = G.EPS "/tmp/plot.eps"++-- | Plot 'Envelope' data.+--+-- > plotEnvelope [envPerc 0.2 1,envSine 1 0.75]+plotEnvelope :: (G.C t,Ord t, Floating t, Enum t) => [Envelope t] -> IO ()+plotEnvelope = G.plotLists [] . map (envelope_render 256)++-- | Plot 'Histogram' data.+--+-- > plotHistogram [histogram 3 [0,0,1,2,2,2]]+plotHistogram :: G.C t => [Histogram t] -> IO ()+plotHistogram =+    let f (Histogram x y) = zip x y+    in G.plotLists [] . map f++type Table x = [x]++-- | Plot 'Table' data, ie. /y/ values at equal /x/ increments.+--+-- > plotTable [[0,2..12],[0..6],[0,4..12]]+plotTable :: G.C t => [Table t] -> IO ()+plotTable = G.plotLists []++type Coord x = [(x,x)]++-- > plotCoord [[(0,0),(0.15,0.35),(0.75,0.25),(0.35,0.15)]]+plotCoord :: G.C t => [Coord t] -> IO ()+plotCoord =+    let s = G.defaultStyle {G.plotType = G.LinesPoints}+    in G.plotPathsStyle [] . zip (repeat s)
+ Sound/SC3/Plot/Histogram.hs view
@@ -0,0 +1,13 @@+module Sound.SC3.Plot.Histogram where++import qualified Data.Vector as V {- vector -}+import qualified Statistics.Sample.Histogram as H {- statistics -}++data Histogram x = Histogram [x] [x]++-- | Calculate 'Histogram' for number of bins /n/ and sample data /x/.+histogram :: Int -> [Double] -> Histogram Double+histogram n x =+    let v = V.fromList x+        (l,h) = H.histogram n v+    in Histogram (V.toList l) (V.toList h)
+ hsc3-plot.cabal view
@@ -0,0 +1,30 @@+Name:              hsc3-plot+Version:           0.12+Synopsis:          Haskell SuperCollider Plotting+Description:       Plotting functions for hsc3+License:           GPL+Category:          Sound+Copyright:         (c) Rohan Drape and others, 2012+Author:            Rohan Drape+Maintainer:        rd@slavepianos.org+Stability:         Experimental+Homepage:          http://rd.slavepianos.org/?t=hsc3-plot+Tested-With:       GHC == 7.2.2+Build-Type:        Simple+Cabal-Version:     >= 1.8++Data-files:        README++Library+  Build-Depends:   base == 4.*,+                   hsc3 == 0.12.*,+                   gnuplot,+                   statistics,+                   vector+  GHC-Options:     -Wall -fwarn-tabs+  Exposed-modules: Sound.SC3.Plot+                   Sound.SC3.Plot.Histogram++Source-Repository  head+  Type:            darcs+  Location:        http://rd.slavepianos.org/sw/hsc3-plot