diff --git a/RapportInfo2txt b/RapportInfo2txt index bd37a3124325287a72a2514fb3f5b8cd4ff90f05..eaec6d4a3e5d9220e79d216ec3cf989f36b46aaa 100755 Binary files a/RapportInfo2txt and b/RapportInfo2txt differ diff --git a/RapportInfo2txt.c b/RapportInfo2txt.c index 30c0b152f924a5dd1a2ccbf478d74c18d83b0c39..ca885ba555ac0fa6e87e92d3b33d857ed8a8220a 100755 --- a/RapportInfo2txt.c +++ b/RapportInfo2txt.c @@ -7,13 +7,14 @@ #define NTOAS_MAX 200 #define RORQUAL_SAMPLE_RATE 4000 -#define RORQUAL_LENSIG RORQUAL_SAMPLE_RATE*60 // load 60sec +#define RORQUAL_LENSIG RORQUAL_SAMPLE_RATE*30 // load 60sec #define RORQUAL_WINSIZE 4096 #define RORQUAL_LENSPEC (RORQUAL_LENSIG - RORQUAL_WINSIZE)/RORQUAL_HOPSIZE #define RORQUAL_HOPSIZE 256 #define RORQUAL_LENPRED RORQUAL_LENSPEC - (5-1)*3 //3 layers of kernel size 5 -#define RORQUAL_NSAMPLESTOSEND 3 // see cacha -#define RORQUAL_SAMPLESPERSAMPLE 8000 // see cacha +#define RORQUAL_RAPPORT_NSAMPLESTOSEND 3 // see cacha +#define RORQUAL_RAPPORT_SAMPLE_RATE 128000 +#define RORQUAL_RAPPORT_SAMPLESPERSAMPLE 256000 // see cacha #define CACHA_SAMPLE_RATE 64000 #define CACHA_LENSIG CACHA_SAMPLE_RATE*10 // load 10sec @@ -21,9 +22,11 @@ #define CACHA_LENSPEC (CACHA_LENSIG - CACHA_WINSIZE)/CACHA_HOPSIZE #define CACHA_HOPSIZE 256 #define CACHA_LENPRED (((CACHA_LENSPEC - 6)/2 - 6)/2 -6)/2 // 3 layers hopsize 2 kernel 7 -#define CACHA_NSAMPLESTOSEND 10 // a sample is positionned at a high pred from the cnn, we extract the audio signal arround to send back via network -#define CACHA_SAMPLESPERSAMPLE 6400 // number of audio samples per high pred sample to send back +#define CACHA_RAPPORT_NSAMPLESTOSEND 10 // a sample is positionned at a high pred from the cnn, we extract the audio signal arround to send back via network +#define CACHA_RAPPORT_SAMPLE_RATE 128000 +#define CACHA_RAPPORT_SAMPLESPERSAMPLE 12800// number of audio samples per high pred sample to send back +#define RAPPORT_CHANNELS 5 // number of channels recorded to include in the report typedef struct{ float predsC[CACHA_LENPRED]; //len of preds for 10sec signal @@ -33,10 +36,10 @@ typedef struct{ char fileName[50]; //Nom du fichier concerne int ToAs_cacha[NTOAS_MAX]; unsigned char hydros_ToAs_cacha[NTOAS_MAX]; - short predPeaksR[RORQUAL_NSAMPLESTOSEND]; //indices of predPeaks for rorqual - short predPeaksC[CACHA_NSAMPLESTOSEND]; //indices of predPeaks for cachalot - short int samplesR[RORQUAL_NSAMPLESTOSEND][RORQUAL_SAMPLESPERSAMPLE]; // samples to send back for rorqual - short int samplesC[CACHA_NSAMPLESTOSEND][CACHA_SAMPLESPERSAMPLE]; // samples to send back for cachalot + short predPeaksR[RORQUAL_RAPPORT_NSAMPLESTOSEND]; //indices of predPeaks for rorqual + short predPeaksC[CACHA_RAPPORT_NSAMPLESTOSEND]; //indices of predPeaks for cachalot + short int samplesR[RORQUAL_RAPPORT_NSAMPLESTOSEND][RORQUAL_RAPPORT_SAMPLESPERSAMPLE][RAPPORT_CHANNELS]; // samples to send back for rorqual + short int samplesC[CACHA_RAPPORT_NSAMPLESTOSEND][CACHA_RAPPORT_SAMPLESPERSAMPLE][RAPPORT_CHANNELS]; // samples to send back for cachalot }RAPPORT; int main(int argc, char* argv[]){ @@ -52,10 +55,10 @@ int main(int argc, char* argv[]){ printf("Failed to open output file\n"); return 0; } - RAPPORT rapport; + static RAPPORT rapport; fread(&rapport, sizeof(RAPPORT), 1, infile); printf("Writing into %s with %d fin whale pulses and %d sperm whale clicks \n", argv[1], rapport.numDetectionsRorqual, rapport.numDetectionsCachalot); - int i, j; + int i, j, k; fprintf(outfile, "Filename : %s \n", rapport.fileName); fprintf(outfile, "\n rorqual preds\n"); for(i=0; i<RORQUAL_LENPRED; i++){ @@ -67,8 +70,10 @@ int main(int argc, char* argv[]){ } fprintf(outfile, "\n rorqual samples\n"); for(i=0; i<rapport.numDetectionsRorqual; i++){ - for(j=0; j<RORQUAL_SAMPLESPERSAMPLE; j++){ - fprintf(outfile, "%hd,", rapport.samplesR[i][j]); + for(j=0; j<RORQUAL_RAPPORT_SAMPLESPERSAMPLE; j++){ + for(k=0; k<RAPPORT_CHANNELS; k++){ + // fprintf(outfile, "%hd,", rapport.samplesR[i][j][k]); + } } fprintf(outfile, "\n"); } @@ -82,8 +87,10 @@ int main(int argc, char* argv[]){ } fprintf(outfile, "\n cacha samples\n"); for(i=0; i<rapport.numDetectionsCachalot; i++){ - for(j=0; j<CACHA_SAMPLESPERSAMPLE; j++){ - fprintf(outfile, "%hd,", rapport.samplesC[i][j]); + for(j=0; j<CACHA_RAPPORT_SAMPLESPERSAMPLE; j++){ + for(k=0; k<RAPPORT_CHANNELS; k++){ + // fprintf(outfile, "%hd,", rapport.samplesC[i][j][k]); + } } fprintf(outfile, "\n"); }