music Module

Contains music theory elements: scales, circle of fifths, chords, etc.


Uses

  • module~~music~~UsesGraph module~music music module~envelopes envelopes module~music->module~envelopes module~forsynth forsynth module~music->module~forsynth module~music_common music_common module~music->module~music_common module~signals signals module~music->module~signals module~tape_recorder_class tape_recorder_class module~music->module~tape_recorder_class module~envelopes->module~forsynth module~envelopes->module~tape_recorder_class iso_fortran_env iso_fortran_env module~forsynth->iso_fortran_env module~signals->module~envelopes module~signals->module~forsynth module~signals->module~tape_recorder_class module~tape_recorder_class->module~forsynth

Used by

  • module~~music~~UsedByGraph module~music music program~all_signals all_signals program~all_signals->module~music program~arpeggios arpeggios program~arpeggios->module~music program~blues blues program~blues->module~music program~chords_and_melody chords_and_melody program~chords_and_melody->module~music program~demo_effects demo_effects program~demo_effects->module~music program~drone_music drone_music program~drone_music->module~music program~misc_sounds misc_sounds program~misc_sounds->module~music

Variables

Type Visibility Attributes Name Initial
real(kind=wp), public, parameter :: PITCH = 440.0_wp

Concert pitch (A note):

real(kind=wp), public, parameter :: SEMITONE = 2.0_wp**(1.0_wp/12.0_wp)

Equal temperament: https://en.wikipedia.org/wiki/Equal_temperament


Functions

public function fr(note)

Returns the frequency of the note. The note name is composed of two or three characters, for example "A4", "A#4", "Ab4", where the final character is the octave.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: note

Return Value real(kind=wp)


Subroutines

public subroutine add_broken_chord(tape, track, t1, t2, f, Amp, chord)

Writes a broken chord using an array containing the intervals (see the music_common module). It uses plucked strings (Karplus-Strong). For the moment, each note has the same duration. https://en.wikipedia.org/wiki/Arpeggio

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
real(kind=wp), intent(in) :: f
real(kind=wp), intent(in) :: Amp
integer, intent(in), dimension(:) :: chord

public subroutine add_chord(tape, track, t1, t2, f, Amp, chord, envelope)

Writes a chord using an array containing the intervals (see the music_common module)

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
real(kind=wp), intent(in) :: f
real(kind=wp), intent(in) :: Amp
integer, intent(in), dimension(:) :: chord
type(ADSR_envelope), intent(inout), optional :: envelope

public subroutine add_note(tape, track, t1, t2, f, Amp, envelope)

A note of fundamental frequency f with harmonics, based on sine waves. https://en.wikipedia.org/wiki/Harmonic

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
real(kind=wp), intent(in) :: f
real(kind=wp), intent(in) :: Amp
type(ADSR_envelope), intent(inout), optional :: envelope