Compare commits

..

No commits in common. "0f92d09d5ef8dda141e8ed2e1043da770abf46cd" and "285257cfacb1dc39e348679c187aff9d7300a38a" have entirely different histories.

12 changed files with 33 additions and 108 deletions

View File

@ -12,7 +12,7 @@ fi
TMPNG="/dev/shm/voxvidz.png" TMPNG="/dev/shm/voxvidz.png"
NBIMG=1600 NBIMG=1500
printf "#declare NbImg = %d;\n" $NBIMG | tee WS/nbimg.inc printf "#declare NbImg = %d;\n" $NBIMG | tee WS/nbimg.inc
@ -37,7 +37,7 @@ do
titre='Voxelisation - tTh - Avril 2022' titre='Voxelisation - tTh - Avril 2022'
numbers=$(tail -1 WS/camvox.log | \ numbers=$(tail -1 WS/camvox.log | \
awk '{printf " K=%5d : %6.3f %6.3f %6.3f", \ awk '{printf " K=%5d : %6.3f %6.3f %6.3f", \
$1, $2, $3, $4}') $1, $2, $3, $4}')
echo "numbers " "$numbers" " txtidx " $txtidx echo "numbers " "$numbers" " txtidx " $txtidx
@ -57,7 +57,7 @@ do
grep 'Parse Time' WS/toto.err grep 'Parse Time' WS/toto.err
grep 'Trace Time' WS/toto.err grep 'Trace Time' WS/toto.err
echo ; sleep 10 echo ; sleep 15
done done

View File

@ -17,7 +17,7 @@ global_settings {
#declare VOXEL = object #declare VOXEL = object
{ {
// sphere { 0, 1.18 } // sphere { 0, 1.18 }
#local D = 2.11; #local D = 1.92;
box { <-D, -D, -D>, <D, D, D> } box { <-D, -D, -D>, <D, D, D> }
} }
@ -52,7 +52,7 @@ finish { phong 0.6 specular 0.8 }
object { TriAxe } object { TriAxe }
plane { plane {
<0, 1, 0>, -120 <0, 1, 0>, -100
texture { texture {
pigment { color srgb <0.203, 0.185, 0.191> } pigment { color srgb <0.203, 0.185, 0.191> }
finish { phong 0.18 metallic 0.55 } finish { phong 0.18 metallic 0.55 }
@ -69,11 +69,11 @@ light_source { < 8, -48, 3> color Green*0.75 }
#include "WS/nbimg.inc" #include "WS/nbimg.inc"
#declare NormClock = (clock/NbImg); #declare NormClock = (clock/NbImg);
#declare ECAM = 210 - (100*NormClock); #declare ECAM = 190 - (100*NormClock);
#declare CKsmall = NormClock * 87.20; #declare CKsmall = NormClock * 77.20;
#declare Offset = 0.10; #declare Offset = 0.10;
#declare XCAM = ECAM * (sin(radians(CKsmall)) + Offset); #declare XCAM = ECAM * (sin(radians(CKsmall)) + Offset);
#declare YCAM = 18; #declare YCAM = 16;
#declare ZCAM = ECAM * (cos(radians(CKsmall)) + Offset); #declare ZCAM = ECAM * (cos(radians(CKsmall)) + Offset);
#declare ACAM = 65 + (53*NormClock); #declare ACAM = 65 + (53*NormClock);
@ -91,7 +91,7 @@ light_source { < 8, -48, 3> color Green*0.75 }
camera { camera {
location <XCAM, YCAM, ZCAM> location <XCAM, YCAM, ZCAM>
// look_at <Bary_X, Bary_Y, Bary_Z> // look_at <Bary_X, Bary_Y, Bary_Z>
look_at <0, -1, 0> look_at <0, 0, 0>
right x*image_width/image_height right x*image_width/image_height
angle ACAM angle ACAM
} }

View File

@ -9,7 +9,7 @@ program voxelize
implicit none implicit none
integer, parameter :: DIMC = 180 integer, parameter :: DIMC = 200
integer, dimension(:,:,:), allocatable :: cube integer, dimension(:,:,:), allocatable :: cube
type(t_point3d), dimension(:), allocatable :: points type(t_point3d), dimension(:), allocatable :: points
integer :: errcode, foo, argc integer :: errcode, foo, argc
@ -44,7 +44,7 @@ program voxelize
KA(1) = -1.3402 ; KA(2) = 1.5245 KA(1) = -1.3402 ; KA(2) = 1.5245
KA(3) = 1.0966 ; KA(4) = -2.3423 KA(3) = 1.0966 ; KA(4) = -2.3423
KB(1) = -1.2100 ; KB(2) = 1.3685 KB(1) = -1.2100 ; KB(2) = 1.3685
KB(3) = 1.3237 ; KB(4) = -2.3992 KB(3) = 1.1237 ; KB(4) = -2.1992
call interp4dp(KA, KB, KM, delta) call interp4dp(KA, KB, KM, delta)
write(0, "(' --- coefs = ', 4F11.6)") KM write(0, "(' --- coefs = ', 4F11.6)") KM
call compute_pickover(points, KM) call compute_pickover(points, KM)
@ -65,7 +65,7 @@ program voxelize
write(0, *) "--- maxval(cube) = ", maxcube write(0, *) "--- maxval(cube) = ", maxcube
call spit_cube_as_union(filename, cube, & call spit_cube_as_union(filename, cube, &
maxcube/2000, dble(9000.00)) maxcube/1000, dble(9000.00))
write(0, *) "--- end of voxelize" write(0, *) "--- end of voxelize"
@ -173,8 +173,8 @@ subroutine spit_cube_as_union(fname, voxels, limit, scaling)
bz = bz + dble(iz) bz = bz + dble(iz)
valeur = DBLE(cube(ix,iy,iz)) / scaling valeur = DBLE(cube(ix,iy,iz)) / scaling
! XXX ! XXX
if (valeur .GT. 1.5) then if (valeur .GT. 1.0) then
valeur = 1.5 valeur = 1.0
endif endif
write(chaine, "( 'translate <', I4, ',', I4, ',', I4, '> ' )") & write(chaine, "( 'translate <', I4, ',', I4, ',', I4, '> ' )") &

17
LICENCE
View File

@ -1,17 +0,0 @@
_______________________________________________________________________
/\ \
\_| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| Version 2, December 2004 |
| |
| Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> |
| |
| Everyone is permitted to copy and distribute verbatim or modified |
| copies of this license document, and changing it is allowed as long |
| as the name is changed. |
| |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| |
| 0. You just DO WHAT THE FUCK YOU WANT TO. |
| __________________________________________________________________|_
\_/____________________________________________________________________/

View File

@ -4,7 +4,6 @@
*.wav *.wav
*.text *.text
*.png
text2wav text2wav
wav2text wav2text

View File

@ -2,7 +2,7 @@
# tth@konrad:~/Devel/Fortraneries/SoundBrotching$ # tth@konrad:~/Devel/Fortraneries/SoundBrotching$
# #
GOPT = -Wall -Wextra -time -g GOPT = -Wall -Wextra -g
all: panoramix genwaves all: panoramix genwaves

View File

@ -14,6 +14,7 @@ int display_sf_info(SF_INFO *psf, char *text)
{ {
fprintf(stderr, " +-- sf info [%s] %p\n", text, psf); fprintf(stderr, " +-- sf info [%s] %p\n", text, psf);
fprintf(stderr, " | samplerate %d\n", psf->samplerate); fprintf(stderr, " | samplerate %d\n", psf->samplerate);
fprintf(stderr, " | channels %d\n", psf->channels); fprintf(stderr, " | channels %d\n", psf->channels);
fprintf(stderr, " | frames %ld\n", psf->frames); fprintf(stderr, " | frames %ld\n", psf->frames);
@ -22,6 +23,7 @@ fprintf(stderr, " | format 0x%x\n", psf->format);
return 0; return 0;
} }
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
void print_version(char *msg) void print_version(char *msg)
{ {
fprintf(stderr, "=== %s compiled %s, %s\n", \ fprintf(stderr, "=== %s compiled %s, %s\n", \

View File

@ -16,9 +16,9 @@
/* /*
* WARNING ! * WARNING !
* this function write only 16bits stereo input * this function can read only 16bits stereo input
*/ */
int convert_text_to_wav(FILE *input, char *outf, int sr, int format) int convert_text_to_wav(FILE *input, char *outfname, int format)
{ {
SNDFILE * sndf; SNDFILE * sndf;
SF_INFO sfinfo; SF_INFO sfinfo;
@ -27,7 +27,7 @@ int left, right;
int nb_lus, idx; int nb_lus, idx;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outf); fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outfname);
#endif #endif
if (format) { if (format) {
@ -45,13 +45,13 @@ if (NULL==(buffer=malloc(SMPL_COUNT * sizeof(short) * 2))) {
} }
memset(&sfinfo, 0, sizeof(sfinfo)); /* be clean */ memset(&sfinfo, 0, sizeof(sfinfo)); /* be clean */
sfinfo.samplerate = sr; sfinfo.samplerate = 44100;
sfinfo.channels = 2; sfinfo.channels = 2;
sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
if ( ! (sndf=sf_open(outf, SFM_WRITE, &sfinfo)) ) { if ( ! (sndf=sf_open(outfname, SFM_WRITE, &sfinfo)) ) {
fprintf(stderr, "write to %s : err %s\n", fprintf(stderr, "write to %s : err %s\n",
outf, sf_strerror (NULL)); outfname, sf_strerror (NULL));
return -2; return -2;
} }
@ -94,7 +94,7 @@ if (2 != argc) {
exit(1); exit(1);
} }
foo = convert_text_to_wav(stdin, argv[1], 44100, 0); foo = convert_text_to_wav(stdin, argv[1], 0);
fprintf(stderr, "got a %d from text->wav converter\n", foo); fprintf(stderr, "got a %d from text->wav converter\n", foo);
return 0; return 0;

View File

@ -2,24 +2,7 @@
INWAV="1637.wav" INWAV="1637.wav"
OUTWAV="foo.wav" OUTWAV="foo.wav"
DATAFILE="waves.text"
# XXX ./wav2text $INWAV | ./panoramix | ./text2wav $OUTWAV ./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

View File

@ -4,19 +4,8 @@ program genwaves
! ----------------------------- ! -----------------------------
implicit none implicit none
integer :: clock
! type(t_sample2i) :: sample
real :: fleft, fright ! frequencies
write(0, *) "*** Genwaves ***"
call soundbrotch_version() 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 end program

View File

@ -9,19 +9,18 @@ program panoramix
integer :: nblus integer :: nblus
real :: value, phi, ka real :: value, phi, ka
write(0, *) "*** Panoramix ***"
call soundbrotch_version() call soundbrotch_version()
nblus = 0 nblus = 0
do do
read (*, *, iostat=errcode) left, right read (*, *, iostat=errcode) left, right
if (errcode .NE. 0) then if (errcode .NE. 0) then
! write(0, *) 'EOF ? ', errcode write(0, *) 'EOF ? ', errcode
exit exit
endif endif
! *** NON WORKING CODE *** ! *** NON WORKING CODE ***
phi = real(nblus) / 60000.0 phi = real(nblus) / 20000.0
ka = sin(phi) ka = sin(phi)
value = (real(left)+real(right)) / 2.05 value = (real(left)+real(right)) / 2.05
left = int(value*ka) left = int(value*ka)

View File

@ -2,53 +2,23 @@ module soundbrotch
implicit none implicit none
! --------------------------------------------------------- ! ---------------------------------------------------------
type t_sample2i type t_sample
integer :: left integer :: left
integer :: right integer :: right
end type end type
! --------------------------------------------------------- ! ---------------------------------------------------------
contains contains
! --------------------------------------------------------- ! ---------------------------------------------------------
subroutine soundbrotch_version () subroutine soundbrotch_version ()
write(0, '(1X,A)') "--- this is soundbrotch version alpha 666"
end subroutine
! --------------------------------------------------------- write(0, '(A)') "*** this is soundbrotch version alpha 666"
! 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 subroutine
! --------------------------------------------------------- ! ---------------------------------------------------------
end module end module