Porovnat revize
	
		
			Žádné společné commity. „a6933029695b4173122a7dccdc6fb4f638f1c112“ a „d5ad74cf77471f8855d6ba182c18898bc5555105“ mají zcela odlišnou historii.
		
	
	
		
			a693302969
			...
			d5ad74cf77
		
	
		
@ -1,21 +0,0 @@
 | 
				
			|||||||
# Fraktalism
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Iterative computing inside !
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Voyons d'abord
 | 
					 | 
				
			||||||
[une vidéo](http://la.buvette.org/fractales/f90/video.html)
 | 
					 | 
				
			||||||
qui montre ma première expérience dans ce domaine.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## La technique
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Le gros des calculs de fractales est fait dans XXX, et la gestion
 | 
					 | 
				
			||||||
des pixels 'physiques' est fait dans YYY
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Des scripts _shell_ sont utilisés pour construire les vidéos.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## TODO
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- Voir de près le calcul du cadrage 
 | 
					 | 
				
			||||||
- Rajouter des formules
 | 
					 | 
				
			||||||
- Ne pas procastiner
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,130 +0,0 @@
 | 
				
			|||||||
!-----------------------------------------------------
 | 
					 | 
				
			||||||
!		IMAGE PROCESSING
 | 
					 | 
				
			||||||
!-----------------------------------------------------
 | 
					 | 
				
			||||||
!-----------------------------------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
subroutine plotsomething(pic, start, cz)
 | 
					 | 
				
			||||||
    use cmplxmath
 | 
					 | 
				
			||||||
    use imagetools
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    implicit none
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    integer, intent(inout), dimension (:,:)  ::  pic
 | 
					 | 
				
			||||||
    complex, intent(in)                      ::  start
 | 
					 | 
				
			||||||
    type (CenterMag), intent(in)             :: cz
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    integer   :: ix, iy, width, height
 | 
					 | 
				
			||||||
    real      :: fx, fy, mod2
 | 
					 | 
				
			||||||
    complex   :: za, zb, cste
 | 
					 | 
				
			||||||
    integer   :: iter, maxiter
 | 
					 | 
				
			||||||
    logical   :: escape
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    print *, "> plotsomething"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    width  = ubound(pic, 1)
 | 
					 | 
				
			||||||
    height = ubound(pic, 2)
 | 
					 | 
				
			||||||
    print *, "  pic size ", width, height
 | 
					 | 
				
			||||||
    print *, "  start ", start
 | 
					 | 
				
			||||||
    call print_centermag(cz)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    !   initialise constants
 | 
					 | 
				
			||||||
    ! 
 | 
					 | 
				
			||||||
    maxiter =  999;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    !   enter megaloop
 | 
					 | 
				
			||||||
    ! 
 | 
					 | 
				
			||||||
    do iy = 1, height
 | 
					 | 
				
			||||||
        fy = (float(iy) / float(height/3)) - 1.5
 | 
					 | 
				
			||||||
        !! print *, "line  ", iy, fy
 | 
					 | 
				
			||||||
        do ix = 1, width
 | 
					 | 
				
			||||||
            fx = (float(ix) / float(width/3)) - 2.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            !! print *, "pixel ", ix, iy, " at ", fx, fy
 | 
					 | 
				
			||||||
            !-------------------------------------
 | 
					 | 
				
			||||||
            !     working on the current pixel
 | 
					 | 
				
			||||||
            za   = start
 | 
					 | 
				
			||||||
            cste = complex ( fx, fy )
 | 
					 | 
				
			||||||
            iter = 0
 | 
					 | 
				
			||||||
            escape = .FALSE.
 | 
					 | 
				
			||||||
            do while (iter .lt. maxiter)
 | 
					 | 
				
			||||||
                zb = (za * za) + cste
 | 
					 | 
				
			||||||
                ! if (modulus2(zb) .gt. 4.0) then
 | 
					 | 
				
			||||||
                mod2 =  real(zb)*real(zb) + aimag(zb)*aimag(zb)
 | 
					 | 
				
			||||||
                !! print *, "mod2  ", mod2
 | 
					 | 
				
			||||||
                if (mod2 .GT. 4.0) then
 | 
					 | 
				
			||||||
                    escape = .TRUE.
 | 
					 | 
				
			||||||
                    exit
 | 
					 | 
				
			||||||
                endif
 | 
					 | 
				
			||||||
                za = zb
 | 
					 | 
				
			||||||
                iter = iter + 1
 | 
					 | 
				
			||||||
                !! print *, "ZA ITER ESCAPE", za, iter, escape
 | 
					 | 
				
			||||||
            enddo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (escape) then
 | 
					 | 
				
			||||||
                pic(ix, iy) = mod(iter, 333)
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
                ! esoteric computation here
 | 
					 | 
				
			||||||
                ! pic(ix, iy) = mod(8*floor(mod2*11.11), 24)
 | 
					 | 
				
			||||||
                pic(ix, iy) = mod(iter, 222)
 | 
					 | 
				
			||||||
            endif
 | 
					 | 
				
			||||||
            !-------------------------------------
 | 
					 | 
				
			||||||
        end do           ! fin boucle sur X
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    end do
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
!-----------------------------------------------------
 | 
					 | 
				
			||||||
! 
 | 
					 | 
				
			||||||
!    this is the main programm
 | 
					 | 
				
			||||||
! 
 | 
					 | 
				
			||||||
program image
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    use imagetools
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    implicit none
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    interface
 | 
					 | 
				
			||||||
      subroutine plotsomething (pic, start, cz)
 | 
					 | 
				
			||||||
          use imagetools
 | 
					 | 
				
			||||||
          integer,   intent(inout), dimension (:,:) ::  pic
 | 
					 | 
				
			||||||
          complex,   intent(in)                     ::  start
 | 
					 | 
				
			||||||
          type (CenterMag), intent(in)              :: cz
 | 
					 | 
				
			||||||
      end subroutine plotsomething
 | 
					 | 
				
			||||||
    end interface
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    integer, dimension(768, 768)    ::    picz
 | 
					 | 
				
			||||||
    type (CenterMag)                ::    cm
 | 
					 | 
				
			||||||
    integer                         ::    angle
 | 
					 | 
				
			||||||
    real                            ::    radangle, radius
 | 
					 | 
				
			||||||
    real                            ::    stx, sty
 | 
					 | 
				
			||||||
    character (len=80)              ::    filename
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    cm%cx    = 0.0 ; cm%cy    = 0.0 ;  cm%mag   = 3.0
 | 
					 | 
				
			||||||
    picz = 0                ! clear screen
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    print *, "-------- making some mandelbrot -------"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    do angle = 0, 1800
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        radangle = float(angle) * 0.017453292522222
 | 
					 | 
				
			||||||
        radius   = float(angle) / 2000.0
 | 
					 | 
				
			||||||
        write (filename, "(a, i5.5, a)") "img/", angle, ".pnm"
 | 
					 | 
				
			||||||
        ! filename = trim(filename)
 | 
					 | 
				
			||||||
        print *, "#### passe ", angle, radangle, trim(filename)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        stx = radius * sin(radangle*4.0)
 | 
					 | 
				
			||||||
        sty = radius * cos(radangle*3.0)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        call plotsomething (picz, complex(stx, sty), cm)
 | 
					 | 
				
			||||||
        call spitaspnm (picz, trim(filename))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        print *
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    enddo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    print *, "[DONE]"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
!-----------------------------------------------------
 | 
					 | 
				
			||||||
							
								
								
									
										22
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								README.md
									
									
									
									
									
								
							@ -1,23 +1,3 @@
 | 
				
			|||||||
# Fortraneries
 | 
					# Fortraneries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Le Fortran moderne, c'est quand même assez cool, alors autant diffuser
 | 
					Le fortran moderne, c'est quand même assez cool, alors autant diffuser mes gruikeries.
 | 
				
			||||||
mes gruikeries.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
J'ai découvert le Fortran moderne lors de mon reclufinement
 | 
					 | 
				
			||||||
de Janvier 2022, et j'ai bien aimé. Bon, contrairement à la
 | 
					 | 
				
			||||||
version de 77, les `GOTO`s sont moins agréables à faire, mais
 | 
					 | 
				
			||||||
l'existence des _pointeurs_ compense largement.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## content
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- [SoundBrotching](SoundBrotching/) : faire gémir vos tympans
 | 
					 | 
				
			||||||
- [BloubWorld](BloubWorld/) : la vie des particules
 | 
					 | 
				
			||||||
- [Fraktalism](Fraktalism/) : du chaos dans les pixels
 | 
					 | 
				
			||||||
- [RandomStuff](RandomStuff) : on a tous droit à notre jardin secret
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## hotline
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- Le canal `#tetalab` sur le réseau IRC de
 | 
					 | 
				
			||||||
[Libera](https://libera.chat/)
 | 
					 | 
				
			||||||
- La [mailing-list publique](https://lists.tetalab.org/mailman/listinfo/tetalab) du Tetalab.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
							
								
								
									
										15
									
								
								SoundBrotching/.gitignore
									
									
									
									
										vendorováno
									
									
								
							
							
						
						
									
										15
									
								
								SoundBrotching/.gitignore
									
									
									
									
										vendorováno
									
									
								
							@ -1,15 +0,0 @@
 | 
				
			|||||||
#
 | 
					 | 
				
			||||||
#   please ignore those files
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
*.wav
 | 
					 | 
				
			||||||
*.text
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
text2wav
 | 
					 | 
				
			||||||
wav2text
 | 
					 | 
				
			||||||
text2ao
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
panoramix
 | 
					 | 
				
			||||||
genwaves
 | 
					 | 
				
			||||||
soundbrotch
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,46 +0,0 @@
 | 
				
			|||||||
#
 | 
					 | 
				
			||||||
#     tth@konrad:~/Devel/Fortraneries/SoundBrotching$
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
COPT = -Wall -Wextra -g -DDEBUG_LEVEL=1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
all:	text2wav wav2text text2ao		\
 | 
					 | 
				
			||||||
	panoramix genwaves 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# ----------------------------------------------------------
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#	C tools
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
CLIBS = -lsndfile support.o
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
support.o:	support.c Makefile support.h
 | 
					 | 
				
			||||||
	gcc $(COPT) -c $<
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
text2wav:	text2wav.c Makefile support.h support.o
 | 
					 | 
				
			||||||
	gcc $(COPT) $< $(CLIBS) -o $@
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wav2text:	wav2text.c Makefile support.h support.o
 | 
					 | 
				
			||||||
	gcc $(COPT) $< $(CLIBS) -o $@
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
text2ao:	text2ao.c Makefile support.h support.o
 | 
					 | 
				
			||||||
	gcc $(COPT) $< $(CLIBS) -o $@
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# ----------------------------------------------------------
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#	real softwares
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
FLIBS = soundbrotch.o
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
soundbrotch.o:	soundbrotch.f90 Makefile
 | 
					 | 
				
			||||||
	gfortran $(COPT) -c $< 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
panoramix:	panoramix.f90 Makefile $(FLIBS)
 | 
					 | 
				
			||||||
	gfortran $(COPT) $< $(FLIBS) -o $@
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
genwaves:	genwaves.f90 Makefile  $(FLIBS)
 | 
					 | 
				
			||||||
	gfortran $(COPT) $< $(FLIBS) -o $@
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# ----------------------------------------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# ----------------------------------------------------------
 | 
					 | 
				
			||||||
@ -2,10 +2,3 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Stay tuned, film at 11.
 | 
					Stay tuned, film at 11.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Cheat Code
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Certains composants de ce sous-projet fortranique sont
 | 
					 | 
				
			||||||
(pour le moment)
 | 
					 | 
				
			||||||
ecrits en C, pour un accès facile à des bibliothèques tierces
 | 
					 | 
				
			||||||
comme `libsndfile`, composant essentiel du SoundBrotching.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
INWAV="1637.wav"
 | 
					 | 
				
			||||||
OUTWAV="foo.wav"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
./wav2text $INWAV | ./panoramix | ./text2wav $OUTWAV
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,15 +0,0 @@
 | 
				
			|||||||
program genwaves
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  use soundbrotch
 | 
					 | 
				
			||||||
  ! -----------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  implicit none
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  print *, "genwaves is coming soon..."
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  call soundbrotch_version()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
end program
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,9 +0,0 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
program panoramix
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  implicit none
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  print *, "Panoramix coming soon..."
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
end program
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,18 +0,0 @@
 | 
				
			|||||||
module soundbrotch
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  implicit none
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  contains
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ! ---------------------------------------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  subroutine soundbrotch_version ()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    write(0, '(A)') "*** this is soundbrotch version alpha"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  end subroutine
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ! ---------------------------------------------------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
end module
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,31 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *	C SUPPORT FUNCTIONS
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include  <stdio.h>
 | 
					 | 
				
			||||||
#include  <stdlib.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include   <sndfile.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#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              %d\n", psf->frames);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
return 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
/* --------------------------------------------------------------- */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void print_version(char *msg)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
fprintf(stderr, "======== %s === compiled %s, %s\n",	\
 | 
					 | 
				
			||||||
			msg, __DATE__, __TIME__);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
/* --------------------------------------------------------------- */
 | 
					 | 
				
			||||||
@ -1,13 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *	C SUPPORT FUNCTIONS
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define		BUFFER_SIZE	8192
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* --------------------------------------------------------- */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int display_sf_info(SF_INFO *psf, char *text);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void print_version(char *title);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* --------------------------------------------------------- */
 | 
					 | 
				
			||||||
@ -1,21 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *		TEXT TO AUDIO OUTPUT
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include  <stdio.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include   <sndfile.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include  "support.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* --------------------------------------------------------------- */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* --------------------------------------------------------------- */
 | 
					 | 
				
			||||||
int main(int argc, char *argv[])
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
print_version(argv[0]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
return 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
/* --------------------------------------------------------------- */
 | 
					 | 
				
			||||||
@ -1,34 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *	TEXT TO WAV
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include  <stdio.h>
 | 
					 | 
				
			||||||
#include  <stdlib.h>
 | 
					 | 
				
			||||||
#include   <sndfile.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#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;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
/* --------------------------------------------------------------- */
 | 
					 | 
				
			||||||
@ -1,81 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 *	WAV TO TEXT
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include  <stdio.h>
 | 
					 | 
				
			||||||
#include  <stdlib.h>
 | 
					 | 
				
			||||||
#include  <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include  <sndfile.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#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;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
/* --------------------------------------------------------------- */
 | 
					 | 
				
			||||||
		Načítá se…
	
		Odkázat v novém úkolu
	
	Zablokovat Uživatele