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

@ -9,6 +9,7 @@
text2wav
wav2text
text2ao
essai
panoramix
genwaves

View File

@ -4,7 +4,7 @@
GOPT = -Wall -Wextra -time -g
all: panoramix genwaves
all: panoramix genwaves essai
# ----------------------------------------------------------
#
@ -16,6 +16,10 @@ FLIBS = soundbrotch.o
soundbrotch.o: soundbrotch.f90 Makefile
gfortran $(GOPT) -c $<
# some test...
essai: essai.f90 Makefile $(FLIBS)
gfortran $(GOPT) $< $(FLIBS) -o $@
# main proggies
panoramix: panoramix.f90 Makefile $(FLIBS)
gfortran $(GOPT) $< $(FLIBS) -o $@

View File

@ -8,7 +8,7 @@ DATAFILE="waves.text"
OUTWAV="quux.wav"
./genwaves | ./panoramix | tee $DATAFILE | c-tools/text2wav $OUTWAV
./genwaves | tee $DATAFILE | c-tools/text2wav $OUTWAV
sndfile-spectrogram \
--min-freq=30 --max-freq=4000 \

21
SoundBrotching/essai.f90 Normal file
View File

@ -0,0 +1,21 @@
program essai
use soundbrotch
! -----------------------------
implicit none
integer :: n
real :: freq
write(0, *) "*** On essaye des trucs (shotgun!) ***"
call soundbrotch_version()
do n = 20, 85
freq = midi2freq(n)
write(0, '(12X, I5, 5X, F9.3)') n, freq
call sinw_burst2i(6, 22000, freq, freq, 0.9)
call silence_burst2i(800)
end do
end program

View File

@ -11,12 +11,13 @@ program genwaves
write(0, *) "*** Genwaves ***"
call soundbrotch_version()
do clock = 1, 8
do clock = 1, 11
fleft = real(100 * clock)
fright = real(150 * clock)
fright = real(116 * clock)
write(0, '(1X,I8, 9X, F8.2, 6X, F8.2)') clock, fleft, fright
call sinw_burst2i(6, 4800, fleft, fright, 0.7)
call sinw_burst2i(6, 23200, fleft, fright, 0.7)
enddo
call silence_burst2i(1337)
end program

View File

@ -21,11 +21,11 @@ program panoramix
endif
! *** NON WORKING CODE ***
phi = real(nblus) / 60000.0
phi = real(nblus) / 44100.0
ka = sin(phi)
value = (real(left)+real(right)) / 2.05
left = int(value*ka)
right = int(value*(1.0-ka))
left = int(value * ka)
right = int(value * (1.0-ka))
print *, left, right

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