LambdaSound 1.0.0 - A sound synthesizing library


I have released LambdaSound 1.0.0 on Hackage. LambdaSound is a library for synthesizing sounds purely in Haskell with various combinators. The generated sounds can be directly played or saved to a WAV audio file.

Contrary to other sound synthesis libraries, LambdaSound is more low-level and provides direct access to the generated sound samples. Therefore, this library might be interesting for people wanting to play around with raw sound samples and designing their own sounds. As a consequence, LambdaSound does not have any instruments built-in yet and only has electric sounds.

However, LambdaSound has some higher-level combinators to play sounds in sequence or in parallel, cut sounds apart or play sounds at a specific pitch.

Here’s an example of what LambdaSound can do:

import LambdaSound

main :: IO ()
main = play 44100 0.5 $
    let downwards = sequentially $ setDuration 0.25 . note
          <$> [g4, f4, e4, d4, f4, e4, d4, c4, e4, d4, c4, b3]
     in sequentially
          [ downwards,
            dropSound 0.25 (reverseSound $ dropSound 0.5 downwards),
            setDuration 0.25 (parallel $ note <$> [c4, e4]),
            setDuration 0.25 (parallel $ note <$> [c4, e4, g4]),
            setDuration 0.5 (parallel $ note <$> [c4, g4, c5])

note :: Semitone -> Sound I Pulse
note st = easeInOut 2 $ asNote sawWave st + asNote (harmonic triangleWave) st

I’ve been looking for a SFX synth solution for my games (Faust is what I’m currently learnging), so this has me interested!

Congrats on the release!

I recently found myself wanting to reimplement the Karplus-Strong algorithm to do a little synth, since the last time I implemented it was in C# at least a decade ago :slight_smile: I might use this library to give it a another go.

1 Like