SynthLib

F# Project - Sound Synthesis

View the Project on GitHub PaulMarisOUMary/ALGOSUP_2022_Project_3_B

Module Wave

Wave

module Wave

Attributes: none

Methods:

Types: none

Sine


method Sine (frequency:float) (duration:float)

Return the value of a sine wave at a time t.

Example Usage:

let wave = Wave.Sine 440. 1.

Parameters:

frequency : mandatory The frequency of the sine wave.

Type : float

duration : mandatory The duration of the wave in seconds.

Type : float

Returns:

Return the value of a sine wave at a time t. Type : float

Square


method Square (frequency:float) (duration:float)

Return the value of a square wave at a time t.

Example Usage:

let wave = Wave.Square 440. 1.

Parameters:

frequency : mandatory The frequency of the square wave.

Type : float

duration : mandatory The duration of the wave in seconds.

Type : float

Returns:

Return the value of a square wave at a time t. Type : float

Triangle


method Triangle (frequency:float) (duration:float)

Return the value of a triangle wave at a time t.

Example Usage:

let wave = Wave.Triangle 440. 1.

Parameters:

frequency : mandatory The frequency of the triangle wave.

Type : float

duration : mandatory The duration of the wave in seconds.

Type : float

Returns:

Return the value of a triangle wave at a time t. Type : float

Sawtooth


method Sawtooth (frequency:float) (duration:float)

Return the value of a sawtooth wave at a time t.

Example Usage:

let wave = Wave.Sawtooth 440. 1.

Parameters:

frequency : mandatory The frequency of the sawtooth wave.

Type : float

duration : mandatory The duration of the wave in seconds.

Type : float

Returns:

Return the value of a sawtooth wave at a time t. Type : float

Identity


method Identity (frequency:float) (duration:float)

Return the value of a identity wave at a time t, in this case it’s always 0.. Combined with a MakeNote it should represent silence/ an empty wave.

Example Usage:

let wave = Wave.Identity 0. 1.

Parameters:

frequency : mandatory The frequency of the Identity wave. Whatever value it has, this parameter is ignored. It has been created to make the function callable combined with a MakeNote.

Type : float

duration : mandatory The duration of the wave in seconds.

Type : float

Returns:

Return the value of a identity wave at a time t, in this case it’s always 0.. Type : float (always 0.)

MakeNote


method MakeNote generator (duration:float) (note:Note) (octave:int)

Return a point-sampled note wave.

Example Usage:

let wave = Wave.MakeNote (Wave.Square) 1. Note.A 4

Parameters:

generator : mandatory The type of the wave.

Type : func(float*float->float)

duration : mandatory The duration of the wave in seconds.

Type : float

note : mandatory The note you want to play.

Type : Note

octave : mandatory The octave of the note you want to play (0 to 8).

Type : int

Returns:

Return a wave. Type : list<float> | (wave)

Combine


method Combine (args: list<list<float>>)

Return a chord of two or more waves.

Example Usage:

let wave = Wave.Combine([Wave.MakeNote Wave.Square 2. Note.E 4; Wave.MakeNote Wave.Square 2. Note.C 4])

Parameters:

args : mandatory A list of all the different waves you want to combine.

Type : list<float>

Returns:

Return a wave. Type : list<float> | (wave)