hdf

HDF: Uniform Rate Audio Signal Processing in Haskell http://rd.slavepianos.org/t/hdf

Latest on Hackage:0.15

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

GPL licensed by Rohan Drape
Maintained by rd@slavepianos.org
hdf - haskell data flow
-----------------------

[Haskell][hs] library for uniform rate audio signal processing.

It generates [C][c] code that requires either
`RDL` (from [sc3-rdu][sc3-rdu]) or `jack-dl` (from [rju][rju]).

The [SC2][sc2] [analog bubbles][ab] graph can be written:

~~~~
let o = lf_saw (mce2 8.0 7.23) 0.0 * 3.0 + 80.0
m = lf_saw 0.4 0.0 * 24.0 + o
s = sin_osc (midi_cps m) 0.0 * 0.04
c = comb_n [0,1] 0.4 s 0.2 4.0
in out c
~~~~

The data flow graph this generates is:

![](sw/hdf/svg/analog-bubbles.svg)

The generated C-code (for `jack-dl`) is [c/gen/analog-bubbles.c](sw/hdf/c/gen/analog-bubbles.c).

Slightly more elaborate, the [berlin 1977][b7] graph can be written:

~~~~
let clock_rate = 9
clock_time = 1 / clock_rate
clock = impulse clock_rate 0 -- sequencer trigger
tr = trigger clock
note = sequ 0 [55,60,63,62,60,67,63,58] tr -- midi note pattern sequencer
tr_16 = pulse_divider tr 16 0 -- divide tr by 16
note' = sequ 1 [-12,-7,-5,0,2,5] tr_16 + note -- transpose
freq = midi_cps note' -- convert midi note to cycles per second
env = decay2 clock (0.05 * clock_time) (2 * clock_time)
amp = env * 0.1 + 0.02 -- amplitude envelope
filt = env * (sin_osc 0.17 0 * 800) + 1400 -- filter frequency
pw = sin_osc (mce2 0.08 0.09) 0 * 0.45 + 0.5 -- pulse width LFO(s)
s = lf_pulse freq 0 pw * amp -- not bandlimited
in out (comb_n [0,1] 0.2 (rlpf s filt 0.15) (mce2 0.2 0.17) 1.5)
~~~~

The data flow graph this generates is:

![](sw/hdf/svg/berlin-1977.svg)

The generated C-code (for `jack-dl`) is [c/gen/berlin-1977.c](sw/hdf/c/gen/berlin-1977.c).

<!-- These are from the small set of example [graphs][ix]. -->

hdf implements `text-dl` for testing.

[hs]: http://haskell.org/
[c]: http://c2.com/cgi/wiki?CeeLanguage
[sc3-rdu]: http://rd.slavepianos.org/?t=sc3-rdu
[rju]: http://rd.slavepianos.org/?t=rju
[ab]: sw/hsc3-graphs/gr/analog-bubbles.scd
[b7]: sw/hsc3-graphs/gr/berlin-1977.scd
[sc2]: http://audiosynth.com/
[ix]: http://rd.slavepianos.org/?t=hdf&e=md/ix.md

© [rohan drape][rd], 2006-2014, [gpl]

[rd]: http://rd.slavepianos.org/
[gpl]: http://gnu.org/copyleft/
comments powered byDisqus