Compare commits

..

No commits in common. "cac558181fa1beafb8cb0d9b25542ccb41885137" and "054715a9606a90c3585bc09c6f4a5067bde16757" have entirely different histories.

11 changed files with 26 additions and 89 deletions

1
.gitignore vendored
View File

@ -37,5 +37,4 @@ ui/t
Beep/alguabeep Beep/alguabeep
Beep/*.log Beep/*.log
Beep/foo.html

View File

@ -1,10 +1,3 @@
#
# _ _ ____ _ _ _ ____ _____ _____ ____
# / \ ! ! / ___! ! ! ! / \ ! __ )! ____! ____! _ \
# / _ \ ! ! ! ! _! ! ! !/ _ \ ! _ \! _! ! _! ! !_) !
# / ___ \! !__! !_! ! !_! / ___ \! !_) ! !___! !___! __/
# /_/ \_\_____\____!\___/_/ \_\____/!_____!_____!_!
#
CC = gcc CC = gcc

View File

@ -1,22 +1,11 @@
# AlguaBeep # AlguaBeep
C'est une expérimentation hasardeuse pour traduire des images de webcam Une expérimentation hasardeuse pour traduire des images de webcam
en sons qui déchirent les oreilles, mais qui sont relativement en sons qui déchirent les oreilles, mais qui sont bio-dégradables.
inoffensifs.
Pour le moment, il n'y a pas de procédure d'installation, il faut
donc lancer le binaire à partir du répertoire de dèv :
`~/Devel/DD2-monitor/Beep/alguabeep [options]`, ce qui implique
de ne pas aller mettre la grouille dans ce coin-là.
Ensuite, pour apprécier pleinement la kitchitude (assumée) de l'affichage
numérique de la machinerie en action, il faut un `xterm` en 150 caractères
de large, et une toute petite fonte.
## Usage ## Usage
``` ```
available options:
-d /dev/? select video device -d /dev/? select video device
-I take pictures -I take pictures
-K set the K parameter -K set the K parameter
@ -50,10 +39,5 @@ En cas de problème sur l'acquisition vidéo, dans un terminal,
tapez `ffplay /dev/videoN`, avec `N` de zéro à quatre. Vous tapez `ffplay /dev/videoN`, avec `N` de zéro à quatre. Vous
tomberez peut-être sur l'image désirée. tomberez peut-être sur l'image désirée.
En cas de système muet, il faut aller voir avec `alsamixer` si la sortie
par défaut n'est pas en `mute`, mais il faut aussi parfois aller négocier
avec _pulseaudio_ et sa logique étrange. Bon courage.
Et surtout que la maman des algues reste CALME ! Et surtout que la maman des algues reste CALME !

View File

@ -1,10 +1,4 @@
/* /* V4L2 video picture grabber
A crude sound experiment, by Clairchanoir et tTh
approimatively based on :
V4L2 video picture grabber
Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@infradead.org> Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@infradead.org>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@ -64,14 +58,14 @@ do {
} while (r == -1 && ((errno == EINTR) || (errno == EAGAIN))); } while (r == -1 && ((errno == EINTR) || (errno == EAGAIN)));
if (r == -1) { if (r == -1) {
fprintf(stderr, "%s: error %d, %s\n", __func__, errno, strerror(errno)); fprintf(stderr, "error %d, %s\n", errno, strerror(errno));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
void help(int v) void help(int v)
{ {
puts("available options:"); puts("options :");
puts("\t-d /dev/?\tselect video device"); puts("\t-d /dev/?\tselect video device");
puts("\t-I\t\ttake pictures"); puts("\t-I\t\ttake pictures");
puts("\t-K\t\tset the K parameter"); puts("\t-K\t\tset the K parameter");
@ -206,7 +200,7 @@ initialise_ecran(0);
type = V4L2_BUF_TYPE_VIDEO_CAPTURE; type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
xioctl(fd, VIDIOC_STREAMON, &type); xioctl(fd, VIDIOC_STREAMON, &type);
sprintf(chaine, "entering main loop, %9d iters\n", nbre_capt); sprintf(chaine, "entering main loop, %d iters\n", nbre_capt);
mvaddstr(1, 0, chaine); mvaddstr(1, 0, chaine);
refresh(); refresh();
fprintf(stderr, "%s\n", chaine); fprintf(stderr, "%s\n", chaine);
@ -249,8 +243,8 @@ for (i = 0; i < nbre_capt; i++) {
// fmt.fmt.pix.width, fmt.fmt.pix.height, K); // fmt.fmt.pix.width, fmt.fmt.pix.height, K);
if (mk_img) { if (mk_img) {
sprintf(out_name, "o/out%04d.ppm", i); sprintf(out_name, "i/out%04d.ppm", i);
if (verbosity) fprintf(stderr, "\t--> %s\n", out_name); if (verbosity) fprintf(stderr, "--> %s\n", out_name);
fout = fopen(out_name, "w"); fout = fopen(out_name, "w");
if (!fout) { if (!fout) {
@ -263,10 +257,6 @@ for (i = 0; i < nbre_capt; i++) {
fclose(fout); fclose(fout);
} }
/* XXX CRITICAL BUG XXX
Doc say 'period can be real', so why not
use nanosleep(2) ?
*/
if (nbre_capt > 1 && period) { if (nbre_capt > 1 && period) {
sleep(period); sleep(period);
} }

