From: Duilio J. P. <dp...@fc...> - 2005-02-16 03:09:43
Attachments:
autogen.sh
|
Ok, coming back from a long, long vacations, finally I have coded something useful (I think). Please take a look a this autogen.sh script for libvisual, testing it on a new freshly checkout. Bye, Duilio. |
From: Dennis S. <sy...@yo...> - 2005-02-16 19:54:50
|
Committed to: libvisual, libvisual-plugins, libvisual-bmp, libvisual-xmms, libvisual-widgets, libvisual-display. Damn we have a lot of modules :) Looks awesome and great, thanks a lot Duilio!!! Cheers, Dennis On Wed, 2005-02-16 at 00:22 -0300, Duilio Javier Protti wrote: > Ok, coming back from a long, long vacations, finally I have coded > something useful (I think). Please take a look a this autogen.sh script > for libvisual, testing it on a new freshly checkout. > > > Bye, > Duilio. > |
From: Burkhard P. <pl...@ip...> - 2005-03-03 13:13:16
|
Hi all, I checked the libvisual CVS to estimate, what's necessary to port lemuria to libvisual. Lemuria has 2 variables, which trigger some changes of the animations: quiet: Set to 1 if silence began in these 512 samples, 0 else beat_detected: Set to 1 if a beat was detected in these 512 samples, 0 else I have my own routine for computing these values, but I borrowed it from blursk some years ago and I think it's not the best possible beat detection. In fact I have one song with lots of beats, but lemuria detects not a single one of these :-) From what I see, they could go into the _VisAudio struct and could be computed by visual_audio_analyze(). Are there any plans to detect such "audio events" in a generic way, or should each plugin handle them itself? If someones interested, I can post my beat detection stuff here. Cheers Burkhard |
From: Dennis S. <sy...@yo...> - 2005-03-07 19:07:54
|
On Thu, 2005-03-03 at 14:17 +0100, Burkhard Plaum wrote: > Hi all, > > I checked the libvisual CVS to estimate, what's necessary to port > lemuria to libvisual. > > Lemuria has 2 variables, which trigger some changes of the animations: > > quiet: Set to 1 if silence began in these 512 samples, 0 else > beat_detected: Set to 1 if a beat was detected in these 512 samples, 0 else > > I have my own routine for computing these values, but I borrowed it from > blursk some years ago and I think it's not the best possible beat detection. > In fact I have one song with lots of beats, but lemuria detects > not a single one of these :-) > > From what I see, they could go into the _VisAudio struct and could be > computed by visual_audio_analyze(). Yep, totally agree, please clearify the 'quiet' stuff a bit more btw :) I am currently writing the proposal for the VisAudio rewrite, I will post that later in the evening. Please take a look at it :) > Are there any plans to detect such "audio events" in a generic way, or > should each plugin handle them itself? Depends, we want to provide good detection, but of course some plugins will have need for something very specific that isn't in the library. We try to implement generalized things in the lib. > If someones interested, I can post my beat detection stuff here. Please do so! |
From: Burkhard P. <pl...@ip...> - 2005-03-08 12:28:41
|
> Yep, totally agree, please clearify the 'quiet' stuff a bit more btw :) It is set to 1 if the loudness dropped to analog silence during the last processed samples. For subsequent silent frames, it's set to 0. > I am currently writing the proposal for the VisAudio rewrite, I will > post that later in the evening. Please take a look at it :) Did so, see other message. > Depends, we want to provide good detection, but of course some plugins > will have need for something very specific that isn't in the library. > > We try to implement generalized things in the lib. Ok, this is what I have now: time_buffer_read contains the pcm sampes, after the call, e->loudness, e->beat_detected and e->quiet are updated. (e is the lemuria engine which holds all data belonging to one lemuria instance). It's a copy and paste from an onld blursk version and I didn't bother yet to improve this. #define BEAT_MAX 200 /* Config values from bursk */ #define BEAT_SENSITIVITY 4 typedef struct { int32_t beathistory[BEAT_MAX]; int beatbase; int32_t aged; /* smoothed out loudness */ int32_t lowest; /* quietest point in current beat */ int elapsed; /* frames since last beat */ int isquiet; /* was previous frame quiet */ int prevbeat; /* period of previous beat */ } lemuria_analysis; static int detect_beat(lemuria_analysis * a, int32_t loudness, int *thickref, int *quietref) { int beat, i, j; int32_t total; int sensitivity; /* Incorporate the current loudness into history */ a->aged = (a->aged * 7 + loudness) >> 3; a->elapsed++; /* If silent, then clobber the beat */ if (a->aged < 2000 || a->elapsed > BEAT_MAX) { a->elapsed = 0; a->lowest = a->aged; memset(a->beathistory, 0, sizeof a->beathistory); } else if (a->aged < a->lowest) a->lowest = a->aged; /* Beats are detected by looking for a sudden loudness after a lull. * They are also limited to occur no more than once every 15 frames, * so the beat flashes don't get too annoying. */ j = (a->beatbase + a->elapsed) % BEAT_MAX; a->beathistory[j] = loudness - a->aged; beat = FALSE; if (a->elapsed > 15 && a->aged > 2000 && loudness * 4 > a->aged * 5) { /* Compute the average loudness change, assuming this is beat */ for (i = BEAT_MAX / a->elapsed, total = 0; --i > 0; j = (j + BEAT_MAX - a->elapsed) % BEAT_MAX) { total += a->beathistory[j]; } total = total * a->elapsed / BEAT_MAX; /* Tweak the sensitivity to emphasize a consistent rhythm */ sensitivity = BEAT_SENSITIVITY; i = 3 - abs(a->elapsed - a->prevbeat)/2; if (i > 0) sensitivity += i; /* If average change is significantly positive, this is a beat. */ if (total * sensitivity > a->aged) { a->prevbeat = a->elapsed; a->beatbase = (a->beatbase + a->elapsed) % BEAT_MAX; a->lowest = a->aged; a->elapsed = 0; beat = TRUE; } } /* Thickness is computed from the difference between the instantaneous * loudness and the a->aged loudness. Thus, a sudden increase in volume * will produce a thick line, regardless of rhythm. */ if (a->aged < 1500) *thickref = 0; else { *thickref = loudness * 2 / a->aged; if (*thickref > 3) *thickref = 3; } /* Silence is computed from the a->aged loudness. The quietref value is * set to TRUE only at the start of silence, not throughout the silent * period. Also, there is some hysteresis so that silence followed * by a slight noise and more silence won't count as two silent * periods -- that sort of thing happens during many fade edits, so * we have to account for it. */ if (a->aged < (a->isquiet ? 1500 : 500)) { /* Quiet now -- is this the start of quiet? */ *quietref = !a->isquiet; a->isquiet = TRUE; } else { *quietref = FALSE; a->isquiet = FALSE; } /* return the result */ return beat; } void lemuria_analysis_perform(lemuria_engine_t * e) { int i, imin, imax, start; int32_t delta_sum; lemuria_analysis * a = (lemuria_analysis*)e->analysis; /* Find the maximum and minimum, with the restriction that * the minimum must occur after the maximum. */ for (i = 1, imin = imax = 0, delta_sum = 0; i < 127 / 2; i++) { if (e->time_buffer_read[0][i] < e->time_buffer_read[0][imin]) imin = i; if (e->time_buffer_read[0][i] > e->time_buffer_read[0][imax]) imin = imax = i; delta_sum += abs(e->time_buffer_read[0][i] - e->time_buffer_read[0][i - i]); } /* Triggered sweeps start halfway between min & max */ start = (imax + imin) / 2; /* Compute the loudness. We don't want to do a full spectrum analysis * to do this, but we can guess the low-frequency sound is proportional * to the maximum difference found (because loud low frequencies need * big signal changes), and that high-frequency sound is proportional * to the differences between adjacent samples. We want to be sensitive * to both of those, while ignoring the mid-range sound. * * Because we have only one low-frequency difference, but hundreds of * high-frequency differences, we need to give more weight to the * low-frequency difference (even though each high-frequency difference * is small). */ e->loudness = (((int32_t)e->time_buffer_read[0][imax] - (int32_t)e->time_buffer_read[0][imin]) * 60 + delta_sum) / 75; e->beat_detected = detect_beat(a, e->loudness, &(e->thickness), &(e->quiet)); } -- _____________________________ Dr.-Ing. Burkhard Plaum Institut fuer Plasmaforschung Pfaffenwaldring 31 70569 Stuttgart Tel.: +49 711 685-2187 Fax.: -3102 |