more debug

This commit is contained in:
tth
2022-05-23 11:11:09 +02:00
parent 0f92d09d5e
commit 67ea2613e6
7 changed files with 85 additions and 27 deletions

View File

@@ -7,12 +7,19 @@ module soundbrotch
integer :: right
end type
! ---------------------------------------------------------
! some private variables
integer, private :: samplerate = 48000
real, private :: diapason = 440.0
contains
! ---------------------------------------------------------
subroutine soundbrotch_version ()
write(0, '(1X,A)') "--- this is soundbrotch version alpha 666"
write(0, *) "--- samplerate", samplerate
write(0, *) "--- diapason ", diapason
end subroutine
! ---------------------------------------------------------
! ---------------------------------------------------------
! ---------------------------------------------------------
! premier essai, le prototype peut changer !
@@ -25,31 +32,55 @@ module soundbrotch
integer :: idx, left, right
real :: coef
integer, save :: oldl=0, oldr=0
coef = (3.141592654 * 2.0) / 44.1e3
if (dst .NE. 6) then
STOP ' OUPS!'
endif
coef = (3.141592654 * 2.0) / real(samplerate)
do idx=0, numbs
left = INT(32e3 * level * sin(coef*real(idx)*fra))
left = (left + oldl) / 2
right = INT(32e3 * level * sin(coef*real(idx)*frb))
right = (right + oldr) / 2
print *, left, right
oldl = left
oldr = right
enddo
! add silence at the end of the burst
left = 0
right = 0
do idx=0, numbs/3
left = (left + oldl) / 2
right = (right + oldr) / 2
print *, 0, 0
oldl = left
oldr = right
call xper_spit_2i(left, right)
enddo
end subroutine
! ---------------------------------------------------------
! mmmm ?
subroutine silence_burst2i(nbsmpl)
integer, intent(in) :: nbsmpl
integer :: idx
do idx=0, nbsmpl
call xper_spit_2i(0, 0)
enddo
end subroutine
! ---------------------------------------------------------
! mmmm ?
subroutine xper_spit_2i(lsmpl, rsmpl)
integer, intent(in) :: lsmpl, rsmpl
integer, save :: oldl, oldr
integer :: tmpl, tmpr
tmpl = (lsmpl + oldl) / 2
tmpr = (rsmpl + oldr) / 2
print *, tmpl, tmpr
oldl = tmpl
oldr = tmpr
end subroutine
! ---------------------------------------------------------
!
function midi2freq(note)
integer, intent(in) :: note
real :: midi2freq
real :: freq
freq = (DIAPASON/32.0) * (2.0 ** (real(note - 9) / 12.0));
! write(0, *) "> ", note, freq
midi2freq = freq
end function
end module