Warning: session_start(): open(/var/lib/php/sessions/sess_pi9an5qouilopbd42hvlgju161, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// For audio recognition, we need a double-precision (16 bit)
// integral image. We simply turn the sample data into pixels and
// have ourselves a verybig*1 image.
srecord noeq AudioRecognizer {
interface IAudioSample {
double length();
double sampleSum(int channel, double start, double end);
}
// the 16 bit per channel integral image
class AudioSample implements IAudioSample {
int channels;
long[] data;
public double length() { ret data.length; }
public double sampleSum(int channel, double start, double end) {
int a = ifloor(start), b = ifloor(end);
ret getEntry(b)-getEntry(a);
}
public getPixel(int channel, double start, double end) {
ret doubleRatio(sampleSum, end-start);
}
// get an entry of the sum table
long getEntry(int i) {
ret data[i];
}
*(short[] samples) {
int n = l(samples);
data = new long[n];
long sum = 0;
for i to n:
data[i] = (sum += samples[i]);
}
}
}