envelopes Module

Functions and subroutines generating envelopes


Uses

  • module~~envelopes~~UsesGraph module~envelopes envelopes module~forsynth forsynth module~envelopes->module~forsynth module~tape_recorder_class tape_recorder_class module~envelopes->module~tape_recorder_class iso_fortran_env iso_fortran_env module~forsynth->iso_fortran_env module~tape_recorder_class->module~forsynth

Used by

  • module~~envelopes~~UsedByGraph module~envelopes envelopes module~music music module~music->module~envelopes module~signals signals module~music->module~signals module~signals->module~envelopes program~all_signals all_signals program~all_signals->module~envelopes program~all_signals->module~music program~all_signals->module~signals program~arpeggios arpeggios program~arpeggios->module~envelopes program~arpeggios->module~music program~arpeggios->module~signals program~chords_and_melody chords_and_melody program~chords_and_melody->module~envelopes program~chords_and_melody->module~music program~chords_and_melody->module~signals program~demo_effects demo_effects program~demo_effects->module~envelopes program~demo_effects->module~music program~drone_music drone_music program~drone_music->module~envelopes program~drone_music->module~music program~radioactivity radioactivity program~radioactivity->module~envelopes program~radioactivity->module~music module~morse_code morse_code program~radioactivity->module~morse_code program~shepard_risset_glissando shepard_risset_glissando program~shepard_risset_glissando->module~envelopes module~morse_code->module~signals program~blues blues program~blues->module~music program~blues->module~signals program~drum_machine drum_machine program~drum_machine->module~signals program~misc_sounds misc_sounds program~misc_sounds->module~music program~multiplication_bells multiplication_bells program~multiplication_bells->module~music program~multiplication_bells->module~signals

Derived Types

type, public ::  ADSR_envelope

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: attack = 30.0_wp

A D S R /\ / ____ / \ / \ https://en.wikipedia.org/wiki/Envelope_(music) Default parameters of the ADSR envelope:

real(kind=wp), public :: decay = 20.0_wp
real(kind=wp), public :: release = 30.0_wp
real(kind=wp), public :: sustain = 80.0_wp

Type-Bound Procedures

procedure, public :: get_level => ADSR_level
procedure, public :: new => ADSR_new

Functions

public pure function fit_exp(x, x1, y1, x2, y2)

Returns an exponential interpolation y(x) between (x1,y1) and (x2,y2). Useful for computing an exponentially decreasing enveloppe.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: x1
real(kind=wp), intent(in) :: y1
real(kind=wp), intent(in) :: x2
real(kind=wp), intent(in) :: y2

Return Value real(kind=wp)

private pure function ADSR_level(self, t, t1, t2)

Returns the level in [0, 1] of the ADSR envelope at time t1 < t < t2

Arguments

Type IntentOptional Attributes Name
class(ADSR_envelope), intent(in) :: self
real(kind=wp), intent(in) :: t
real(kind=wp), intent(in) :: t1
real(kind=wp), intent(in) :: t2

Return Value real(kind=wp)


Subroutines

public subroutine apply_fade_in(tape, track, t1, t2)

A linear fade in, from relative level 0 to 1:

Arguments

Type IntentOptional Attributes Name
type(tape_recorder), intent(inout) :: tape
integer, intent(in) :: track
real(kind=wp), intent(in) :: t1
real(kind=wp), intent(in) :: t2

public subroutine apply_fade_out(tape, track, t1, t2)

A linear fade out, from relative level 1 to 0:

Arguments

Type IntentOptional Attributes Name
type(tape_recorder), intent(inout) :: tape
integer, intent(in) :: track
real(kind=wp), intent(in) :: t1
real(kind=wp), intent(in) :: t2

private subroutine ADSR_new(self, A, D, S, R)

Arguments

Type IntentOptional Attributes Name
class(ADSR_envelope), intent(inout) :: self
real(kind=wp), intent(in) :: A
real(kind=wp), intent(in) :: D
real(kind=wp), intent(in) :: S
real(kind=wp), intent(in) :: R