pfeeee...
This commit is contained in:
parent
b707b784bf
commit
3f95a964e5
2
SoundBrotching/.gitignore
vendored
2
SoundBrotching/.gitignore
vendored
@ -9,9 +9,9 @@
|
|||||||
text2wav
|
text2wav
|
||||||
wav2text
|
wav2text
|
||||||
text2ao
|
text2ao
|
||||||
essai
|
|
||||||
|
|
||||||
panoramix
|
panoramix
|
||||||
genwaves
|
genwaves
|
||||||
soundbrotch
|
soundbrotch
|
||||||
|
essai
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# SoundBrotching
|
# SoundBrotching
|
||||||
|
|
||||||
Stay tuned, film at 11.
|
Stay tuned, film at 440.
|
||||||
|
|
||||||
## Cheat Code
|
## Cheat Code
|
||||||
|
|
||||||
@ -10,9 +10,9 @@ de ce sous-projet fortranique sont
|
|||||||
ecrits en C, pour un accès facile à des bibliothèques tierces
|
ecrits en C, pour un accès facile à des bibliothèques tierces
|
||||||
comme `libsndfile` ou `libao`, composants essentiels du SoundBrotching.
|
comme `libsndfile` ou `libao`, composants essentiels du SoundBrotching.
|
||||||
|
|
||||||
## Serious game
|
## Not so serious game
|
||||||
|
|
||||||
Quelques exemples simple, mais bruyants...
|
Quelques exemples simple, mais bruyants... `runme.sh`
|
||||||
|
|
||||||
### genwaves
|
### genwaves
|
||||||
|
|
||||||
|
@ -24,7 +24,17 @@ return 0;
|
|||||||
/* --------------------------------------------------------------- */
|
/* --------------------------------------------------------------- */
|
||||||
void print_version(char *msg)
|
void print_version(char *msg)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "=== %s compiled %s, %s\n", \
|
fprintf(stderr, "=== %s, support compiled %s, %s\n", \
|
||||||
msg, __DATE__, __TIME__);
|
msg, __DATE__, __TIME__);
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------- */
|
/* --------------------------------------------------------------- */
|
||||||
|
int check_textfile_validity(char *filename, int what)
|
||||||
|
{
|
||||||
|
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, filename, what);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
@ -10,4 +10,6 @@ int display_sf_info(SF_INFO *psf, char *text);
|
|||||||
|
|
||||||
void print_version(char *title);
|
void print_version(char *title);
|
||||||
|
|
||||||
|
int check_textfile_validity(char *filename, int what);
|
||||||
|
|
||||||
/* --------------------------------------------------------- */
|
/* --------------------------------------------------------- */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* TEXT TO WAV
|
* TEXT TO WAV - a klugeware from tTh 2023
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -27,7 +27,7 @@ int left, right;
|
|||||||
int nb_lus, idx;
|
int nb_lus, idx;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, outf);
|
fprintf(stderr, ">>> %s ( '%s' %d %d )\n", __func__, outf, sr, format);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (format) {
|
if (format) {
|
||||||
@ -78,11 +78,16 @@ while (2==fscanf(input, "%d %d", &left, &right)) {
|
|||||||
sf_write_short(sndf, buffer, idx);
|
sf_write_short(sndf, buffer, idx);
|
||||||
sf_close(sndf);
|
sf_close(sndf);
|
||||||
|
|
||||||
fprintf(stderr, "%s: %d buffers written\n", __func__, nb_lus);
|
free(buffer);
|
||||||
|
|
||||||
|
fprintf(stderr, "%s: %d samples written\n", __func__, nb_lus);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------- */
|
/* --------------------------------------------------------------- */
|
||||||
|
/*
|
||||||
|
* this is a preview software, so no args parsiong yet...
|
||||||
|
*/
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
@ -59,10 +59,7 @@ if ( NULL == (samples = malloc(BUFFER_SIZE*sizeof(short))) )
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( (lu=sf_read_short(sndf, samples, BUFFER_SIZE)) > 0 )
|
while ( (lu=sf_read_short(sndf, samples, BUFFER_SIZE)) > 0 ) {
|
||||||
{
|
|
||||||
// fprintf(stderr, " LU = %5u\n", lu);
|
|
||||||
|
|
||||||
for (foo=0; foo<lu; foo+=2) {
|
for (foo=0; foo<lu; foo+=2) {
|
||||||
printf("%d %d\n", samples[foo], samples[foo+1]);
|
printf("%d %d\n", samples[foo], samples[foo+1]);
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,11 @@ program essai
|
|||||||
|
|
||||||
call soundbrotch_version()
|
call soundbrotch_version()
|
||||||
|
|
||||||
do n = 20, 85
|
do n = 40, 85
|
||||||
freq = midi2freq(n)
|
freq = midi2freq(n)
|
||||||
write(0, '(12X, I5, 5X, F9.3)') n, freq
|
write(0, '(" midi", I5, " -> ", F9.3, " Hz")') n, freq
|
||||||
call sinw_burst2i(6, 22000, freq, freq, 0.9)
|
call sinw_burst2i(6, 44100, freq, freq, 0.9)
|
||||||
call silence_burst2i(800)
|
call silence_burst2i(2900)
|
||||||
end do
|
end do
|
||||||
|
|
||||||
end program
|
end program
|
||||||
|
16
SoundBrotching/runme.sh
Executable file
16
SoundBrotching/runme.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e # trap on error
|
||||||
|
|
||||||
|
DATAFILE="essai.text"
|
||||||
|
OUTWAV="essai.wav"
|
||||||
|
make essai
|
||||||
|
|
||||||
|
./essai | tee $DATAFILE | c-tools/text2wav $OUTWAV
|
||||||
|
|
||||||
|
sndfile-spectrogram \
|
||||||
|
--min-freq=30 --max-freq=2000 \
|
||||||
|
--hann \
|
||||||
|
$OUTWAV \
|
||||||
|
1200 600 \
|
||||||
|
spectrogram.png
|
@ -14,13 +14,11 @@ module soundbrotch
|
|||||||
contains
|
contains
|
||||||
! ---------------------------------------------------------
|
! ---------------------------------------------------------
|
||||||
subroutine soundbrotch_version ()
|
subroutine soundbrotch_version ()
|
||||||
write(0, '(1X,A)') "--- this is soundbrotch version alpha 666"
|
write(0, '(1X,A)') "--- this is soundbrotch version alpha 667"
|
||||||
write(0, *) "--- samplerate", samplerate
|
write(0, *) "--- samplerate", samplerate
|
||||||
write(0, *) "--- diapason ", diapason
|
write(0, *) "--- diapason ", diapason
|
||||||
end subroutine
|
end subroutine
|
||||||
! ---------------------------------------------------------
|
! ---------------------------------------------------------
|
||||||
! ---------------------------------------------------------
|
|
||||||
|
|
||||||
! ---------------------------------------------------------
|
! ---------------------------------------------------------
|
||||||
! premier essai, le prototype peut changer !
|
! premier essai, le prototype peut changer !
|
||||||
|
|
||||||
@ -33,8 +31,9 @@ module soundbrotch
|
|||||||
integer :: idx, left, right
|
integer :: idx, left, right
|
||||||
real :: coef
|
real :: coef
|
||||||
|
|
||||||
|
! XXX temporary dirty hack
|
||||||
if (dst .NE. 6) then
|
if (dst .NE. 6) then
|
||||||
STOP ' OUPS!'
|
STOP ' OUPS, NOT ON STDOUT!'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
coef = (3.141592654 * 2.0) / real(samplerate)
|
coef = (3.141592654 * 2.0) / real(samplerate)
|
||||||
|
Loading…
Reference in New Issue
Block a user