<commit_before>//
//
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include "liquid.h"

#define DEBUG_FILENAME "fbasc_example.m"

int main() {
    // options
    unsigned int num_channels=32;
    unsigned int samples_per_frame=1024;
    unsigned int bytes_per_frame=256;

    unsigned int num_frames=4;

    // create fbasc codecs
    fbasc fbasc_encoder = fbasc_create(FBASC_ENCODER, num_channels, samples_per_frame, bytes_per_frame);
    //fbasc fbasc_decoder = fbasc_create(FBASC_DECODER, num_channels, samples_per_frame, bytes_per_frame);

    // open debug file
    FILE * fid = fopen(DEBUG_FILENAME,"w");
    fprintf(fid,"%% %s: auto-generated file\n\n", DEBUG_FILENAME);
    fprintf(fid,"clear all\n");
    fprintf(fid,"close all\n");

    float phi=0.0f;
    float dphi;
    unsigned int i, j;
    float x[samples_per_frame];
    unsigned char framedata[bytes_per_frame];
    for (i=0; i<num_frames; i++) {
        dphi = 0.2f;
        for (j=0; j<samples_per_frame; j++) {
            x[j] = 0.5f*sinf(phi);
            phi += dphi;
        }

        fbasc_encode(fbasc_encoder, x, framedata);

        phi += dphi;
    }

    // plot results
    fprintf(fid,"\n\n");

    // close debug file
    fclose(fid);
    printf("results wrtten to %s\n", DEBUG_FILENAME);
    printf("done.\n");
    return 0;
}

<commit_msg>examples/fbasc: fixing bug (additional frequency step)<commit_after>//
//
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include "liquid.h"

#define DEBUG_FILENAME "fbasc_example.m"

int main() {
    // options
    unsigned int num_channels=32;
    unsigned int samples_per_frame=1024;
    unsigned int bytes_per_frame=256;

    unsigned int num_frames=32;

    // create fbasc codecs
    fbasc fbasc_encoder = fbasc_create(FBASC_ENCODER, num_channels, samples_per_frame, bytes_per_frame);
    //fbasc fbasc_decoder = fbasc_create(FBASC_DECODER, num_channels, samples_per_frame, bytes_per_frame);

    // open debug file
    FILE * fid = fopen(DEBUG_FILENAME,"w");
    fprintf(fid,"%% %s: auto-generated file\n\n", DEBUG_FILENAME);
    fprintf(fid,"clear all\n");
    fprintf(fid,"close all\n");

    float phi=0.0f;
    float dphi;
    unsigned int i, j;
    float x[samples_per_frame];
    unsigned char framedata[bytes_per_frame];
    for (i=0; i<num_frames; i++) {
        dphi = 2*M_PI * 4 / (float)num_channels;
        for (j=0; j<samples_per_frame; j++) {
            x[j] = 0.5f*cosf(phi);
            phi += dphi;
        }

        fbasc_encode(fbasc_encoder, x, framedata);
    }

    // plot results
    fprintf(fid,"\n\n");

    // close debug file
    fclose(fid);
    printf("results wrtten to %s\n", DEBUG_FILENAME);
    printf("done.\n");
    return 0;
}


{'fraction_non_alphanumeric': 0.13653001464128844, 'fraction_numerical': 0.014275256222547585, 'mean_word_length': 2.955137481910275, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3066540', 'n_tokens_mistral': 1065, 'n_tokens_neox': 994, 'n_words': 213}