View File

@ -1,10 +1,4 @@
/*
* Ugly hack made for AlguaBeep
*
* +++++++++++++++++++++++++++++++++++++++++
* + DO NOT USE IN REAL LIFE +
* +++++++++++++++++++++++++++++++++++++++++
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -33,10 +27,10 @@ if (-1 == ioctl (fd, VIDIOC_QUERYCTRL, &queryctrl)) {
perror ("VIDIOC_QUERYCTRL"); perror ("VIDIOC_QUERYCTRL");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} else { } else {
fprintf (stderr, "V4L2_CID_BRIGHTNESS is not supported\n"); printf ("V4L2_CID_BRIGHTNESS is not supported\n");
} }
} else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) { } else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) {
fprintf (stderr, "V4L2_CID_BRIGHTNESS is not supported\n"); printf ("V4L2_CID_BRIGHTNESS is not supported\n");
} else { } else {
memset (&control, 0, sizeof (control)); memset (&control, 0, sizeof (control));
control.id = V4L2_CID_BRIGHTNESS; control.id = V4L2_CID_BRIGHTNESS;

View File

@ -1,8 +1,3 @@
/*
* AlguaBeep is a cool project.
* merci clairchanoir.
*/
/* /*
* various V4L2 functions * various V4L2 functions
*/ */

View File

@ -1,6 +1,3 @@
/*
* un module 'curses' de AlguaBeep
*/
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -21,7 +18,7 @@ keypad(stdscr, TRUE); /* acces aux touches 'curseur' */
atexit(finish); atexit(finish);
sprintf(chaine, " AlguaBeep (%s %s) pid=%d \n", __DATE__, __TIME__, sprintf(chaine, " alguabeep (%s %s) pid=%d \n", __DATE__, __TIME__,
getpid()); getpid());
standout(); mvaddstr(0, 0, chaine); standend(); standout(); mvaddstr(0, 0, chaine); standend();

View File

@ -1,9 +1,5 @@
/* /*
* algua beep module * algua beep module
*
* il faut etre honnete, mais ce module m'interpelle, parce
* ce que je ne comprend plus l'intention premiere.
*
*/ */
#include <stdio.h> #include <stdio.h>

View File

@ -1,7 +1,5 @@
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/*
* did you'v got funk with this funcs.h file ?
*/
typedef struct { typedef struct {
int x, y, w, h; int x, y, w, h;
} Rect; } Rect;

View File

