boilerplate in progress
This commit is contained in:
parent
f442fde5ff
commit
a693302969
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