-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteacher sound file
70 lines (38 loc) · 1.2 KB
/
teacher sound file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[10:07 PM] Mariam CAMARA
Code to detect the sound :
// detect_son.c†: dÈfinit le point d'entrÈe pour l'application console.
//
#include "stdio.h"
#define SIZE 10000 // Nombre d'Èchantillons du signal
#define WINDOWS 200 // Nombre d'Èchantillons utilisÈs pour calculer la puissance
#define SCALEOVERTWO 2048 // Amplitude max du signal
int main(int argc, char* argv[])
{
int i,j;
int moyenne = 0;
float power;
float powermax = 0;
int indice = 0;
// Calcul de la valeur moyenne du signal
for (i=0;i<SIZE;i++)
moyenne += Signal[i];
moyenne /= SIZE;
printf("Moyenne : %d\n",moyenne);
for (i=0;i<SIZE;i+=WINDOWS)
{
power = 0.0;
for (j=0;j<WINDOWS;j++)
{
power = (float) ((Signal[i+j]- (float) moyenne) / SCALEOVERTWO);
power = power * power;
}
if (power > powermax)
{
powermax = power;
indice = i;
}
}
printf("indice : %d powermax : %f\n",indice,powermax);
getc(stdin);
return 0;
}