Compare commits
15 Commits
7d0e302e09
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c187e01bc | ||
|
|
caec2e08fe | ||
|
|
d76861a4e4 | ||
|
|
764d7343f2 | ||
|
|
dd552abeda | ||
|
|
27635a0398 | ||
|
|
eef8e7db64 | ||
|
|
09a4cb7cff | ||
|
|
f039df4fe2 | ||
|
|
e3ff6de512 | ||
|
|
cd715e902f | ||
|
|
49183e4153 | ||
|
|
3da1022e8f | ||
|
|
c32db90e10 | ||
|
|
d1b7218b21 |
@@ -7,7 +7,7 @@ all: genbloubs movebloubs exportbloubs mergebloubs \
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
GFOPT = -Wall -Wextra -g -time -I../Modules
|
GFOPT = -Wall -Wextra -g -time -I../Modules
|
||||||
OBJS = bloubspace.o povstuff.o mathstuff.o
|
OBJS = bloubspace.o povstuff.o
|
||||||
MYLIB = '../Modules/libtth90modules.a'
|
MYLIB = '../Modules/libtth90modules.a'
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@@ -37,9 +37,6 @@ bloubspace.o: bloubspace.f90 Makefile
|
|||||||
povstuff.o: povstuff.f90 Makefile
|
povstuff.o: povstuff.f90 Makefile
|
||||||
gfortran $(GFOPT) -c $<
|
gfortran $(GFOPT) -c $<
|
||||||
|
|
||||||
mathstuff.o: mathstuff.f90 Makefile
|
|
||||||
gfortran $(GFOPT) -c $<
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
genbloubs: genbloubs.f90 Makefile $(OBJS)
|
genbloubs: genbloubs.f90 Makefile $(OBJS)
|
||||||
|
|||||||
2
Fraktalism/.gitignore
vendored
2
Fraktalism/.gitignore
vendored
@@ -6,6 +6,7 @@ mkmandel
|
|||||||
voxelize
|
voxelize
|
||||||
evolvopick
|
evolvopick
|
||||||
henon
|
henon
|
||||||
|
mkhenon
|
||||||
essai
|
essai
|
||||||
plotcolmap
|
plotcolmap
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ WS/*.inc
|
|||||||
toto
|
toto
|
||||||
|
|
||||||
*.pgm
|
*.pgm
|
||||||
|
*.pnm
|
||||||
*.gif
|
*.gif
|
||||||
*.asc
|
*.asc
|
||||||
*.png
|
*.png
|
||||||
|
|||||||
@@ -38,12 +38,22 @@ plotcolmap: plotcolmap.f90 Makefile $(OBJDEP)
|
|||||||
|
|
||||||
# ---------------------------------------------
|
# ---------------------------------------------
|
||||||
|
|
||||||
|
mkjulia: mkjulia.f90 Makefile $(OBJDEP)
|
||||||
|
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||||
|
|
||||||
|
xjulia.pnm: mkjulia Makefile
|
||||||
|
./mkjulia $@ -0.204365 0.321463
|
||||||
|
|
||||||
|
# ---------------------------------------------
|
||||||
|
|
||||||
henon: henon.f90 Makefile $(OBJDEP)
|
henon: henon.f90 Makefile $(OBJDEP)
|
||||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||||
|
|
||||||
mkjulia: mkjulia.f90 Makefile $(OBJDEP)
|
mkhenon: mkhenon.f90 Makefile $(OBJDEP)
|
||||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||||
|
|
||||||
|
# ---------------------------------------------
|
||||||
|
|
||||||
pickover: pickover.f90 Makefile $(OBJDEP)
|
pickover: pickover.f90 Makefile $(OBJDEP)
|
||||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,20 @@ Voyons d'abord
|
|||||||
[une vidéo](http://la.buvette.org/fractales/f90/video.html)
|
[une vidéo](http://la.buvette.org/fractales/f90/video.html)
|
||||||
qui montre ma première expérience dans ce domaine.
|
qui montre ma première expérience dans ce domaine.
|
||||||
|
|
||||||
|
## Trucs à voir
|
||||||
|
|
||||||
|
La fractale de Julia se porte plutôt bien, mais les travaux continuent.
|
||||||
|
|
||||||
|
* [mkjuliagif.sh](mkjuliagif.sh) : fabrication de la gif animée
|
||||||
|
* [julias.f90](julias.f90) : fonctions de dessin d'une Julia
|
||||||
|
* [mkjulia.f90](mkjulia.f90) : le programme principal
|
||||||
|
|
||||||
|
**Q:** pourquoi faire la boucle en shell plutôt qu'en Fortran ?
|
||||||
|
|
||||||
|
**A:** Parce que je peux recompiler le binaire `mkjulia` pendant le
|
||||||
|
déroulement de la boucle, une manière comme une autre de faire
|
||||||
|
du *livecoding*.
|
||||||
|
|
||||||
## La technique
|
## La technique
|
||||||
|
|
||||||
Le gros des calculs de fractales est fait dans `mods/fraktals.f90`,
|
Le gros des calculs de fractales est fait dans `mods/fraktals.f90`,
|
||||||
@@ -34,7 +48,7 @@ Generally writen as a *sequencial unformated* file.
|
|||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- Voir de près le calcul du cadrage
|
- Voir de près le calcul du cadrage : [centermag](../Modules/centermag.f90)
|
||||||
- Rajouter des formules
|
- Rajouter des formules
|
||||||
- Ne pas procastiner sur le reste
|
- Ne pas procastiner sur le reste
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ TITLE='---{ experimental }---'
|
|||||||
|
|
||||||
ffmpeg -nostdin \
|
ffmpeg -nostdin \
|
||||||
-loglevel warning \
|
-loglevel warning \
|
||||||
-y -r 30 -f image2 -i $SDIR/%05d.pnm \
|
-y -r 30 -f image2 -i $SDIR/%05d.png \
|
||||||
-metadata artist='---{ tTh }---' \
|
-metadata artist='---{ tTh }---' \
|
||||||
-metadata title="${TITLE}" \
|
-metadata title="${TITLE}" \
|
||||||
-preset veryslow \
|
-preset veryslow \
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ subroutine interp4dp (ina, inb, out, dpk)
|
|||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
!-----------------------------------------------------------
|
!-----------------------------------------------------------
|
||||||
|
!-
|
||||||
|
|
||||||
function dist0 (x, y)
|
function dist0 (x, y)
|
||||||
implicit none
|
implicit none
|
||||||
@@ -146,6 +147,8 @@ function dist0 (x, y)
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
!-----------------------------------------------------------
|
!-----------------------------------------------------------
|
||||||
|
!-
|
||||||
|
|
||||||
function modulus2(pt)
|
function modulus2(pt)
|
||||||
implicit none
|
implicit none
|
||||||
complex, intent(in) :: pt
|
complex, intent(in) :: pt
|
||||||
|
|||||||
@@ -1,31 +1,10 @@
|
|||||||
program henon
|
module henon
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
contains
|
||||||
integer :: passe
|
|
||||||
double precision :: vx, vy
|
|
||||||
|
|
||||||
integer :: w, h
|
|
||||||
integer :: foo, bar
|
|
||||||
double precision :: px, py
|
|
||||||
w = 2000 ; h = 1600
|
|
||||||
|
|
||||||
write(0, *) "###### Mapping of Henon "
|
|
||||||
|
|
||||||
do foo=1, 16
|
|
||||||
px = dble(foo) / 16.0
|
|
||||||
do bar=1,16
|
|
||||||
py = dble(bar) / 16.0
|
|
||||||
call compute_pixel_henon(px, py, 1700, &
|
|
||||||
passe, dble(0.5), vx, vy)
|
|
||||||
write(0, fmt=*) "passe ", passe, vx, vy
|
|
||||||
enddo
|
|
||||||
end do
|
|
||||||
|
|
||||||
!-----------------------------------------------------
|
!-----------------------------------------------------
|
||||||
contains
|
|
||||||
!-----------------------------------------------------
|
|
||||||
!-----------------------------------------------------
|
|
||||||
subroutine compute_pixel_henon(a, b, maxpasse, passe, limit, rx, ry)
|
subroutine compute_pixel_henon(a, b, maxpasse, passe, limit, rx, ry)
|
||||||
implicit none
|
implicit none
|
||||||
double precision, intent(in) :: a, b, limit
|
double precision, intent(in) :: a, b, limit
|
||||||
@@ -62,5 +41,5 @@ end subroutine
|
|||||||
|
|
||||||
!-----------------------------------------------------
|
!-----------------------------------------------------
|
||||||
|
|
||||||
end program
|
end module
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
module julias
|
module julias
|
||||||
|
|
||||||
|
use fraktals
|
||||||
implicit none
|
implicit none
|
||||||
contains
|
contains
|
||||||
|
|
||||||
@@ -42,37 +44,47 @@ subroutine simple_julia(pic, cx, cy, maxiter)
|
|||||||
if (over_iter) then
|
if (over_iter) then
|
||||||
pic(ix, iy) = 0
|
pic(ix, iy) = 0
|
||||||
else
|
else
|
||||||
pic(ix, iy) = iter*12
|
pic(ix, iy) = mod(iter*13, 256)
|
||||||
endif
|
endif
|
||||||
enddo ! iy
|
enddo ! iy
|
||||||
enddo ! ix
|
enddo ! ix
|
||||||
|
|
||||||
end subroutine simple_julia
|
end subroutine simple_julia
|
||||||
!===============================================================
|
!===============================================================
|
||||||
subroutine julia_colormapped(pic, cx, cy, maxiter)
|
!-
|
||||||
|
! this code is nor really finished
|
||||||
|
!-
|
||||||
|
subroutine julia_colormapped(pic, cx, cy, mag, maxiter)
|
||||||
use pixrgb
|
use pixrgb
|
||||||
type(t_pixrgb), intent(inout), dimension (:,:) :: pic
|
type(t_pixrgb), intent(inout), dimension (:,:) :: pic
|
||||||
real, intent(in) :: cx, cy
|
real, intent(in) :: cx, cy, mag
|
||||||
integer, intent(in) :: maxiter
|
integer, intent(in) :: maxiter
|
||||||
|
|
||||||
integer :: ix, iy, width, height
|
integer :: ix, iy, width, height, iter
|
||||||
real :: fx, fy
|
real :: fx, fy, div, off
|
||||||
complex :: Z, C
|
complex :: Z, C
|
||||||
integer :: iter
|
|
||||||
logical :: over_iter
|
logical :: over_iter
|
||||||
|
integer :: under, over
|
||||||
|
|
||||||
|
pic = t_pixrgb(0, 0, 0)
|
||||||
|
|
||||||
width = ubound(pic, 1)
|
width = ubound(pic, 1)
|
||||||
height = ubound(pic, 2)
|
height = ubound(pic, 2)
|
||||||
C = complex(cx, cy)
|
C = complex(cx, cy)
|
||||||
print *, "Color julia, const = ", C
|
|
||||||
|
div = mag * 10.0 ; off = mag * 2.5
|
||||||
|
under = 0 ; over = 0
|
||||||
|
print *, "mag:", mag, " -> ", div, off
|
||||||
|
|
||||||
|
! print *, "Color julia, const = ", C
|
||||||
do ix = 1, width
|
do ix = 1, width
|
||||||
fx = (float(ix) / (float(width*2)/4.0) - 1.0)
|
fx = (float(ix) / (float(width*2)/div) - off)
|
||||||
do iy = 1, height
|
do iy = 1, height
|
||||||
fy = (float(iy) / (float(height*2)/4.0) - 1.0)
|
fy = (float(iy) / (float(height*2)/div) - off)
|
||||||
! ------ traitement du pixel
|
! ------ traitement du pixel
|
||||||
iter = 0 ; over_iter = .FALSE.
|
iter = 0 ; over_iter = .FALSE.
|
||||||
Z = complex(fx, fy)
|
Z = complex(fx, fy)
|
||||||
do while ((real(Z)*real(Z) + imag(Z)*imag(Z)) .LT. 4.0)
|
do while ((real(Z)*real(Z) + (imag(Z)*imag(Z))) .LT. 4.0)
|
||||||
Z = (Z * Z) + C
|
Z = (Z * Z) + C
|
||||||
iter = iter + 1
|
iter = iter + 1
|
||||||
if (iter .GE. maxiter) then
|
if (iter .GE. maxiter) then
|
||||||
@@ -81,17 +93,22 @@ subroutine julia_colormapped(pic, cx, cy, maxiter)
|
|||||||
endif
|
endif
|
||||||
end do
|
end do
|
||||||
if (over_iter) then
|
if (over_iter) then
|
||||||
pic(ix, iy)%r = 0
|
pic(ix, iy)%r = mod(int(modulus2(Z)*2000.0), 255)
|
||||||
pic(ix, iy)%g = mod(abs(int(real(Z) *140)), 255)
|
pic(ix, iy)%g = mod(abs(int(real(Z) *11.0)), 255)
|
||||||
pic(ix, iy)%b = mod(abs(int(aimag(Z)*140)), 255)
|
pic(ix, iy)%b = mod(abs(int(aimag(Z)*11.0)), 255)
|
||||||
|
print *, ix, iy, Z, modulus2(Z)
|
||||||
|
over = over + 1
|
||||||
else
|
else
|
||||||
pic(ix, iy)%r = mod(iter*33, 255)
|
pic(ix, iy)%r = mod(iter*11, 255)
|
||||||
pic(ix, iy)%g = mod(iter*59, 255)
|
pic(ix, iy)%g = mod(iter*14, 255)
|
||||||
pic(ix, iy)%b = mod(iter*41, 255)
|
pic(ix, iy)%b = mod(iter*17, 255)
|
||||||
|
under = under + 1
|
||||||
endif
|
endif
|
||||||
enddo ! iy
|
enddo ! iy
|
||||||
enddo ! ix
|
enddo ! ix
|
||||||
|
|
||||||
|
print *, "under", under, "over", over
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
!===============================================================
|
!===============================================================
|
||||||
end module
|
end module
|
||||||
|
|||||||
27
Fraktalism/mkhenon.f90
Normal file
27
Fraktalism/mkhenon.f90
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
program henon
|
||||||
|
|
||||||
|
use PIXRGB
|
||||||
|
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
type(t_pixrgb), allocatable :: picz(:,:)
|
||||||
|
integer :: argc
|
||||||
|
character(200) :: filename, string
|
||||||
|
real :: cx, cy
|
||||||
|
|
||||||
|
argc = IARGC()
|
||||||
|
if (3 .NE. argc) then
|
||||||
|
STOP ": MKHENON PROGGY NEED 3 PARAMETERS !"
|
||||||
|
endif
|
||||||
|
|
||||||
|
call getarg(1, filename)
|
||||||
|
call getarg(2, string) ; read (string, *) cx
|
||||||
|
call getarg(3, string) ; read (string, *) cy
|
||||||
|
|
||||||
|
allocate(picz(1280, 1024))
|
||||||
|
|
||||||
|
call rgbpix_spit_as_pnm_8(picz, trim(filename))
|
||||||
|
|
||||||
|
!-----------------------------------------------------
|
||||||
|
|
||||||
|
end program
|
||||||
@@ -26,11 +26,15 @@ program julia
|
|||||||
call getarg(2, string) ; read (string, *) cx
|
call getarg(2, string) ; read (string, *) cx
|
||||||
call getarg(3, string) ; read (string, *) cy
|
call getarg(3, string) ; read (string, *) cy
|
||||||
|
|
||||||
allocate(picz(512, 342))
|
allocate(picz(1280, 1024))
|
||||||
|
|
||||||
call julia_colormapped(picz, cx, cy, 500)
|
call julia_colormapped(picz, cx, cy, 0.600, 1000)
|
||||||
call rgbpix_spit_as_pnm_8(picz, trim(filename))
|
call rgbpix_spit_as_pnm_8(picz, trim(filename))
|
||||||
|
|
||||||
|
contains
|
||||||
|
|
||||||
|
!-----------------------------------------------------
|
||||||
|
|
||||||
end program
|
end program
|
||||||
|
|
||||||
!-----------------------------------------------------
|
!-----------------------------------------------------
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# build the prog
|
# build the prog
|
||||||
#
|
#
|
||||||
|
|
||||||
make mkjulia
|
make mkjulia
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo
|
echo
|
||||||
@@ -11,28 +10,52 @@ if [ $? -ne 0 ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cxa=" -1.5432 " ; cya=" -0.8999 "
|
||||||
|
cxb=" 1.0975 " ; cyb=" 1.5091 "
|
||||||
|
nbi=" 2000 "
|
||||||
|
tmpimg="/dev/shm/juliatmp.pnm"
|
||||||
|
|
||||||
|
rm frames/julia/*
|
||||||
|
|
||||||
#
|
#
|
||||||
# run the prog
|
# run the prog
|
||||||
#
|
#
|
||||||
workdir="frames/julia/"
|
workdir="frames/julia/"
|
||||||
for foo in $(seq 0 179)
|
for foo in $( seq 0 $(( nbi - 1)) )
|
||||||
do
|
do
|
||||||
|
Ka=$( echo "$foo / $nbi" | bc -l)
|
||||||
|
Kb=$( echo "1.0 - $Ka" | bc -l)
|
||||||
|
# echo $Ka $Kb
|
||||||
|
cx=$(echo "($cxa*$Ka) + ($cxb*$Kb)" | bc -l)
|
||||||
|
cy=$(echo "$cya*$Ka + $cyb*$Kb" | bc -l)
|
||||||
|
|
||||||
img=$(printf "%s/%05d.pnm" $workdir $foo)
|
# make mkjulia
|
||||||
bar=$(echo "$foo / 247.0" | bc -l)
|
|
||||||
cx=$(echo "0.5 * (1.52*c($foo/28.0))" | bc -l)
|
|
||||||
cy=$(echo "0.5 * (1.45*s($foo/17.0))" | bc -l)
|
|
||||||
|
|
||||||
./mkjulia $img $cx $cy
|
printf "%5d %4.6f %4.6f %4.6f %4.6f\n" \
|
||||||
|
$foo $Ka $Kb $cx $cy
|
||||||
|
./mkjulia $tmpimg $cx $cy
|
||||||
|
echo
|
||||||
|
|
||||||
sleep 145
|
img=$(printf "%s/%05d.png" $workdir $foo)
|
||||||
|
tcx=$(printf "%8.6f" $cx)
|
||||||
|
tcy=$(printf "%8.6f" $cy)
|
||||||
|
|
||||||
|
convert $tmpimg \
|
||||||
|
-gravity North-East \
|
||||||
|
-font Courier-Bold \
|
||||||
|
-pointsize 20 \
|
||||||
|
-fill Yellow \
|
||||||
|
-annotate +15+34 $tcx \
|
||||||
|
-annotate +15+58 $tcy \
|
||||||
|
-gravity South-East \
|
||||||
|
-font Courier \
|
||||||
|
-pointsize 14 \
|
||||||
|
-fill Yellow \
|
||||||
|
-annotate +10+6 "Konrad+tTh 2024" \
|
||||||
|
$img
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
./tagpicz.sh $workdir
|
|
||||||
|
|
||||||
echo ; echo "Encoding, please wait..."
|
echo ; echo "Encoding, please wait..."
|
||||||
|
|
||||||
convert -delay 10 $workdir/*.pnm color-julia.gif
|
./encode.sh frames/julia/ foo.mp4
|
||||||
# animate foo.gif &
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ do
|
|||||||
|
|
||||||
mogrify \
|
mogrify \
|
||||||
-gravity South-East \
|
-gravity South-East \
|
||||||
-font Courier \
|
-font Courier-Bold \
|
||||||
-pointsize 12 \
|
-pointsize 12 \
|
||||||
-fill firebrick \
|
-fill Black \
|
||||||
-annotate +10+10 "Konrad+tTh 2023" \
|
-annotate +10+4 "Konrad+tTh 2024" \
|
||||||
$img
|
$img
|
||||||
echo "tagging " $img
|
echo "tagging " $img
|
||||||
|
|
||||||
|
|||||||
2
GrafAnim/.gitignore
vendored
2
GrafAnim/.gitignore
vendored
@@ -6,6 +6,7 @@ trigofest
|
|||||||
noisepic
|
noisepic
|
||||||
geowaves
|
geowaves
|
||||||
soundscope
|
soundscope
|
||||||
|
readpicz
|
||||||
|
|
||||||
*.scratch
|
*.scratch
|
||||||
*.genplot
|
*.genplot
|
||||||
@@ -16,4 +17,5 @@ F/*.tga
|
|||||||
*.pgm
|
*.pgm
|
||||||
*.data
|
*.data
|
||||||
*.png
|
*.png
|
||||||
|
log.txt
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,7 @@ trigofest: trigofest.f90 Makefile vue3axes.o utils_ga.o
|
|||||||
gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@
|
gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@
|
||||||
|
|
||||||
noisepic: noisepic.f90 Makefile
|
noisepic: noisepic.f90 Makefile
|
||||||
gfortran $(GFOPT) $< $(MYLIB) \
|
gfortran $(GFOPT) $< $(MYLIB) -o $@
|
||||||
-o $@
|
|
||||||
|
|
||||||
# ---- bienvenue dans le monde applicatif
|
|
||||||
|
|
||||||
wavmetrics.o: wavmetrics.f90 Makefile
|
wavmetrics.o: wavmetrics.f90 Makefile
|
||||||
gfortran $(GFOPT) -c $<
|
gfortran $(GFOPT) -c $<
|
||||||
@@ -35,6 +32,9 @@ wavmetrics.o: wavmetrics.f90 Makefile
|
|||||||
soundscope: soundscope.f90 Makefile utils_ga.o
|
soundscope: soundscope.f90 Makefile utils_ga.o
|
||||||
gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@
|
gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@
|
||||||
|
|
||||||
|
readpicz: readpicz.f90 Makefile utils_ga.o
|
||||||
|
gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@
|
||||||
|
|
||||||
# ---- modules locaux ----
|
# ---- modules locaux ----
|
||||||
|
|
||||||
usegenplot.o: usegenplot.f90 Makefile
|
usegenplot.o: usegenplot.f90 Makefile
|
||||||
|
|||||||
@@ -3,12 +3,16 @@
|
|||||||
Quelques essais approximatifs pour faire des graphiques inutiles,
|
Quelques essais approximatifs pour faire des graphiques inutiles,
|
||||||
dans une démarche mettant en avant la
|
dans une démarche mettant en avant la
|
||||||
[techno-futilité](https://wiki.interhacker.space/index.php?title=Techno-futilit%C3%A9),
|
[techno-futilité](https://wiki.interhacker.space/index.php?title=Techno-futilit%C3%A9),
|
||||||
une notion bien définie par le collectif Interhack.
|
une notion bien définie par le collectif **Interhack**.
|
||||||
|
|
||||||
Actuellement, certains des logiciels que vous voyez ici utilisent un backend
|
Actuellement, certains des logiciels que vous voyez ici utilisent un backend graphique brassé
|
||||||
graphique brassé à la maison et nommé `genplot2`. Hélas, celui-ci est
|
[à la maison](https://git.tetalab.org/tTh/libtthimage)
|
||||||
|
et nommé `genplot2`. Hélas, celui-ci est
|
||||||
un peu foireux sur les tracés de ligne...
|
un peu foireux sur les tracés de ligne...
|
||||||
|
|
||||||
|
## geowaves
|
||||||
|
|
||||||
|
Une idée en l'air, probablement...
|
||||||
|
|
||||||
## trigofest
|
## trigofest
|
||||||
|
|
||||||
@@ -20,15 +24,11 @@ que c'est d'la balle !
|
|||||||
|
|
||||||
Ou comment dessiner des gaussiennes en jetant des dés.
|
Ou comment dessiner des gaussiennes en jetant des dés.
|
||||||
|
|
||||||
## vue3axes
|
|
||||||
|
|
||||||
Un module assez spécialisé.
|
|
||||||
|
|
||||||
## soundscope
|
## soundscope
|
||||||
|
|
||||||
Retranscription en image de type oscilloscope d'un fichier son.
|
Une tentative de retranscription en image de type oscilloscope/vumètre d'un fichier son.
|
||||||
Le code source ([soundscope.f90](soundscope.f90)) est encore
|
Les codes source du proggy ([soundscope.f90](soundscope.f90)) et du
|
||||||
bien gore.
|
[module](utils_ga.f90) associé sont encore bien *gore*.
|
||||||
|
|
||||||
Pour convertir le son en données exploitables, il faut utiliser ce [bout de code](../SoundBrotching/c-tools/text2wav.c). Certaines fonctions utilisée par ce logiciel sont dans [utils_ga.f90](utils_ga.f90)
|
Pour convertir le son en données exploitables, il faut utiliser ce [bout de code](../SoundBrotching/c-tools/text2wav.c). Certaines fonctions utilisée par ce logiciel sont dans [utils_ga.f90](utils_ga.f90)
|
||||||
pour la partie dessin.
|
pour la partie dessin.
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
program essai
|
program essai
|
||||||
|
|
||||||
|
! *******************************************
|
||||||
|
! CE TRUC NE MARCHE PAS /O\
|
||||||
|
! *******************************************
|
||||||
|
|
||||||
use pixrgb
|
use pixrgb
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
@@ -60,6 +64,7 @@ subroutine setpixel(pic, x, y)
|
|||||||
.and. &
|
.and. &
|
||||||
(iy .gt. lbound(pic, 2)) .and. (iy .lt. ubound(pic, 2)) ) &
|
(iy .gt. lbound(pic, 2)) .and. (iy .lt. ubound(pic, 2)) ) &
|
||||||
then
|
then
|
||||||
|
pix(ix, iy)%r = 0
|
||||||
pic(ix, iy)%g = 65000
|
pic(ix, iy)%g = 65000
|
||||||
pic(ix, iy)%b = 20000
|
pic(ix, iy)%b = 20000
|
||||||
else
|
else
|
||||||
|
|||||||
35
GrafAnim/geowaves.f90
Normal file
35
GrafAnim/geowaves.f90
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
! *******************************************
|
||||||
|
!
|
||||||
|
! *******************************************
|
||||||
|
|
||||||
|
program geowaves
|
||||||
|
|
||||||
|
use pixrgb
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
integer :: width = 640
|
||||||
|
integer :: height = 480
|
||||||
|
integer :: marge = 10
|
||||||
|
type(t_pixrgb), allocatable :: pix(:,:)
|
||||||
|
integer :: x, y, h
|
||||||
|
real :: dist
|
||||||
|
|
||||||
|
allocate(pix(width, height))
|
||||||
|
|
||||||
|
do x=marge, width-marge
|
||||||
|
|
||||||
|
! write (0, *) " Y =", y
|
||||||
|
|
||||||
|
do y=marge, height-marge, 5
|
||||||
|
|
||||||
|
print *, x, y
|
||||||
|
pix(x, y)%g = 30000
|
||||||
|
|
||||||
|
enddo
|
||||||
|
|
||||||
|
enddo
|
||||||
|
|
||||||
|
call rgbpix_spit_as_pnm_16(pix, "foo.pnm")
|
||||||
|
|
||||||
|
end program geowaves
|
||||||
|
|
||||||
59
GrafAnim/readpicz.f90
Normal file
59
GrafAnim/readpicz.f90
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
program readpicz
|
||||||
|
|
||||||
|
use pixrgb
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
integer :: nbarg
|
||||||
|
integer :: param0 = 10
|
||||||
|
character(len=256) :: arg
|
||||||
|
|
||||||
|
! integer :: foo, bar
|
||||||
|
|
||||||
|
integer :: width = 640
|
||||||
|
integer :: height = 480
|
||||||
|
integer :: x, y, r, g, b
|
||||||
|
integer :: errcode
|
||||||
|
character (len=280) :: filename
|
||||||
|
type(t_pixrgb), allocatable :: pix(:,:)
|
||||||
|
|
||||||
|
filename = "out.pnm"
|
||||||
|
|
||||||
|
nbarg = IARGC()
|
||||||
|
if (nbarg .GT. 0) then
|
||||||
|
call GETARG(1, arg)
|
||||||
|
! write (0, '(A40, A5)') "argument = ", arg
|
||||||
|
read (arg, *) param0
|
||||||
|
endif
|
||||||
|
|
||||||
|
allocate(pix(width, height))
|
||||||
|
|
||||||
|
do
|
||||||
|
!----- get a pixel
|
||||||
|
read(5, *, iostat=errcode) x, y, r, g, b
|
||||||
|
! print *, x, y
|
||||||
|
if (0 .NE. errcode) then
|
||||||
|
write(0, *) "iostat", errcode
|
||||||
|
exit
|
||||||
|
endif
|
||||||
|
if (mod(y, 2) .EQ. 1) then
|
||||||
|
pix(x+1, y+1)%r = g * 200
|
||||||
|
pix(x+1, y+1)%g = b * 200
|
||||||
|
pix(x+1, y+1)%b = r * 200
|
||||||
|
else
|
||||||
|
pix(x+1, y+1)%r = g * 200
|
||||||
|
pix(x+1, y+1)%g = r * 200
|
||||||
|
pix(x+1, y+1)%b = b * 200
|
||||||
|
endif
|
||||||
|
|
||||||
|
enddo
|
||||||
|
|
||||||
|
call rgbpix_spit_as_pnm_16(pix, trim(filename))
|
||||||
|
|
||||||
|
contains
|
||||||
|
! ----------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
! ----------------------------------------------------------
|
||||||
|
|
||||||
|
end program
|
||||||
|
|
||||||
@@ -9,11 +9,13 @@ program soundscope
|
|||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer :: width = 720
|
integer :: width = 800
|
||||||
integer :: height = 576
|
integer :: height = 600
|
||||||
integer :: marge = 32
|
integer :: marge = 32
|
||||||
integer :: samplerate = 44100
|
integer :: samplerate = 44100
|
||||||
integer :: framerate = 30
|
integer :: framerate = 30
|
||||||
|
|
||||||
|
integer, parameter :: overtrig = 25200
|
||||||
|
|
||||||
type(t_pixrgb), allocatable :: pix(:,:)
|
type(t_pixrgb), allocatable :: pix(:,:)
|
||||||
character (len=280) :: filename
|
character (len=280) :: filename
|
||||||
@@ -21,11 +23,14 @@ program soundscope
|
|||||||
integer :: smppf
|
integer :: smppf
|
||||||
logical :: flagdone
|
logical :: flagdone
|
||||||
|
|
||||||
|
|
||||||
smppf = samplerate / framerate
|
smppf = samplerate / framerate
|
||||||
|
write(0, *) "sample rate = ", samplerate
|
||||||
|
write(0, *) "frames per second = ", framerate
|
||||||
|
write(0, *) "samples per frame = ", smppf
|
||||||
|
|
||||||
|
|
||||||
allocate(pix(width, height))
|
allocate(pix(width, height))
|
||||||
call fill_random_gauss(pix, 65000, marge)
|
! call fill_random_gauss(pix, 65000, marge)
|
||||||
|
|
||||||
iter = 0
|
iter = 0
|
||||||
do
|
do
|
||||||
@@ -46,13 +51,19 @@ program soundscope
|
|||||||
enddo
|
enddo
|
||||||
|
|
||||||
call dim_pix_rgb_mul(pix, 0.86)
|
call dim_pix_rgb_mul(pix, 0.86)
|
||||||
if (mod(iter, 180) .LT. 90) then
|
|
||||||
call make_a_frame_dplot(pix, smppf, flagdone)
|
|
||||||
else
|
|
||||||
call make_a_frame_xy(pix, smppf, flagdone)
|
|
||||||
endif
|
|
||||||
|
|
||||||
call dessine_cadre(pix, 65000, 65000, 65000, marge)
|
foo = mod(iter/36, 3)
|
||||||
|
! print *, iter, " --> ", foo
|
||||||
|
select case(foo)
|
||||||
|
case(0)
|
||||||
|
call make_a_frame_xy(pix, smppf, flagdone)
|
||||||
|
case(1)
|
||||||
|
call make_a_frame_bargraph(pix, smppf, flagdone)
|
||||||
|
case(2)
|
||||||
|
call make_a_frame_dplot(pix, smppf, flagdone)
|
||||||
|
end select
|
||||||
|
|
||||||
|
call dessine_cadre(pix, 51000, 65000, 51000, marge)
|
||||||
write (filename, "(a,i5.5,a)") "./F/np/", iter, ".pnm"
|
write (filename, "(a,i5.5,a)") "./F/np/", iter, ".pnm"
|
||||||
call rgbpix_spit_as_pnm_16(pix, filename)
|
call rgbpix_spit_as_pnm_16(pix, filename)
|
||||||
|
|
||||||
@@ -60,13 +71,17 @@ program soundscope
|
|||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if (iter .EQ. 360) exit
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
write(0, *) " [done]"
|
write(0, *) " [done]"
|
||||||
|
|
||||||
contains
|
contains
|
||||||
!-- ------------------------------------------------------------------
|
!-- ------------------------------------------------------------------
|
||||||
!--
|
!-
|
||||||
|
! This is the classic Lissajou
|
||||||
|
!-
|
||||||
|
|
||||||
subroutine make_a_frame_xy(image, nbdata, jobdone)
|
subroutine make_a_frame_xy(image, nbdata, jobdone)
|
||||||
type(t_pixrgb), intent(inout) :: image(:,:)
|
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||||
@@ -88,15 +103,16 @@ subroutine make_a_frame_xy(image, nbdata, jobdone)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
! add flash !
|
! add flash !
|
||||||
if ( (idx .LT. 100) .AND. &
|
if ( (idx .LT. 50) .AND. &
|
||||||
((abs(vl).GT.21000).OR.(abs(vr).GT.21000)) ) then
|
((abs(vl).GT.overtrig).OR.(abs(vr).GT.overtrig)) ) then
|
||||||
write(0,*) "overshoot!"
|
write(0,*) "overshoot in xy!"
|
||||||
call fill_random_gauss(image, 65000, marge)
|
call fill_random_gauss(image, 65000, marge)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! scale it to the window
|
! scale it to the window
|
||||||
ix = width - ((2 * int(vl / 111.111)) + 400)
|
ix = int((vl/65536.9) * real(width)) + width/2
|
||||||
iy = (2 * int(vr / 166.666)) + 300
|
ix = width - ix
|
||||||
|
iy = int((vr/65536.9) * real(height)) + height/2
|
||||||
if (is_pixel_inside(ix, iy)) then
|
if (is_pixel_inside(ix, iy)) then
|
||||||
call make_big_dot(image, ix, iy)
|
call make_big_dot(image, ix, iy)
|
||||||
endif
|
endif
|
||||||
@@ -105,9 +121,73 @@ subroutine make_a_frame_xy(image, nbdata, jobdone)
|
|||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
!-- ------------------------------------------------------------------
|
!-- ------------------------------------------------------------------
|
||||||
!-- ------------------------------------------------------------------
|
! new: Sat Jan 6 00:04:23 UTC 2024
|
||||||
!--
|
!-
|
||||||
|
! TODO bien calculer la largeur et la position des vumetres !
|
||||||
|
!-
|
||||||
|
! Largeur utile : largeur ecran moins deux fois la marge
|
||||||
|
|
||||||
|
subroutine make_a_frame_bargraph(image, nbdata, jobdone)
|
||||||
|
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||||
|
integer, intent(in) :: nbdata
|
||||||
|
logical, intent(out) :: jobdone
|
||||||
|
integer :: idx, errcode
|
||||||
|
integer :: ir, il, foo
|
||||||
|
integer :: sigma_l, sigma_r
|
||||||
|
integer :: largutil, haututil, xpos, ypos
|
||||||
|
|
||||||
|
sigma_l = 0
|
||||||
|
sigma_r = 0
|
||||||
|
|
||||||
|
do idx=0, nbdata
|
||||||
|
! get a sample
|
||||||
|
read(5, *, iostat=errcode) il, ir
|
||||||
|
if (0 .NE. errcode) then
|
||||||
|
write(0, *) "iostat =", errcode
|
||||||
|
jobdone = .TRUE.
|
||||||
|
exit
|
||||||
|
endif
|
||||||
|
sigma_l = sigma_l + abs(il)
|
||||||
|
sigma_r = sigma_r + abs(ir)
|
||||||
|
enddo
|
||||||
|
! ici on a lu tous les samples, on a la somme des abs()
|
||||||
|
write(0, *) "sigmas = ", sigma_l, sigma_r
|
||||||
|
il = sigma_l / nbdata
|
||||||
|
ir = sigma_r / nbdata
|
||||||
|
|
||||||
|
call clear_image(image, marge)
|
||||||
|
|
||||||
|
! il ne reste plus qu'à tracer la barre.
|
||||||
|
largutil = width - (marge*2)
|
||||||
|
haututil = height - (marge*2)
|
||||||
|
ypos = marge + ((il*haututil) / 32768 )
|
||||||
|
! write(0, *) "ypos = ", ypos
|
||||||
|
do xpos=1, largutil
|
||||||
|
! write(0, *) " xpos", xpos
|
||||||
|
call make_big_dot(image, xpos, ypos)
|
||||||
|
enddo
|
||||||
|
ypos = marge + ((il*haututil) / 32768 )
|
||||||
|
write(0, *) "ypos = ", ypos
|
||||||
|
do xpos=(width/2)+8, width - (marge + 8)
|
||||||
|
write(0, *) " xpos", xpos
|
||||||
|
call make_big_dot(image, xpos, ypos)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
! et ma fin de la trace : une séparation au milieu.
|
||||||
|
do foo=marge+9, height-(marge+9)
|
||||||
|
image(width/2, foo - 9)%r = 65500
|
||||||
|
image(width/2, foo - 4)%r = 65500
|
||||||
|
image(width/2, foo )%r = 65500
|
||||||
|
image(width/2, foo + 4)%r = 65500
|
||||||
|
image(width/2, foo + 9)%r = 65500
|
||||||
|
enddo
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
|
||||||
|
!-- ------------------------------------------------------------------
|
||||||
|
!-
|
||||||
|
! THIS SUBROUTINE IS BOGUS !
|
||||||
|
!-
|
||||||
subroutine make_a_frame_dplot(image, nbdata, jobdone)
|
subroutine make_a_frame_dplot(image, nbdata, jobdone)
|
||||||
type(t_pixrgb), intent(inout) :: image(:,:)
|
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||||
integer, intent(in) :: nbdata
|
integer, intent(in) :: nbdata
|
||||||
@@ -129,8 +209,8 @@ subroutine make_a_frame_dplot(image, nbdata, jobdone)
|
|||||||
endif
|
endif
|
||||||
! add flash !
|
! add flash !
|
||||||
if ( (idx .LT. 100) .AND. &
|
if ( (idx .LT. 100) .AND. &
|
||||||
((abs(vl).GT.21000).OR.(abs(vr).GT.21000)) ) then
|
((abs(vl).GT.overtrig).OR.(abs(vr).GT.overtrig)) ) then
|
||||||
write(0,*) "overshoot!"
|
write(0,*) "overshoot in dplot!"
|
||||||
call fill_random_gauss(image, 65000, marge)
|
call fill_random_gauss(image, 65000, marge)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -183,7 +263,7 @@ subroutine dessine_cadre(image, R, G, B, border)
|
|||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
!-- ------------------------------------------------------------------
|
!-- ------------------------------------------------------------------
|
||||||
|
!-- ------------------------------------------------------------------
|
||||||
function is_pixel_inside(ix, iy)
|
function is_pixel_inside(ix, iy)
|
||||||
integer,intent(in) :: ix, iy
|
integer,intent(in) :: ix, iy
|
||||||
logical :: is_pixel_inside
|
logical :: is_pixel_inside
|
||||||
@@ -200,8 +280,6 @@ function is_pixel_inside(ix, iy)
|
|||||||
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
!-- ------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
!-- ------------------------------------------------------------------
|
!-- ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
7
GrafAnim/t_readpicz.sh
Executable file
7
GrafAnim/t_readpicz.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
tga_mires mircol0 mire.tga "Fortran Moderne"
|
||||||
|
|
||||||
|
tga_to_text foo.tga | ./readpicz
|
||||||
|
|
||||||
|
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
! -------------------------------------------------------------------
|
! -------------------------------------------------------------------
|
||||||
|
|
||||||
module utils_ga
|
module utils_ga
|
||||||
|
|
||||||
use pixrgb
|
use pixrgb
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
@@ -33,7 +34,25 @@ subroutine increment_pixel(pix, k)
|
|||||||
type(t_pixrgb), intent(inout) :: pix
|
type(t_pixrgb), intent(inout) :: pix
|
||||||
integer :: k
|
integer :: k
|
||||||
|
|
||||||
|
pix%r = pix%r + k
|
||||||
|
pix%g = pix%g + k
|
||||||
|
pix%b = pix%b + k
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
! -------------------------------------------------------------------
|
||||||
|
subroutine make_bar_dot(image, ix, iy)
|
||||||
|
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||||
|
integer, intent(in) :: ix, iy
|
||||||
|
integer :: foo
|
||||||
|
|
||||||
|
do foo=-1, 1
|
||||||
|
image(ix+foo, iy)%r = 45000
|
||||||
|
image(ix+foo, iy)%g = 5000
|
||||||
|
image(ix+foo, iy)%b = 45000
|
||||||
|
enddo
|
||||||
|
image(ix-2, iy)%g = 45000
|
||||||
|
image(ix , iy)%g = 65500
|
||||||
|
image(ix+2, iy)%g = 45000
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
! -------------------------------------------------------------------
|
! -------------------------------------------------------------------
|
||||||
@@ -104,6 +123,25 @@ subroutine dim_pix_rgb_sub(pix, k)
|
|||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
! -------------------------------------------------------------------
|
||||||
|
subroutine clear_image(image, border)
|
||||||
|
|
||||||
|
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||||
|
integer, intent(in) :: border
|
||||||
|
integer :: ix, iy
|
||||||
|
|
||||||
|
! write(0, *) "dim 1 =", ubound(image, 1)
|
||||||
|
! write(0, *) "dim 2 =", ubound(image, 2)
|
||||||
|
|
||||||
|
do ix=1+border, ubound(image, 1)-border
|
||||||
|
do iy=1+border, ubound(image, 2)-border
|
||||||
|
image(ix, iy)%r = 5555
|
||||||
|
image(ix, iy)%g = 0
|
||||||
|
image(ix, iy)%b = 0
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
! -------------------------------------------------------------------
|
! -------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
5
Modules/.gitignore
vendored
5
Modules/.gitignore
vendored
@@ -1,7 +1,10 @@
|
|||||||
|
|
||||||
chkpixels
|
chkpixels
|
||||||
t
|
twavm
|
||||||
trnd
|
trnd
|
||||||
|
t_centermag
|
||||||
|
|
||||||
|
datas/
|
||||||
|
|
||||||
*.pgm
|
*.pgm
|
||||||
*.pnm
|
*.pnm
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
GFOPT = -Wall -Wextra -g -I.
|
GFOPT = -Wall -Wextra -g -I.
|
||||||
|
|
||||||
all: chkpixels trnd t
|
all: chkpixels trnd twavm
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|
||||||
@@ -31,17 +31,23 @@ mathstuff2.o: mathstuff2.f90 Makefile
|
|||||||
noisepictures.o: noisepictures.f90 Makefile
|
noisepictures.o: noisepictures.f90 Makefile
|
||||||
gfortran $(GFOPT) -c $<
|
gfortran $(GFOPT) -c $<
|
||||||
|
|
||||||
|
# new: Wed Feb 7 01:27:48 UTC 2024
|
||||||
|
wavmetrics.o: wavmetrics.f90 Makefile
|
||||||
|
gfortran $(GFOPT) -c $<
|
||||||
|
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
# making a fluffy archive
|
# making a fluffy archive
|
||||||
#
|
#
|
||||||
OBJECTS = spitpgm.o pixrgb.o \
|
OBJECTS = spitpgm.o pixrgb.o \
|
||||||
centermag.o dummy.o \
|
centermag.o dummy.o \
|
||||||
trials.o mathstuff2.o \
|
trials.o mathstuff2.o \
|
||||||
noisepictures.o
|
noisepictures.o wavmetrics.o
|
||||||
|
|
||||||
libtth90modules.a: $(OBJECTS) Makefile
|
libtth90modules.a: $(OBJECTS) Makefile
|
||||||
$(AR) rs $@ $?
|
$(AR) rs $@ $?
|
||||||
|
|
||||||
|
# please explain the 'ar' command line
|
||||||
|
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
# programmes de testouille
|
# programmes de testouille
|
||||||
#
|
#
|
||||||
@@ -54,3 +60,8 @@ t_centermag: t_centermag.f90 Makefile libtth90modules.a
|
|||||||
|
|
||||||
trnd: trnd.f90 Makefile libtth90modules.a
|
trnd: trnd.f90 Makefile libtth90modules.a
|
||||||
gfortran $(GFOPT) $< libtth90modules.a -o $@
|
gfortran $(GFOPT) $< libtth90modules.a -o $@
|
||||||
|
|
||||||
|
# new: Wed Feb 7 01:27:48 UTC 2024
|
||||||
|
twavm: twavm.f90 Makefile libtth90modules.a
|
||||||
|
gfortran $(GFOPT) $< libtth90modules.a -o $@
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
## Modules disponibles
|
## Modules disponibles
|
||||||
|
|
||||||
|
### wavmetrics
|
||||||
|
|
||||||
|
This module try to make some computations on *stereo* buffers.
|
||||||
|
|
||||||
|
This is just a [WIP](./wavmetrics.f90), see [twavm](./twavm.f90) for a no-use case.
|
||||||
|
|
||||||
### spitpgm
|
### spitpgm
|
||||||
|
|
||||||
@@ -11,8 +16,7 @@ Write gray level 2d buffer (aka picture) to disk in the NetPNM format.
|
|||||||
### pixrgb
|
### pixrgb
|
||||||
|
|
||||||
Write 8 bits or 16 bits RGB pictures to PNM format.
|
Write 8 bits or 16 bits RGB pictures to PNM format.
|
||||||
|
The width of the picture MUST be a multiple of 4 !
|
||||||
**Warning!** The width of the picture MUST be a multiple of 4 !
|
|
||||||
|
|
||||||
### trials
|
### trials
|
||||||
|
|
||||||
@@ -26,11 +30,13 @@ or have a sane place to put a breakpoint with gdb
|
|||||||
|
|
||||||
## Compiler un module
|
## Compiler un module
|
||||||
|
|
||||||
You can use the same options as for a main program.
|
*You can use the same options as for a main program.
|
||||||
And when you use the module, you have to specify the paths
|
And when you use the module, you have to specify the paths
|
||||||
for the .mod and the .o to the linker.
|
for the .mod and the .o to the linker.
|
||||||
|
*
|
||||||
|
|
||||||
See [Makefile](./Makefile) for an example.
|
See [Makefile](./Makefile) for an example.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- écrire la doc !
|
- write the fscking doc !
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
module centermag
|
module centermag
|
||||||
implicit none
|
implicit none
|
||||||
!-----------------------------------------------------------------------
|
!-----------------------------------------------------------------------
|
||||||
|
!-
|
||||||
|
! By definition, the default centermax (0, 0, 1) give us a
|
||||||
|
! (-1,-1), (1, 1) box, who is mapped to the screen size.
|
||||||
|
!-
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
! definition of structures
|
! definition of structures
|
||||||
!-
|
!-
|
||||||
type t_centermag
|
type t_centermag
|
||||||
@@ -13,16 +18,30 @@ type t_centermag
|
|||||||
end type
|
end type
|
||||||
!-------------------------------------------------------------------
|
!-------------------------------------------------------------------
|
||||||
contains
|
contains
|
||||||
|
!-------------------------------------------------------------------
|
||||||
|
subroutine init_centermag(cntmag, w, h, mag)
|
||||||
|
type(t_centermag),intent(out) :: cntmag
|
||||||
|
integer, intent(in) :: w, h ! screen size
|
||||||
|
real, intent(in) :: mag
|
||||||
|
|
||||||
|
write(0, *) ">>> init centermag:", w, h
|
||||||
|
|
||||||
|
cntmag%wscr = w ; cntmag%hscr = h
|
||||||
|
cntmag%mag = mag
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
|
||||||
!-------------------------------------------------------------------
|
!-------------------------------------------------------------------
|
||||||
subroutine print_centermag (cm)
|
subroutine print_centermag (cm)
|
||||||
type(t_centermag), intent(in) :: cm
|
type(t_centermag), intent(in) :: cm
|
||||||
|
|
||||||
print *, "Screen ", cm%wscr, cm%hscr
|
print *, "Screen ", cm%wscr, cm%hscr
|
||||||
print *, "MagFactor ", cm%mag
|
print *, "MagFactor ", cm%mag
|
||||||
print *, "Center ", cm%cx, cm%cy
|
! print *, "Center ", cm%cx, cm%cy
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
!-------------------------------------------------------------------
|
!-------------------------------------------------------------------
|
||||||
|
!-------------------------------------------------------------------
|
||||||
subroutine centermag_scr2real (sx, sy, rx, ry)
|
subroutine centermag_scr2real (sx, sy, rx, ry)
|
||||||
integer, intent(in) :: sx, sy
|
integer, intent(in) :: sx, sy
|
||||||
real, intent(out) :: rx, ry
|
real, intent(out) :: rx, ry
|
||||||
|
|||||||
6
Modules/farbfeld.f90
Normal file
6
Modules/farbfeld.f90
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
!-
|
||||||
|
!-
|
||||||
|
! https://linuxfr.org/users/devnewton/liens/farbfeld-le-format-d-image-le-plus-simple-du-monde
|
||||||
|
! http://tools.suckless.org/farbfeld/
|
||||||
|
!-
|
||||||
|
|
||||||
@@ -6,15 +6,15 @@ module mathstuff2
|
|||||||
implicit none
|
implicit none
|
||||||
contains
|
contains
|
||||||
|
|
||||||
! ----------------------------------------------------------------
|
! ----------------------------------------------------------------
|
||||||
! really quick'n'dirty hack
|
! really quick'n'dirty hack
|
||||||
! not really tested yet...
|
! not really tested yet...
|
||||||
|
|
||||||
subroutine init_random_seed()
|
subroutine init_random_seed()
|
||||||
|
|
||||||
integer, dimension(3) :: tarray
|
integer, dimension(3) :: tarray
|
||||||
integer :: t3, foo
|
integer :: t3, foo
|
||||||
real :: dummy
|
real :: dummy
|
||||||
|
|
||||||
call itime(tarray)
|
call itime(tarray)
|
||||||
t3 = 3600*tarray(1) + 60*tarray(2) + tarray(3)
|
t3 = 3600*tarray(1) + 60*tarray(2) + tarray(3)
|
||||||
! write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3
|
! write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3
|
||||||
@@ -28,8 +28,10 @@ module mathstuff2
|
|||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
! ----------------------------------------------------------------
|
! ----------------------------------------------------------------
|
||||||
|
!-
|
||||||
|
!- May be I can make some generic procedures ?
|
||||||
|
!-
|
||||||
logical function diff_sign(a, b)
|
logical function diff_sign(a, b)
|
||||||
integer, intent(in) :: a, b
|
integer, intent(in) :: a, b
|
||||||
|
|
||||||
@@ -45,8 +47,6 @@ logical function diff_sign(a, b)
|
|||||||
diff_sign = .FALSE.
|
diff_sign = .FALSE.
|
||||||
|
|
||||||
end function
|
end function
|
||||||
|
! ----------------------------------------------------------------
|
||||||
|
|
||||||
! ----------------------------------------------------------------
|
|
||||||
end module mathstuff2
|
end module mathstuff2
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
program t
|
|
||||||
|
|
||||||
use centermag
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
type(t_centermag) :: cmag
|
|
||||||
|
|
||||||
print *, '====== programme de test ======'
|
|
||||||
|
|
||||||
cmag%wscr = 800
|
|
||||||
cmag%hscr = 600
|
|
||||||
|
|
||||||
call essai_centermag(cmag)
|
|
||||||
print *
|
|
||||||
|
|
||||||
STOP ': PAF LE CHIEN ?'
|
|
||||||
|
|
||||||
! --------------
|
|
||||||
contains
|
|
||||||
! --------------
|
|
||||||
subroutine essai_centermag(cm)
|
|
||||||
type(t_centermag), intent(in) :: cm
|
|
||||||
|
|
||||||
real :: rx, ry
|
|
||||||
|
|
||||||
call print_centermag (cm)
|
|
||||||
print *
|
|
||||||
|
|
||||||
call centermag_scr2real(1, 1, rx, ry)
|
|
||||||
print *, 'to real :', rx, ry
|
|
||||||
|
|
||||||
end subroutine
|
|
||||||
! --------------
|
|
||||||
|
|
||||||
end program
|
|
||||||
@@ -1,15 +1,9 @@
|
|||||||
program t
|
program t
|
||||||
|
|
||||||
use centermag
|
use centermag
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
type(t_centermag) :: cmag
|
type(t_centermag) :: cmag
|
||||||
|
|
||||||
print *, '====== programme de test ======'
|
print *, '====== programme de test centermag ======'
|
||||||
|
|
||||||
cmag%wscr = 800
|
|
||||||
cmag%hscr = 600
|
|
||||||
|
|
||||||
call essai_centermag(cmag)
|
call essai_centermag(cmag)
|
||||||
print *
|
print *
|
||||||
|
|
||||||
@@ -19,15 +13,13 @@ program t
|
|||||||
contains
|
contains
|
||||||
! --------------
|
! --------------
|
||||||
subroutine essai_centermag(cm)
|
subroutine essai_centermag(cm)
|
||||||
type(t_centermag), intent(in) :: cm
|
type(t_centermag), intent(inout) :: cm
|
||||||
|
real :: rx, ry
|
||||||
real :: rx, ry
|
|
||||||
|
|
||||||
|
call init_centermag(cm, 800, 600, 1.0)
|
||||||
call print_centermag (cm)
|
call print_centermag (cm)
|
||||||
print *
|
|
||||||
|
|
||||||
call centermag_scr2real(1, 1, rx, ry)
|
rx = 0.45 ; ry = -1.098
|
||||||
print *, 'to real :', rx, ry
|
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
! --------------
|
! --------------
|
||||||
|
|||||||
11
Modules/test-wavm.sh
Executable file
11
Modules/test-wavm.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
WAVE="datas/wave.wav"
|
||||||
|
|
||||||
|
# sndfile-info ${WAVE}
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
wav2text ${WAVE} | ./twavm
|
||||||
|
|
||||||
|
echo
|
||||||
67
Modules/twavm.f90
Normal file
67
Modules/twavm.f90
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
program twavm
|
||||||
|
|
||||||
|
! new: Wed Feb 7 01:27:48 UTC 2024
|
||||||
|
|
||||||
|
use mathstuff2
|
||||||
|
use wavmetrics
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
write(0, *) "----------------- twavm -------------------"
|
||||||
|
|
||||||
|
call run_second_test(44100/30)
|
||||||
|
|
||||||
|
contains
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
subroutine run_first_test(nbs)
|
||||||
|
integer, intent(in) :: nbs ! nombre d'echantillons
|
||||||
|
|
||||||
|
type(intsample), allocatable :: samples(:)
|
||||||
|
type(wavmetric) :: metrics
|
||||||
|
integer :: foo, bar
|
||||||
|
|
||||||
|
write(0, '(1X, "first test on ", I0, " samples.")') nbs
|
||||||
|
|
||||||
|
! create the buffer, and fill it with garbage
|
||||||
|
allocate(samples(nbs))
|
||||||
|
do foo=1, nbs
|
||||||
|
samples(foo)%left = mod(irand(), 65534) - 32700
|
||||||
|
samples(foo)%right = mod(irand(), 60000) - 29999
|
||||||
|
enddo
|
||||||
|
|
||||||
|
! compute and display the metrics (gi-go)
|
||||||
|
call compute_wavmetric(samples, nbs, metrics)
|
||||||
|
call display_wavmetrics(metrics)
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
!-
|
||||||
|
!- we read the datas from stdin
|
||||||
|
!-
|
||||||
|
subroutine run_second_test(nbs)
|
||||||
|
integer, intent(in) :: nbs ! nombre d'echantillons
|
||||||
|
|
||||||
|
type(intsample), allocatable :: samples(:)
|
||||||
|
type(wavmetric) :: metrics
|
||||||
|
integer :: foo, bar
|
||||||
|
integer :: vl, vr
|
||||||
|
|
||||||
|
write(0, '(1X, "second test on ", I0, " samples.")') nbs
|
||||||
|
|
||||||
|
! create the buffer, and fill it with stdin
|
||||||
|
allocate(samples(nbs))
|
||||||
|
do foo=1, nbs
|
||||||
|
read(5, *) vl, vr
|
||||||
|
! print '(1X, 2I16)', vl, vr
|
||||||
|
samples(foo)%left = vl
|
||||||
|
samples(foo)%right = vr
|
||||||
|
enddo
|
||||||
|
|
||||||
|
! compute and display the metrics (gi-go)
|
||||||
|
call compute_wavmetric(samples, nbs, metrics)
|
||||||
|
call display_wavmetrics(metrics)
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
!-----------------------------------------------------------------------
|
||||||
|
end program
|
||||||
85
Modules/wavmetrics.f90
Normal file
85
Modules/wavmetrics.f90
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
|
||||||
|
module wavmetrics
|
||||||
|
|
||||||
|
! new: Thu Jan 4 00:08:04 UTC 2024
|
||||||
|
|
||||||
|
use mathstuff2
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
type wavmetric
|
||||||
|
integer :: nbre ! number of slices/samples
|
||||||
|
real :: freql, freqr ! zero-crossing estimation
|
||||||
|
integer :: maxl, maxr ! maximum of abs values
|
||||||
|
real :: meanl, meanr
|
||||||
|
end type
|
||||||
|
|
||||||
|
type intsample
|
||||||
|
integer :: left, right
|
||||||
|
end type
|
||||||
|
|
||||||
|
contains
|
||||||
|
!-------------------------------------------------------------
|
||||||
|
!-
|
||||||
|
! main computation routine, still full buggy
|
||||||
|
!-
|
||||||
|
subroutine compute_wavmetric(samples, size, metrics)
|
||||||
|
type(intsample), intent(in) :: samples(:)
|
||||||
|
integer, intent(in) :: size
|
||||||
|
type(wavmetric), intent(out) :: metrics
|
||||||
|
|
||||||
|
integer :: Lmax, Rmax
|
||||||
|
integer :: Lval, Rval
|
||||||
|
integer :: idx
|
||||||
|
integer :: Lfreq, Rfreq
|
||||||
|
|
||||||
|
real :: Lsum, Rsum
|
||||||
|
|
||||||
|
Lmax = 0 ; Rmax = 0
|
||||||
|
Lfreq = 1 ; Rfreq = 1
|
||||||
|
Lsum = 0.0 ; Rsum = 0.0
|
||||||
|
|
||||||
|
do idx=1, size
|
||||||
|
Lval = samples(idx)%left
|
||||||
|
Rval = samples(idx)%right
|
||||||
|
|
||||||
|
! print *, Rval, Lval
|
||||||
|
if (abs(Lval) .GT. Lmax) Lmax = abs(Lval)
|
||||||
|
if (abs(Rval) .GT. Rmax) Rmax = abs(Rval)
|
||||||
|
|
||||||
|
if (idx .GT. 1) then
|
||||||
|
if (diff_sign(samples(idx-1)%left, Lval)) Lfreq = Lfreq + 1
|
||||||
|
if (diff_sign(samples(idx-1)%right, Rval)) Rfreq = Rfreq + 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
Lsum = Lsum + Lval
|
||||||
|
Rsum = Rsum + Rval
|
||||||
|
|
||||||
|
enddo
|
||||||
|
|
||||||
|
metrics%nbre = size
|
||||||
|
metrics%maxl = Lmax ; metrics%maxr = Rmax
|
||||||
|
metrics%freql = 1.0 / (Lfreq / real(size))
|
||||||
|
metrics%freqr = 1.0 / (Rfreq / real(size))
|
||||||
|
metrics%meanl = Lsum / real(size)
|
||||||
|
metrics%meanr = Rsum / real(size)
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
|
||||||
|
!-------------------------------------------------------------
|
||||||
|
|
||||||
|
subroutine display_wavmetrics(metrics)
|
||||||
|
type(wavmetric), intent(in) :: metrics
|
||||||
|
|
||||||
|
! print '(1X, "metrics are :")'
|
||||||
|
|
||||||
|
print '(1X, " | nbre ", I0)', metrics%nbre
|
||||||
|
print '(1X, " | freq ", 2F12.2)', metrics%freql, metrics%freqr
|
||||||
|
print '(1X, " | mean ", 2F12.2)', metrics%meanl, metrics%meanr
|
||||||
|
print '(1X, " | maxi ", 2I8)', metrics%maxl, metrics%maxr
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
|
||||||
|
!-------------------------------------------------------------
|
||||||
|
!-------------------------------------------------------------
|
||||||
|
|
||||||
|
end module
|
||||||
18
README.md
18
README.md
@@ -8,21 +8,31 @@ de Janvier 2022, et j'ai bien aimé. Bon, contrairement à la
|
|||||||
version de 77, les `GOTO`s sont moins agréables à faire, mais
|
version de 77, les `GOTO`s sont moins agréables à faire, mais
|
||||||
l'existence des _pointeurs_ compense largement.
|
l'existence des _pointeurs_ compense largement.
|
||||||
|
|
||||||
## content
|
## Le contenu
|
||||||
|
|
||||||
|
- [Modules](Modules/) : quelques composants de base.
|
||||||
- [SoundBrotching](SoundBrotching/) : faire gémir vos tympans
|
- [SoundBrotching](SoundBrotching/) : faire gémir vos tympans
|
||||||
- [BloubWorld](BloubWorld/) : la vie des particules
|
- [BloubWorld](BloubWorld/) : la vie des particules
|
||||||
- [Fraktalism](Fraktalism/) : du chaos dans les pixels
|
- [Fraktalism](Fraktalism/) : du chaos dans les pixels
|
||||||
- [RandomStuff](RandomStuff/) : on a tous droit à notre jardin secret
|
- [RandomStuff](RandomStuff/) : on a tous droit à notre jardin secret
|
||||||
- [GrafAnim](GrafAnim/) : Ah, enfin de la gif89a en vue !
|
- [GrafAnim](GrafAnim/) : Ah, enfin de la gif89a en vue !
|
||||||
|
|
||||||
## Prérequis
|
## Utilisation
|
||||||
|
|
||||||
- GNUtrucs : bash, make, awk...
|
- Prérequis de base, les GNUtrucs : gfortran, gcc, bash, make, awk...
|
||||||
|
- Première chose à faire, compiler les [modules](Modules/README.md)
|
||||||
|
qui seront utilisés par les autres logiciels.
|
||||||
|
- Et ensuite, à vous de jouer. Fouillez dans les dossiers en sachant
|
||||||
|
bien que beaucoup de ces trucs ne sont ni fait, ni à faire.
|
||||||
|
|
||||||
## hotline
|
## Hotline
|
||||||
|
|
||||||
- Le canal `#tetalab` sur le réseau IRC de
|
- Le canal `#tetalab` sur le réseau IRC de
|
||||||
[Libera](https://libera.chat/)
|
[Libera](https://libera.chat/)
|
||||||
- La [mailing-list publique](https://lists.tetalab.org/mailman/listinfo/tetalab) du Tetalab.
|
- La [mailing-list publique](https://lists.tetalab.org/mailman/listinfo/tetalab) du Tetalab.
|
||||||
|
|
||||||
|
## Ressources
|
||||||
|
|
||||||
|
* [Fortran Programming Language](https://fortran-lang.org/)
|
||||||
|
* [Fortran Tips](https://zmoon.github.io/FortranTipBrowser/tips/index.html)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user