Compare commits
	
		
			3 Commits
		
	
	
		
			d5ad74cf77
			...
			a693302969
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					a693302969 | ||
| 
						 | 
					f442fde5ff | ||
| 
						 | 
					b7fdfa6122 | 
							
								
								
									
										21
									
								
								Fraktalism/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Fraktalism/README.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										130
									
								
								Fraktalism/mkmandel.f90
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										130
									
								
								Fraktalism/mkmandel.f90
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,130 @@
 | 
			
		||||
!-----------------------------------------------------
 | 
			
		||||
!		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,3 +1,23 @@
 | 
			
		||||
# Fortraneries
 | 
			
		||||
 | 
			
		||||
Le fortran moderne, c'est quand même assez cool, alors autant diffuser mes gruikeries.
 | 
			
		||||
Le Fortran moderne, c'est quand même assez cool, alors autant diffuser
 | 
			
		||||
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
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								SoundBrotching/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
			
		||||
#
 | 
			
		||||
#   please ignore those files
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
*.wav
 | 
			
		||||
*.text
 | 
			
		||||
 | 
			
		||||
text2wav
 | 
			
		||||
wav2text
 | 
			
		||||
text2ao
 | 
			
		||||
 | 
			
		||||
panoramix
 | 
			
		||||
genwaves
 | 
			
		||||
soundbrotch
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,46 @@
 | 
			
		||||
#
 | 
			
		||||
#     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,3 +2,10 @@
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								SoundBrotching/demos.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										8
									
								
								SoundBrotching/demos.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
INWAV="1637.wav"
 | 
			
		||||
OUTWAV="foo.wav"
 | 
			
		||||
 | 
			
		||||
./wav2text $INWAV | ./panoramix | ./text2wav $OUTWAV
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								SoundBrotching/genwaves.f90
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								SoundBrotching/genwaves.f90
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
			
		||||
program genwaves
 | 
			
		||||
 | 
			
		||||
  use soundbrotch
 | 
			
		||||
  ! -----------------------------
 | 
			
		||||
 | 
			
		||||
  implicit none
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  print *, "genwaves is coming soon..."
 | 
			
		||||
 | 
			
		||||
  call soundbrotch_version()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
end program
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								SoundBrotching/panoramix.f90
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								SoundBrotching/panoramix.f90
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
 | 
			
		||||
program panoramix
 | 
			
		||||
 | 
			
		||||
  implicit none
 | 
			
		||||
 | 
			
		||||
  print *, "Panoramix coming soon..."
 | 
			
		||||
 | 
			
		||||
end program
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								SoundBrotching/soundbrotch.f90
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								SoundBrotching/soundbrotch.f90
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
module soundbrotch
 | 
			
		||||
 | 
			
		||||
  implicit none
 | 
			
		||||
 | 
			
		||||
  contains
 | 
			
		||||
 | 
			
		||||
  ! ---------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
  subroutine soundbrotch_version ()
 | 
			
		||||
 | 
			
		||||
    write(0, '(A)') "*** this is soundbrotch version alpha"
 | 
			
		||||
 | 
			
		||||
  end subroutine
 | 
			
		||||
 | 
			
		||||
  ! ---------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
end module
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										31
									
								
								SoundBrotching/support.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								SoundBrotching/support.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,31 @@
 | 
			
		||||
/*
 | 
			
		||||
 *	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__);
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------- */
 | 
			
		||||
							
								
								
									
										13
									
								
								SoundBrotching/support.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								SoundBrotching/support.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
/*
 | 
			
		||||
 *	C SUPPORT FUNCTIONS
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define		BUFFER_SIZE	8192
 | 
			
		||||
 | 
			
		||||
/* --------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
int display_sf_info(SF_INFO *psf, char *text);
 | 
			
		||||
 | 
			
		||||
void print_version(char *title);
 | 
			
		||||
 | 
			
		||||
/* --------------------------------------------------------- */
 | 
			
		||||
							
								
								
									
										21
									
								
								SoundBrotching/text2ao.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								SoundBrotching/text2ao.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
/*
 | 
			
		||||
 *		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;
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------- */
 | 
			
		||||
							
								
								
									
										34
									
								
								SoundBrotching/text2wav.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								SoundBrotching/text2wav.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
			
		||||
/*
 | 
			
		||||
 *	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;
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------- */
 | 
			
		||||
							
								
								
									
										81
									
								
								SoundBrotching/wav2text.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								SoundBrotching/wav2text.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,81 @@
 | 
			
		||||
/*
 | 
			
		||||
 *	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;
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------- */
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user