bad or not bad ?
This commit is contained in:
parent
fca15a210a
commit
0f92d09d5e
1
SoundBrotching/.gitignore
vendored
1
SoundBrotching/.gitignore
vendored
@ -4,6 +4,7 @@
|
||||
|
||||
*.wav
|
||||
*.text
|
||||
*.png
|
||||
|
||||
text2wav
|
||||
wav2text
|
||||
|
@ -2,7 +2,7 @@
|
||||
# tth@konrad:~/Devel/Fortraneries/SoundBrotching$
|
||||
#
|
||||
|
||||
GOPT = -Wall -Wextra -g
|
||||
GOPT = -Wall -Wextra -time -g
|
||||
|
||||
all: panoramix genwaves
|
||||
|
||||
|
@ -2,7 +2,24 @@
|
||||
|
||||
INWAV="1637.wav"
|
||||
OUTWAV="foo.wav"
|
||||
DATAFILE="waves.text"
|
||||
|
||||
./wav2text $INWAV | ./panoramix | ./text2wav $OUTWAV
|
||||
# XXX ./wav2text $INWAV | ./panoramix | ./text2wav $OUTWAV
|
||||
|
||||
OUTWAV="quux.wav"
|
||||
|
||||
./genwaves | ./panoramix | tee $DATAFILE | c-tools/text2wav $OUTWAV
|
||||
|
||||
sndfile-spectrogram \
|
||||
--min-freq=30 --max-freq=4000 \
|
||||
--hann \
|
||||
$OUTWAV \
|
||||
1200 600 \
|
||||
spectrogram.png
|
||||
|
||||
sndfile-waveform \
|
||||
-c -2 \
|
||||
-g 1200x600 \
|
||||
$OUTWAV waveform.png
|
||||
|
||||
# echo " HEAD OF DATAS" ; head $DATAFILE
|
||||
|
@ -4,8 +4,19 @@ program genwaves
|
||||
! -----------------------------
|
||||
implicit none
|
||||
|
||||
integer :: clock
|
||||
! type(t_sample2i) :: sample
|
||||
real :: fleft, fright ! frequencies
|
||||
|
||||
write(0, *) "*** Genwaves ***"
|
||||
call soundbrotch_version()
|
||||
|
||||
do clock = 1, 8
|
||||
fleft = real(100 * clock)
|
||||
fright = real(150 * clock)
|
||||
write(0, '(1X,I8, 9X, F8.2, 6X, F8.2)') clock, fleft, fright
|
||||
call sinw_burst2i(6, 4800, fleft, fright, 0.7)
|
||||
enddo
|
||||
|
||||
end program
|
||||
|
||||
|
@ -9,18 +9,19 @@ program panoramix
|
||||
integer :: nblus
|
||||
real :: value, phi, ka
|
||||
|
||||
write(0, *) "*** Panoramix ***"
|
||||
call soundbrotch_version()
|
||||
|
||||
nblus = 0
|
||||
do
|
||||
read (*, *, iostat=errcode) left, right
|
||||
if (errcode .NE. 0) then
|
||||
write(0, *) 'EOF ? ', errcode
|
||||
! write(0, *) 'EOF ? ', errcode
|
||||
exit
|
||||
endif
|
||||
|
||||
! *** NON WORKING CODE ***
|
||||
phi = real(nblus) / 20000.0
|
||||
phi = real(nblus) / 60000.0
|
||||
ka = sin(phi)
|
||||
value = (real(left)+real(right)) / 2.05
|
||||
left = int(value*ka)
|
||||
|
@ -2,24 +2,54 @@ module soundbrotch
|
||||
|
||||
implicit none
|
||||
! ---------------------------------------------------------
|
||||
type t_sample
|
||||
type t_sample2i
|
||||
integer :: left
|
||||
integer :: right
|
||||
end type
|
||||
|
||||
! ---------------------------------------------------------
|
||||
|
||||
contains
|
||||
|
||||
! ---------------------------------------------------------
|
||||
|
||||
subroutine soundbrotch_version ()
|
||||
|
||||
write(0, '(A)') "*** this is soundbrotch version alpha 666"
|
||||
|
||||
write(0, '(1X,A)') "--- this is soundbrotch version alpha 666"
|
||||
end subroutine
|
||||
|
||||
! ---------------------------------------------------------
|
||||
! premier essai, le prototype peut changer !
|
||||
|
||||
subroutine sinw_burst2i (dst, numbs, fra, frb, level)
|
||||
integer, intent(in) :: dst ! output unit number
|
||||
integer, intent(in) :: numbs ! number of sample to be made
|
||||
real, intent(in) :: fra, frb ! left and right frequency
|
||||
real, intent(in) :: level ! amplitude in [0..1]
|
||||
|
||||
integer :: idx, left, right
|
||||
real :: coef
|
||||
integer, save :: oldl=0, oldr=0
|
||||
|
||||
coef = (3.141592654 * 2.0) / 44.1e3
|
||||
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
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
|
||||
end module
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user