Select Git revision
en_annotations.tsv
-
Sebastien Delecraz authored
correction of english corpus (add missing examples from conll format) and switch from json to tsv format
Sebastien Delecraz authoredcorrection of english corpus (add missing examples from conll format) and switch from json to tsv format
log2wav.c 9.27 KiB
// Jan. 2021
// by paul, inspired / recycled from microchip code by SMIOT
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#define MAX_PERIPHERAL 5 //Nombre max de peripheriques externes
typedef struct{
char Type; //type du peripherique (0x01 accel, 0x02 gyro, 0x03 magneto, 0x04 temperature, 0x05 pressure, 0x06 light,...)
char ID; //ID du peripherique
char Range; //Range de la mesure (ex: 2G, 4G, 6G, 8G, 16G pour un accel)
char Resolution; //Resolution de mesure du peripherique
short Frequency; //Frequence d'echantillonage du peripherique
}PERIPHERAL_CONFIGURATION;
typedef struct{
int headerSize; //Taille du header ce champ exclu
int versionNumber;
char numberOfChan;
char resolutionBits;
int samplingFrequency;
int dmaBlockSize;
int sizeOfAdditionnalDataBuffer;
char numberOfExternalPeripheral;
int timeStampOfStart;
PERIPHERAL_CONFIGURATION periphConfig[MAX_PERIPHERAL];
}HighBlueHeader;
struct WaveHeader_s {
char chunkId[4]; // Riff Wave Header
int chunkSize;
char format[4];
char subChunk1Id[4]; // Format Subchunk
int subChunk1Size;
short int audioFormat;
short int numChannels;
int sampleRate;
int byteRate;
short int blockAlign;
short int bitsPerSample;
//short int extraParamSize;
char subChunk2Id[4]; // Data Subchunk
int subChunk2Size;
} WaveHeader_default = {{'R','I','F','F'}, 36, {'W','A','V','E'}, {'f','m','t',' '}, 16, 1, 0, 0, 0, 0, 0, {'d','a','t','a'}, 0};
typedef struct WaveHeader_s WaveHeader;
void parseLogFileHeader(FILE* logfile, HighBlueHeader* hdr, int verbose){
// header parse
fread(&hdr->headerSize, 4, 1, logfile);
fread(&hdr->versionNumber, 2, 1, logfile);
fread(&hdr->numberOfChan, 1, 1, logfile);
fread(&hdr->resolutionBits, 1, 1, logfile);
fread(&hdr->samplingFrequency, 4, 1, logfile);
fread(&hdr->dmaBlockSize, 4, 1, logfile);
fread(&hdr->sizeOfAdditionnalDataBuffer, 4, 1, logfile);
fread(&hdr->numberOfExternalPeripheral, 1, 1, logfile);
fread(&hdr->timeStampOfStart, 4, 1, logfile);
if(verbose){
printf("header size : %d\n", hdr->headerSize);
printf("version number : %d\n", hdr->versionNumber);
printf("number of chans : %d\n", hdr->numberOfChan);
printf("resolutionBits : %d\n", hdr->resolutionBits);
printf("samplingFrequency : %d\n", hdr->samplingFrequency);
printf("dmaBlockSize : %d\n", hdr->dmaBlockSize);
printf("sizeOfAdditionnalDataBuffer : %d\n", hdr->sizeOfAdditionnalDataBuffer);
printf("numberOfExternalPeripheral : %d\n", hdr->numberOfExternalPeripheral);