diff --git a/Fraktalism/README.md b/Fraktalism/README.md index a6c4371..e3f531c 100644 --- a/Fraktalism/README.md +++ b/Fraktalism/README.md @@ -33,5 +33,5 @@ Generally writen as a *sequencial unformated* file. - Voir de près le calcul du cadrage - Rajouter des formules -- Ne pas procastiner +- Ne pas procastiner sur le reste diff --git a/Fraktalism/julia.f90 b/Fraktalism/julia.f90 index 5ab7694..79e5cc5 100644 --- a/Fraktalism/julia.f90 +++ b/Fraktalism/julia.f90 @@ -1,6 +1,7 @@ -! -! this is the main programm -! +!----------------------------------------------------- +! JULIA +! ===== +! this is the main program !----------------------------------------------------- program julia @@ -24,7 +25,7 @@ program julia call getarg(2, string) ; read (string, *) cx call getarg(3, string) ; read (string, *) cy - call simple_julia(picz, cx, cy, 250) + call simple_julia(picz, cx, cy, 2500) call spit_as_pgm_8(picz, trim(filename)) end program diff --git a/Fraktalism/mkjuliagif.sh b/Fraktalism/mkjuliagif.sh index 86b7731..d424685 100755 --- a/Fraktalism/mkjuliagif.sh +++ b/Fraktalism/mkjuliagif.sh @@ -14,13 +14,13 @@ fi # # run the prog # -for foo in $(seq 0 39) +for foo in $(seq 0 99) do - img=$(printf "frames/%05d.pgm" $foo) + img=$(printf "frames/julia/%05d.pgm" $foo) bar=$(echo "$foo / 247.0" | bc -l) - cx=$(echo "0.4 * c($foo)" | bc -l) - cy=$(echo "0.4 * s($foo*2)" | bc -l) + cx=$(echo "0.3 * c($foo/3)" | bc -l) + cy=$(echo "0.3 * s($foo/2)" | bc -l) ./julia $img $cx $cy @@ -28,5 +28,6 @@ done echo ; echo "Encoding, please wait..." -convert -delay 10 frames/*.pgm foo.gif +convert -delay 10 frames/julia/*.pgm foo.gif +animate foo.gif & diff --git a/Fraktalism/pick3d.pov b/Fraktalism/pick3d.pov index e85ef90..c04ee4b 100644 --- a/Fraktalism/pick3d.pov +++ b/Fraktalism/pick3d.pov @@ -24,11 +24,12 @@ union { // -------------------------------------------------------------- -#declare TS = 0.017; +#declare TS = 0.025; #declare Truc = object { -box { <-TS, -TS, -TS>, } +// box { <-TS, -TS, -TS>, } +sphere { <0, 0, 0>, TS*0.83 } } #include "WS/pickover.inc" @@ -57,7 +58,7 @@ object { plane { <0, 1, 0>, 0 texture { - pigment { color srgb <0.133, 0.155, 0.111> } + pigment { color srgb <0.233, 0.155, 0.191> } finish { phong 0.18 metallic 0.55 } } } @@ -65,18 +66,18 @@ plane { // ---------------------------------------------------------- -light_source { <-12, 17, -11> color Gray90 } -light_source { <-11, 11, 9> color Gray60 } +light_source { <-12, 15, -11> color Gray90 } +light_source { < 11, 11, 13> color Gray60 } -#declare XCAM = -3.8; +#declare XCAM = -3.1; #declare YCAM = 3; -#declare ZCAM = 2.1; +#declare ZCAM = 1.9; camera { location look_at <0, 2.09, 0> right x*image_width/image_height - angle 92 + angle 82 } // ---------------------------------------------------------- diff --git a/Fraktalism/pick3d.sh b/Fraktalism/pick3d.sh index 53c2e8b..3f1682e 100755 --- a/Fraktalism/pick3d.sh +++ b/Fraktalism/pick3d.sh @@ -1,12 +1,20 @@ #!/bin/bash -POVOPT=" -d +q9 +a +W1920 +H1080 -v +WT4" -PASS=600 +POVOPT=" -d +q9 +a +W1280 +H1024 -v +WT2" +PASS=999 ERR="/tmp/pov.error" POVINC="WS/pickover.inc" +TMPF="/dev/shm/pickover.png" + +make pickover +if [ $? -ne 0 ] ; then + echo + echo "Make error " $? + exit 1 +fi ./pickover foo.pgm | awk -f pick2pov.awk > $POVINC -head $POVINC +# head $POVINC for pass in $(seq 0 $(( PASS-1 )) ) do @@ -16,18 +24,24 @@ do povray -ipick3d.pov -K${pass} \ Declare=NBPASS=${PASS} \ - $POVOPT -O${dstname} 2> $ERR + $POVOPT -O${TMPF} 2> $ERR if [ $? -ne 0 ] then - tail $ERR + tail -20 $ERR exit fi - sleep 16 + convert ${TMPF} \ + -fill Gray50 \ + -gravity South-West \ + -pointsize 24 \ + -annotate +20+10 "tTh" \ + $dstname + + sleep 10 done - ffmpeg -nostdin \ -loglevel warning \ -y -r 25 -f image2 -i frames/pick3d/%05d.png \ diff --git a/Fraktalism/pickover.f90 b/Fraktalism/pickover.f90 index 18b9f2f..ae4114f 100644 --- a/Fraktalism/pickover.f90 +++ b/Fraktalism/pickover.f90 @@ -33,11 +33,11 @@ program pickover STOP " : NO ENOUGH MEMORY" endif - coefs(1) = 2.24 ; coefs(2) = 0.43 - coefs(3) = -0.65 ; coefs(4) = -2.43 + coefs(1) = 2.24 ; coefs(2) = 0.43 + coefs(3) = -0.65 ; coefs(4) = -2.43 call compute_pickover(points, coefs) - call list_points3d(points, 2, 42000) + call list_points3d(points, 200, 15000) end program diff --git a/Fraktalism/spitpgm.f90 b/Fraktalism/spitpgm.f90 deleted file mode 100644 index 7f2c34d..0000000 --- a/Fraktalism/spitpgm.f90 +++ /dev/null @@ -1,73 +0,0 @@ -module spitpgm - - implicit none - - contains - -!----------------------------------------------------- - -subroutine spit_as_pgm(pic, fname) - - integer, intent(in), dimension (:,:) :: pic - character (len=*), intent(in) :: fname - - integer :: io, foo - integer :: ix, iy - real :: fk, fpix - - write(0, '(1X, A)') "> spit_as_pgm to " // trim(fname) - - open(newunit=io, file=fname) - write (io, '(a2)') "P2" - write (io, '(i0," ",i0)') size(pic, 1), size(pic, 2) - write (io, '(i0)') 65535 - - foo = MAXVAL(pic) - if (foo .EQ. 0) then - print *, " IS SOMETHING WRONG GOING TO HAPPEN ?" - do ix = 1, size(pic) - write (io, "(i0)") 0 - enddo - else - fk = float(foo) / 65535.0 - print *, " max pix value", foo, " fk = ", fk - do iy = 1, ubound(pic, 2) - do ix = 1, ubound(pic, 1) - fpix = float(pic(ix, iy)) / fk - write (io, "(i0)") int(fpix) - end do - end do - endif - close(io) - -end subroutine -!----------------------------------------------------- -subroutine spit_as_pgm_8(pic, fname) - - integer, intent(in), dimension (:,:) :: pic - character (len=*), intent(in) :: fname - - integer :: io, foo - integer :: ix, iy - - ! XXX print *, "> spit_as_pgm_8 to ", fname - foo = MAXVAL(pic) - ! XXX print *, " max = ", foo - open(newunit=io, file=fname) - write (io, '(a2)') "P2" - write (io, '(i0," ",i0)') size(pic, 1), size(pic, 2) - write (io, '(i0)') 255 - - do iy=1,ubound(pic, 2) - do ix=1, ubound(pic, 1) - foo = pic(ix, iy) - if (foo .GT. 255) foo = 255 - write(io, "(i3)") foo - enddo - enddo - close(io) - -end subroutine -!----------------------------------------------------- - -end module spitpgm diff --git a/Fraktalism/voxelize.f90 b/Fraktalism/voxelize.f90 new file mode 100644 index 0000000..11abfb0 --- /dev/null +++ b/Fraktalism/voxelize.f90 @@ -0,0 +1,47 @@ +!----------------------------------------------------- +! VOXELIZE +! ======== +! this is the main program +!----------------------------------------------------- +program voxelize + use fraktals + + integer, parameter :: DIM = 500 + integer, dimension(:,:,:), allocatable :: cube + type(t_point3d), dimension(:), allocatable :: points + integer :: errcode, foo + integer :: ix, iy, iz + double precision, dimension(4) :: coefs + + foo = (DIM*DIM*DIM) / (1024) + PRINT *, "memory request for cube (in Kwords) ", foo + + allocate (cube(DIM,DIM,DIM), stat=errcode) + if (0 .NE. errcode) then + STOP " : NO ENOUGH MEMORY FOR CUBE" + endif + + nbr_points = 99999 + allocate(points(nbr_points), stat=errcode) + if (0 .NE. errcode) then + STOP " : NO ENOUGH MEMORY FOR POINTS" + endif + + coefs(1) = 2.24 ; coefs(2) = 0.43 + coefs(3) = -0.65 ; coefs(4) = -2.43 + call compute_pickover(points, coefs) + + call clear_cube(cube) + + do foo=1, nbr_points + ix = nint(points(foo)%x * dble(DIM)) + iy = nint(points(foo)%y * dble(DIM)) + iz = nint(points(foo)%z * dble(DIM)) + enddo +!----------------------------------------------------- +contains +!----------------------------------------------------- +!----------------------------------------------------- +end program voxelize +!----------------------------------------------------- + diff --git a/RandomStuff/README.md b/RandomStuff/README.md index 1b39503..2ed34a4 100644 --- a/RandomStuff/README.md +++ b/RandomStuff/README.md @@ -2,3 +2,8 @@ Warning, non-sense inside ! +## Utilities + + +## Debug tools + diff --git a/SoundBrotching/c-tools/README.md b/SoundBrotching/c-tools/README.md new file mode 100644 index 0000000..c64ce68 --- /dev/null +++ b/SoundBrotching/c-tools/README.md @@ -0,0 +1,16 @@ +# C tools + +Support utilities for SoundBrotching. + +### wav2text + +Conversion d'un fichier son en text machinable. + +### text2wav + +Conversion d'un fichier texte en fichier son. + +### text2ao + +Envoi d'un fichier texte vers une sortie audio. + diff --git a/SoundBrotching/support.h b/SoundBrotching/c-tools/support.h similarity index 100% rename from SoundBrotching/support.h rename to SoundBrotching/c-tools/support.h diff --git a/SoundBrotching/c-tools/text2ao.c b/SoundBrotching/c-tools/text2ao.c new file mode 100644 index 0000000..dcc068b --- /dev/null +++ b/SoundBrotching/c-tools/text2ao.c @@ -0,0 +1,60 @@ +/* + * TEXT TO AUDIO OUTPUT + */ + +#include +#include +#include +#include /* for the sound output */ + +#include "support.h" + +/* --------------------------------------------------------------- */ +int sound_blasting(FILE *input) +{ +int driver; +ao_sample_format format; +ao_device * device; + +fprintf(stderr, ">>> %s ( %p )\n", __func__, input); + +ao_initialize(); +driver = ao_default_driver_id(); + +fprintf(stderr, " driver is #%d\n", driver); + +memset(&format, 0, sizeof(ao_sample_format)); /* indispensable */ + +format.bits = 16; +format.channels = 2; +format.rate = 44100; +format.byte_format = AO_FMT_LITTLE; /* XXX ??? */ +device = ao_open_live(driver, &format, NULL); +if (device == NULL) + { + fprintf(stderr, "\n%s: Error open device\n", __func__); + /* + * comment connaitre la cause de l'erreur ? + */ + return -2; + } +fprintf(stderr, "sound device open at %p\n", device); + +return -1; +} +/* --------------------------------------------------------------- */ +int main(int argc, char *argv[]) +{ +int foo; + +print_version(argv[0]); + +if (argc < 2) { + fprintf(stderr, "%s uh?\n", argv[0]); + } +foo = sound_blasting(stdin); +fprintf(stderr, "sound blasting -> %d\n", foo); + +return 0; +} +/* --------------------------------------------------------------- */ diff --git a/SoundBrotching/genwaves.f90 b/SoundBrotching/genwaves.f90 index 8ac2017..92b1565 100644 --- a/SoundBrotching/genwaves.f90 +++ b/SoundBrotching/genwaves.f90 @@ -2,12 +2,8 @@ program genwaves use soundbrotch ! ----------------------------- - implicit none - - print *, "genwaves is coming soon..." - call soundbrotch_version() diff --git a/SoundBrotching/panoramix.f90 b/SoundBrotching/panoramix.f90 index 80fdaad..957dc6d 100644 --- a/SoundBrotching/panoramix.f90 +++ b/SoundBrotching/panoramix.f90 @@ -1,9 +1,35 @@ program panoramix + use soundbrotch +! ------------------------------------------------------ implicit none + integer :: left, right + integer :: errcode + integer :: nblus + real :: value, phi, ka - print *, "Panoramix coming soon..." + call soundbrotch_version() + + nblus = 0 + do + read (*, *, iostat=errcode) left, right + if (errcode .NE. 0) then + write(0, *) 'EOF ? ', errcode + exit + endif + + ! *** NON WORKING CODE *** + phi = real(nblus) / 20000.0 + ka = sin(phi) + value = (real(left)+real(right)) / 2.05 + left = int(value*ka) + right = int(value*(1.0-ka)) + + print *, left, right + + nblus = nblus + 1 + enddo end program diff --git a/SoundBrotching/soundbrotch.f90 b/SoundBrotching/soundbrotch.f90 index 726d6d5..b44392e 100644 --- a/SoundBrotching/soundbrotch.f90 +++ b/SoundBrotching/soundbrotch.f90 @@ -1,6 +1,13 @@ module soundbrotch implicit none + ! --------------------------------------------------------- + type t_sample + integer :: left + integer :: right + end type + + ! --------------------------------------------------------- contains @@ -8,7 +15,7 @@ module soundbrotch subroutine soundbrotch_version () - write(0, '(A)') "*** this is soundbrotch version alpha" + write(0, '(A)') "*** this is soundbrotch version alpha 666" end subroutine diff --git a/SoundBrotching/support.c b/SoundBrotching/support.c deleted file mode 100644 index eebb15b..0000000 --- a/SoundBrotching/support.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * C SUPPORT FUNCTIONS - */ - -#include -#include - -#include - -#include "support.h" - -/* --------------------------------------------------------------- */ -int display_sf_info(SF_INFO *psf, char *text) -{ - -fprintf(stderr, " +-- sf info [%s] %p\n", text, psf); - -fprintf(stderr, " | samplerate %d\n", psf->samplerate); -fprintf(stderr, " | channels %d\n", psf->channels); -fprintf(stderr, " | frames %ld\n", psf->frames); - -return 0; -} -/* --------------------------------------------------------------- */ - -void print_version(char *msg) -{ -fprintf(stderr, "======== %s === compiled %s, %s\n", \ - msg, __DATE__, __TIME__); -} -/* --------------------------------------------------------------- */ diff --git a/SoundBrotching/text2ao.c b/SoundBrotching/text2ao.c deleted file mode 100644 index 38d88a9..0000000 --- a/SoundBrotching/text2ao.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * TEXT TO AUDIO OUTPUT - */ - -#include - -#include - -#include "support.h" - -/* --------------------------------------------------------------- */ - -/* --------------------------------------------------------------- */ -int main(int argc, char *argv[]) -{ - -print_version(argv[0]); - -return 0; -} -/* --------------------------------------------------------------- */ diff --git a/SoundBrotching/text2wav.c b/SoundBrotching/text2wav.c deleted file mode 100644 index 007915b..0000000 --- a/SoundBrotching/text2wav.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * TEXT TO WAV - */ - -#include -#include -#include - -#include "support.h" - -/* --------------------------------------------------------------- */ -int convert_text_to_wav(char *outfname) -{ - -#if DEBUG_LEVEL -fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outfname); -#endif - -return -1; -} -/* --------------------------------------------------------------- */ -int main(int argc, char *argv[]) -{ - -print_version(argv[0]); - -if (2 != argc) { - fprintf(stderr, "fubar\n"); - exit(1); - } - -return 0; -} -/* --------------------------------------------------------------- */ diff --git a/SoundBrotching/wav2text.c b/SoundBrotching/wav2text.c deleted file mode 100644 index 33946d2..0000000 --- a/SoundBrotching/wav2text.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * WAV TO TEXT - */ - -#include -#include -#include - -#include - -#include "support.h" - -/* --------------------------------------------------------------- */ -int convert_wav_to_text(char *infname) -{ -SNDFILE * sndf; -SF_INFO sfinfo; -int foo, lu; -short * samples; - -#if DEBUG_LEVEL -fprintf(stderr, ">>> %s ( '%s' )\n", __func__, infname); -#endif - -memset(&sfinfo, 0, sizeof(sfinfo)); /* be clean */ - -sndf = sf_open(infname, SFM_READ, &sfinfo); -if (sndf==NULL) - { - /*catch the snfile errmsg here XXX */ - fprintf(stderr, "error sf_opening %s\n", infname); - exit(1); - } - -foo = display_sf_info(&sfinfo, "why not ?"); -if (foo) { - fprintf(stderr, "%s: corrupted sf_info ?\n", __func__); - abort(); - } - -/* get memory for bufferins read from sound file */ -if ( NULL == (samples = malloc(BUFFER_SIZE*sizeof(short))) ) - { - perror("\n no memory in converter"); - abort(); - } - -while ( (lu=sf_read_short(sndf, samples, BUFFER_SIZE)) > 0 ) - { - fprintf(stderr, " LU = %5lu\n", lu); - - } -/* - * job done, some cleanup - */ -free(samples); - - -return -1; -} -/* --------------------------------------------------------------- */ -void usage(void) -{ -printf("usage:\n\twav2txt 1337.wav\n"); -exit(0); -} -/* --------------------------------------------------------------- */ -int main(int argc, char *argv[]) -{ -int foo; - -print_version(argv[0]); - -if (2 != argc) usage(); - -foo = convert_wav_to_text(argv[1]); -fprintf(stderr, "got a %d from converter\n", foo); - -return 0; -} -/* --------------------------------------------------------------- */