forsynth.f90 Source File


Files dependent on this one

sourcefile~~forsynth.f90~~AfferentGraph sourcefile~forsynth.f90 forsynth.f90 sourcefile~all_signals.f90 all_signals.f90 sourcefile~all_signals.f90->sourcefile~forsynth.f90 sourcefile~envelopes.f90 envelopes.f90 sourcefile~all_signals.f90->sourcefile~envelopes.f90 sourcefile~music.f90 music.f90 sourcefile~all_signals.f90->sourcefile~music.f90 sourcefile~signals.f90 signals.f90 sourcefile~all_signals.f90->sourcefile~signals.f90 sourcefile~wav_file_class.f90 wav_file_class.f90 sourcefile~all_signals.f90->sourcefile~wav_file_class.f90 sourcefile~arpeggios.f90 arpeggios.f90 sourcefile~arpeggios.f90->sourcefile~forsynth.f90 sourcefile~arpeggios.f90->sourcefile~envelopes.f90 sourcefile~arpeggios.f90->sourcefile~music.f90 sourcefile~arpeggios.f90->sourcefile~signals.f90 sourcefile~arpeggios.f90->sourcefile~wav_file_class.f90 sourcefile~audio_effects.f90 audio_effects.f90 sourcefile~audio_effects.f90->sourcefile~forsynth.f90 sourcefile~tape_recorder_class.f90 tape_recorder_class.f90 sourcefile~audio_effects.f90->sourcefile~tape_recorder_class.f90 sourcefile~blues.f90 blues.f90 sourcefile~blues.f90->sourcefile~forsynth.f90 sourcefile~blues.f90->sourcefile~audio_effects.f90 sourcefile~blues.f90->sourcefile~music.f90 sourcefile~blues.f90->sourcefile~signals.f90 sourcefile~blues.f90->sourcefile~wav_file_class.f90 sourcefile~chords_and_melody.f90 chords_and_melody.f90 sourcefile~chords_and_melody.f90->sourcefile~forsynth.f90 sourcefile~chords_and_melody.f90->sourcefile~audio_effects.f90 sourcefile~chords_and_melody.f90->sourcefile~envelopes.f90 sourcefile~chords_and_melody.f90->sourcefile~music.f90 sourcefile~chords_and_melody.f90->sourcefile~signals.f90 sourcefile~chords_and_melody.f90->sourcefile~wav_file_class.f90 sourcefile~demo_effects.f90 demo_effects.f90 sourcefile~demo_effects.f90->sourcefile~forsynth.f90 sourcefile~demo_effects.f90->sourcefile~audio_effects.f90 sourcefile~demo_effects.f90->sourcefile~envelopes.f90 sourcefile~demo_effects.f90->sourcefile~music.f90 sourcefile~demo_effects.f90->sourcefile~wav_file_class.f90 sourcefile~doppler_effect.f90 doppler_effect.f90 sourcefile~doppler_effect.f90->sourcefile~forsynth.f90 sourcefile~doppler_effect.f90->sourcefile~wav_file_class.f90 sourcefile~drone_music.f90 drone_music.f90 sourcefile~drone_music.f90->sourcefile~forsynth.f90 sourcefile~drone_music.f90->sourcefile~envelopes.f90 sourcefile~drone_music.f90->sourcefile~music.f90 sourcefile~drone_music.f90->sourcefile~wav_file_class.f90 sourcefile~drum_machine.f90 drum_machine.f90 sourcefile~drum_machine.f90->sourcefile~forsynth.f90 sourcefile~drum_machine.f90->sourcefile~signals.f90 sourcefile~drum_machine.f90->sourcefile~wav_file_class.f90 sourcefile~envelopes.f90->sourcefile~forsynth.f90 sourcefile~envelopes.f90->sourcefile~tape_recorder_class.f90 sourcefile~misc_sounds.f90 misc_sounds.f90 sourcefile~misc_sounds.f90->sourcefile~forsynth.f90 sourcefile~misc_sounds.f90->sourcefile~music.f90 sourcefile~misc_sounds.f90->sourcefile~tape_recorder_class.f90 sourcefile~misc_sounds.f90->sourcefile~wav_file_class.f90 sourcefile~music.f90->sourcefile~forsynth.f90 sourcefile~music.f90->sourcefile~envelopes.f90 sourcefile~music.f90->sourcefile~signals.f90 sourcefile~music.f90->sourcefile~tape_recorder_class.f90 sourcefile~shepard_risset_glissando.f90 shepard_risset_glissando.f90 sourcefile~shepard_risset_glissando.f90->sourcefile~forsynth.f90 sourcefile~shepard_risset_glissando.f90->sourcefile~envelopes.f90 sourcefile~shepard_risset_glissando.f90->sourcefile~wav_file_class.f90 sourcefile~shepard_scale.f90 shepard_scale.f90 sourcefile~shepard_scale.f90->sourcefile~forsynth.f90 sourcefile~shepard_scale.f90->sourcefile~audio_effects.f90 sourcefile~shepard_scale.f90->sourcefile~wav_file_class.f90 sourcefile~signals.f90->sourcefile~forsynth.f90 sourcefile~signals.f90->sourcefile~envelopes.f90 sourcefile~signals.f90->sourcefile~tape_recorder_class.f90 sourcefile~tape_recorder_class.f90->sourcefile~forsynth.f90 sourcefile~wav_file_class.f90->sourcefile~forsynth.f90 sourcefile~wav_file_class.f90->sourcefile~tape_recorder_class.f90

Source Code

! Forsynth: a multitracks stereo sound synthesis project
! License GPL-3.0-or-later
! Vincent Magnin
! Last modifications: 2024-07-14

!> This module contains a few parameters, especially the sampling frequency and
!> the temporal step.
module forsynth
    use, intrinsic :: iso_fortran_env, only: INT16, INT32, INT64, REAL32, REAL64

    implicit none
    private
    !> The default working precision wp is REAL64.
    !> REAL32 can be set: it will accelerate computations and give good results
    !> most of the time. But in certain situations, for example drone music, it
    !> can introduce artefacts.
    integer, parameter  :: wp = REAL64
    real(wp), parameter :: PI = 4.0_wp * atan(1.0_wp)

    ! Sampling frequency and temporal step:
    integer, parameter  :: RATE = 44100
    real(wp), parameter :: dt = 1.0_wp / RATE

    public :: wp, test_the_machine, PI, RATE, dt

contains

    !> A WAV file contains 64, 32 and 16 bits data or metadata,
    !> so we need those kinds.
    subroutine test_the_machine
        if ((INT16 < 0) .or. (INT32 < 0) .or. (INT64 < 0)) then
            print *, "Some INT types are not supported!"
            print *, "INT16: ", INT16
            print *, "INT32: ", INT32
            print *, "INT64: ", INT64
            error stop 1
        end if
    end subroutine

end module forsynth