Home

Awesome

Synopsis

FSound is a library for processing sound using F#

Code Example

You can run these examples in F# interactive in Visual Studio. Make sure you build the project first. Then in Solution Explorer, right click on the FSound project and select "Send Project Output to F# Interactive". This will load the FSound project assembly into F# Interactive. After that, simply copy and paste the code over in each of the following code examples.

Here are some of the things you can do with FSound:

Generate mono wav file

Generate stereo wav file

Play a mono signal

Play different signals in left and right channel

ADSR envelope

Delay with ADSR envelope on triangular waveform

Delay with ADSR envelope on white noise

Smith-Angell resonator

Smith-Angell resonator with an ADSR envelope

High-pass filter on white noise

Low-pass filter on white noise with an LFO

Plotting frequency response

Vibrato

Flanging

Flanging on white noise

Chorus

Streaming sample sequences

Karplus-Strong algorithm

Arrangement of instruments

Ping-pong delay

Chord progression

Telephone ringing tone

Schroeder reverberation

Ring modulation

FM Synthesis

Chowning's FM instruments

Representing relationships in Western Tonal Music

Motivation

This project arises purely out of a personal interest in learning the F# programming language and applying it to a domain I have always found fascinating - Sound

Installation

Simply download the project and load it in visual studio 2015.

If your version of Visual Studio does not have F#, you may install the free Visual Studio 2015 Community Edition. The Visual F# Tools are installed automatically when you first create or open an F# project. See: http://fsharp.org/use/windows/

This project requires you to install a couple of dependent packages.

To do this with Nu-Get in VS:

  1. Right click References in Solution Explorer
  2. Click Manage Nu-Get packages
  3. Click Restore when you see "Some NuGet packages are missing from this solution. Click to restore from your online package sources"

You should be all set. Simply rebuild the project. Feel free to send an email to albert.pang@me.com if you run into any problems.

Tests

SignalTest.fsx is the only test script for now. Load it into F# interactive:

C:\Users\panga\project\fsharp\FSound>fsi --load:SignalTest.fsx

Microsoft (R) F# Interactive version 14.0.23020.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

[Loading C:\Users\panga\project\fsharp\FSound\SignalTest.fsx]

namespace FSI_0002
  val main : unit -> bool

> SignalTest.main();;
val it : bool = true

> exit 0;;

C:\Users\panga\project\fsharp\FSound>dir *.wav
 Volume in drive C has no label.
 Directory of C:\Users\panga\project\fsharp\FSound

01/09/15  07:17 pm           176,446 saw-440.wav
01/09/15  07:17 pm           176,446 sinusoid-440.wav
01/09/15  07:17 pm           176,446 square-440.wav
01/09/15  07:17 pm           176,446 triangle-440.wav
01/09/15  07:17 pm           882,046 wave.wav
01/09/15  07:17 pm           176,446 whitenoise.wav
               6 File(s)      1,764,276 bytes
               0 Dir(s)  30,879,870,976 bytes free

Contributors

Albert Pang (albert.pang@me.com)

Showcase

William Sharkey's compositions (https://github.com/williamsharkey/William-FSound-Songs)

License

Released under GPL v3.0 licence