add_broken_chord Subroutine

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

Calls

proc~~add_broken_chord~~CallsGraph proc~add_broken_chord add_broken_chord proc~add_karplus_strong add_karplus_strong proc~add_broken_chord->proc~add_karplus_strong

Called by

proc~~add_broken_chord~~CalledByGraph proc~add_broken_chord add_broken_chord program~arpeggios arpeggios program~arpeggios->proc~add_broken_chord

Source Code

    subroutine add_broken_chord(tape, track, t1, t2, f, Amp, chord)
        type(tape_recorder), intent(inout) :: tape
        integer, intent(in)  :: track
        real(wp), intent(in) :: t1, t2, f, Amp
        integer, dimension(:), intent(in) :: chord
        integer :: i, interval
        real(wp) :: dnote   ! duration of each note of the chord
        real(wp) :: fnote
        real(wp) :: t

        dnote = (t2-t1) / size(chord)

        t = t1
        do i = 1, size(chord)
            interval = chord(i)
            fnote = f * SEMITONE**interval
            call add_karplus_strong(tape, track, t1=t, t2=t+dnote, f=fnote, Amp=Amp)
            t = t + dnote
        end do
    end subroutine add_broken_chord