From 123b97cce2776635cb6588a9fff3980a2a6ade35 Mon Sep 17 00:00:00 2001 From: tTh Date: Mon, 18 Dec 2023 00:49:51 +0100 Subject: [PATCH] add a more compact display --- SoundBrotching/c-tools/README.md | 7 ++++++- SoundBrotching/c-tools/support.c | 18 ++++++++++++------ SoundBrotching/c-tools/support.h | 2 +- SoundBrotching/c-tools/wav2text.c | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/SoundBrotching/c-tools/README.md b/SoundBrotching/c-tools/README.md index c64ce68..98b835e 100644 --- a/SoundBrotching/c-tools/README.md +++ b/SoundBrotching/c-tools/README.md @@ -4,7 +4,12 @@ Support utilities for SoundBrotching. ### wav2text -Conversion d'un fichier son en text machinable. +Conversion d'un fichier son en texte machinable, actuellement +en *space separated*, directement utilisable par `Awk`. +Un export `csv` est planifié. Ce prgramme ne prend +pas (encore) d'options. + +Usage : `wav2txt 1337.wav > fichier.txt` ### text2wav diff --git a/SoundBrotching/c-tools/support.c b/SoundBrotching/c-tools/support.c index 73036cd..355ed58 100644 --- a/SoundBrotching/c-tools/support.c +++ b/SoundBrotching/c-tools/support.c @@ -10,14 +10,20 @@ #include "support.h" /* --------------------------------------------------------------- */ -int display_sf_info(SF_INFO *psf, char *text) +int display_sf_info(SF_INFO *psf, char *text, int bla) { -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); -fprintf(stderr, " | format 0x%x\n", psf->format); +if (bla) { + 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); + fprintf(stderr, " | format 0x%x\n", psf->format); + } +else { + fprintf(stderr, "%-25s %6d %2d %10ld 0x%x\n", text, \ + psf->samplerate, psf->channels, psf->frames, psf->format); + } return 0; } diff --git a/SoundBrotching/c-tools/support.h b/SoundBrotching/c-tools/support.h index 5e771b9..837137c 100644 --- a/SoundBrotching/c-tools/support.h +++ b/SoundBrotching/c-tools/support.h @@ -6,7 +6,7 @@ /* --------------------------------------------------------- */ -int display_sf_info(SF_INFO *psf, char *text); +int display_sf_info(SF_INFO *psf, char *text, int bla); void print_version(char *title); diff --git a/SoundBrotching/c-tools/wav2text.c b/SoundBrotching/c-tools/wav2text.c index 1ed2377..ffb220f 100644 --- a/SoundBrotching/c-tools/wav2text.c +++ b/SoundBrotching/c-tools/wav2text.c @@ -41,7 +41,7 @@ if (sndf==NULL) exit(1); } -foo = display_sf_info(&sfinfo, infname); +foo = display_sf_info(&sfinfo, infname, 0); if (foo) { fprintf(stderr, "%s: corrupted sf_info ?\n", __func__); abort(); @@ -83,6 +83,7 @@ int main(int argc, char *argv[]) { int foo; int format = 0; + print_version(argv[0]); if (2 != argc) usage();