Compare commits

..

4 Commits

Author SHA1 Message Date
tth
0f92d09d5e bad or not bad ? 2022-05-05 06:58:45 +02:00
tth
fca15a210a DWTFYW license added 2022-05-05 04:56:50 +02:00
tth
2d6adefc56 cosmetic 2022-05-04 13:51:44 +02:00
tth
cd486c5090 need more tuning ? 2022-04-17 12:44:43 +02:00
12 changed files with 109 additions and 34 deletions

View File

@ -12,7 +12,7 @@ fi
TMPNG="/dev/shm/voxvidz.png"
NBIMG=1500
NBIMG=1600
printf "#declare NbImg = %d;\n" $NBIMG | tee WS/nbimg.inc
@ -37,7 +37,7 @@ do
titre='Voxelisation - tTh - Avril 2022'
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}')
echo "numbers " "$numbers" " txtidx " $txtidx
@ -57,7 +57,7 @@ do
grep 'Parse Time' WS/toto.err
grep 'Trace Time' WS/toto.err
echo ; sleep 15
echo ; sleep 10
done

View File

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

View File

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

17
LICENCE Normal file
View File

@ -0,0 +1,17 @@
_______________________________________________________________________
/\ \
\_| 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,6 +4,7 @@
*.wav
*.text
*.png
text2wav
wav2text

View File

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

View File

@ -14,7 +14,6 @@ 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);
@ -23,7 +22,6 @@ fprintf(stderr, " | format 0x%x\n", psf->format);
return 0;
}
/* --------------------------------------------------------------- */
void print_version(char *msg)
{
fprintf(stderr, "=== %s compiled %s, %s\n", \

View File

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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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