Hi!

I'd like to announce the new version of csound-expression [1] library.

There are two main additions to the library.

--------------------------------------------------------------------------------------
-- Looping envelopes (aka step sequencers)

The first is the family of step sequencers. It's possible to emulate TR303
bass-lines
and drums in Haskell!

The main idea is that we can use LFOs to create drum patterns or
arpegiators.
We can multiply the white noise with slowly moving unipolar square wave to
create
a bursts of noise

> dac $ mul (usqr 8) $ white

To be more interesting this example needs accents. Accents is the scaling
by
volume (or amplitude). Right now all bursts sound the same. Here come the
sequencers!

> dac $ mul (sqrSeq [1, 0.5, 0.2, 0.5] 8) $ white

The sqrSeq function takes in the list of weights for subsequent bursts. It
periodically
scales the square wave. It becomes more like a drum pattern.

There are many more sequencers:
constSeq (constants), adsrSeq (looping ADSRs with scaling by accents),
xadsrSeq (exponential ADSR sequencers),
sawSeq (sawtooth sequencer), isawSeq (iverted saw), xsawSeq (exponential
saw),
generic looping linear and exponential envelopes.
You can read the details at [2].

We can use sequencers not only for volumes. We can change pitches
or center frequencies of the filter to create arpegiators:

> dac $ tri $ constSeq [220, 220 * 5 / 4, 330, 440, 330] 8

The cool thing is that weights are signals they are not the constants!
We can apply sequencers to them too!

> dac $ tri $ constSeq [220, 220 * 5 / 4, 330, 440, constSeq [330, 220 * 9
/ 8] 1] 8

The world of acid-trance-dub music opens up!
More examples at [3].

------------------------------------------------------------------------------------------
-- Applicative UIs

The second addition is applicative GUIs

If we have two knobs and we want to control a filter it's as easy as:

~~~
dac $ hlift2 (\cps q -> mlp (250 + 2000 * cps) q)
    (uknob 0.5)
    (uknob 0.5)
~~~

The uknob creates a unipola knob (ranges from 0 to 1).
Let's look at the hlift2

hlift2 :: (a -> b -> c) -> Source a -> Source b -> Source c

The hlift2 takes a function of two arguments and two UI-sources
(knobs or sliders or smth more advanced like combination of UI outputs).
It applies the function and places visual representations horizontally.
There is a compliment function vlift2. It places visuals vertically.
There are functions for up to 5 arguments (hlift3, hlift4, ...).

Another examples that's how we can explore the beatings joined with
moog low pass filter:


dac $ mul 0.7 $
   hlift3 (\x a r -> mlp a r $ sqr 110 + tri (110 + x) + sqr (110 + 4 * x))
   (uon 0.5 4 $ uknob 0.5)
   (xknob 50 5000 1000)
   (uon 0 0.95 $ uknob 0.5)

The xknob is exponential knob. It's useful for frequencies. It takes
minimum and maximum
and initial values. The uon scales the output of unipolar signal.

sqr -- square wave
tri -- triangle wave
mlp -- moog low pass filter
mul -- scales the signal-like things


------------------------------------------------------------------------------------------

[1] https://hackage.haskell.org/package/csound-expression

[2]
https://github.com/anton-k/csound-expression/blob/master/tutorial/chapters/SynthTutorial.md#looping-envelope-generators

[3] https://github.com/anton-k/csound-bits/blob/master/book/Main.hs

[4]
https://github.com/anton-k/csound-expression/blob/master/tutorial/chapters/SynthTutorial.md#using-guis-as-control-signals


Anton

-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/6Zz1A5x3tVGQYoAQE98ASA

To leave Haskell Art, email haskell-...@group.lurk.org with the following email 
subject: unsubscribe

Reply via email to