Nice!  That looks easy to use.

Is it possible to kick off sample playback from haskell in real time, in 
response to keyboard events for instance?

On 06/20/2014 01:17 PM, Anton Kholomiov wrote:
> I wanted to mix a drum-loop with the tanpura sound to play along
> with bansuri flute. I've got a short drum-loop and looong file of the
> tanpura drone and haskell. So I've done it with my library
> csound-expression and moved the usefull functionality in the
> library. Now it's much easier to play sound files.
>
> And..
>
> I'd like to announce the new version of the library 'csound-expression' [1]
>
> With new functions it's very easy to read and playback sound files.
> recently I wanted to make a simple mix of drum loop with harmony.
> With new functions it's as simple as
>
> ~~~
> module Main where
>
> import Csound.Base
>
> -- ten minutes
> totalDur = 10 * 60
>
> main = dac $ takeSnd totalDur $ tabla + mul 0.5 tanpura
> where
> tabla    = loopSnd "tanpura - f - sp.mp3"
> tanpura  = loopSndBy 8 "Teentaal.wav"
> ~~~
>
> ~~~
> -- to read file in loop
> loopSnd :: String -> (Sig, Sig)
>
> -- to read file in loop with given period
> loopSndBy :: D -> String -> (Sig, Sig)
>
> -- to take only given amount of seconds from file
> takeSnd :: Sigs a => Double -> a -> a
>
> -- to scale signals with the given signal
> mul :: SigSpace a => Sig -> a -> a
> ~~~
>
> D is a Double inside dsl, Sigs is a type class for tpules of signals.
>
> There are functions to read wav-files with the given speed.
> Here is how we can listen to the file in reverse in the terminal:
>
> ~~~
> ghci
>> :m +Csound.Base
>> readWav (-1) "fuzzy-buzzy-sound.wav"
> ~~~
>
> The functions `readWav` and `loopWav` take a speed
> of playback as first argument (and it's signal. We can change
> it over time)
>
> ~~~
> readWav :: Sig -> String -> (Sig, Sig)
> loopWav :: Sig -> String -> (Sig, Sig)
> ~~~
>
> You can look at all new functions at
>
> https://hackage.haskell.org/package/csound-expression-3.2.3/docs/Csound-Air.html#g:13
>
> Sorry for skipping the docs. I hope that description above helps somehow.
> I''m going to fix it soon.
>
> [1] https://hackage.haskell.org/package/csound-expression-3.2.3
>
>
> Cheers
> Anton
>


-- 

Read the whole topic here: Haskell Art:
http://lurk.org/r/topic/1LjVC2esBoyvTI5wy6etKT

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

Reply via email to