@ -28,9 +28,6 @@ static ao_sample_format format;
static double debut; static double debut;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/*
* what is the meaning of the 'K' parameter ?
*/
int init_process(int K) int init_process(int K)
{ {
// int foo; // int foo;
@ -53,7 +50,7 @@ format.rate = 44100;
format.byte_format = AO_FMT_LITTLE; format.byte_format = AO_FMT_LITTLE;
device = ao_open_live(default_driver, &format, NULL); device = ao_open_live(default_driver, &format, NULL);
if (device == NULL) { if (device == NULL) {
fprintf(stderr, "%s: Error opening AO device.\n", __func__); fprintf(stderr, "Error opening AO device.\n");
return -1; return -1;
} }
@ -72,8 +69,8 @@ typedef struct {
static int cmp_datums(const void *a, const void *b) static int cmp_datums(const void *a, const void *b)
{ {
Datum *pa = (Datum *)a; /* nice */ Datum *pa = (Datum *)a;
Datum *pb = (Datum *)b; /* code */ Datum *pb = (Datum *)b;
return pa->v < pb->v; return pa->v < pb->v;
} }
@ -98,7 +95,7 @@ return 30.0* (1.0 / (double)i); /* please explain */
static int generate_samples(short *where, int size, Datum *datas) static int generate_samples(short *where, int size, Datum *datas)
{ {
int loop; int loop;
short svalue; short value;
double vol; double vol;
char chaine[100]; char chaine[100];
@ -111,26 +108,24 @@ for (loop=0; loop<size; loop++) {
/* LEFT */ /* LEFT */
vol = 10000.0 * pow(datas[0].v / 256.0, 2.0); vol = 10000.0 * pow(datas[0].v / 256.0, 2.0);
svalue = (short)(sin((double)loop*i2freq(datas[0].y)) * vol); value = (short)(sin((double)loop*i2freq(datas[0].y)) * vol);
*where++ = svalue; *where++ = value;
/* RIGHT */ /* RIGHT */
vol = 10000.0 * pow(datas[1].v / 256.0, 2.0); vol = 10000.0 * pow(datas[1].v / 256.0, 2.0);
svalue = (short)(sin((double)loop*i2freq(datas[1].y)) * vol); value = (short)(sin((double)loop*i2freq(datas[1].y)) * vol);
*where++ = svalue; *where++ = value;
} }
sprintf(chaine, "sample %6.3f = %7d", vol, svalue); sprintf(chaine, "sample %6.3f = %7d", vol, value);
mvaddstr(35, 0, chaine); mvaddstr(35, 0, chaine);
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/*
* PLEASE EXPLAIN !
*/
int charcuteur(unsigned char *datas, int w, int h, int K) int charcuteur(unsigned char *datas, int w, int h, int K)
{ {
@ -171,7 +166,7 @@ for (bigR=0; bigR<nbR; bigR++) {
mvaddstr(SL+1+bigR*DL, SC+bigC*DC, chaine); mvaddstr(SL+1+bigR*DL, SC+bigC*DC, chaine);
idx++; idx++;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "%s: %6d %6d %6d\n", __func__, bigR, bigC, idx); fprintf(stderr, "%s %6d %6d %6d\n", __func__, bigR, bigC, idx);
#endif #endif
} }
} }
@ -181,7 +176,7 @@ qsort(vals, nbR*nbC, sizeof(Datum), cmp_datums);
for (idx=0; idx<16; idx++) { for (idx=0; idx<16; idx++) {
sprintf(chaine, "%2d %2d %6.2f", vals[idx].x, vals[idx].y, sprintf(chaine, "%2d %2d %6.2f", vals[idx].x, vals[idx].y,
vals[idx].v); vals[idx].v);
mvaddstr(5+idx, 130, chaine); /* XXX why 130 ? */ mvaddstr(5+idx, 130, chaine);
} }
/* *** sound generator ***/ /* *** sound generator ***/

View File

@ -1,7 +1,3 @@
/*
* AlguaBeep is a cool project.
* merci clairchanoir.
*/
double dtime(void); double dtime(void);