Skip to content

Commit

Permalink
added data test
Browse files Browse the repository at this point in the history
  • Loading branch information
dariosanfilippo committed May 24, 2021
1 parent 7b25eb2 commit a14a336
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
6 changes: 3 additions & 3 deletions data.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ void freq_est_data(Sig* in, Sig* out) {
audio phase;

for (size_t i = 0; i < in->space_dim; i++) {
freq = (random() / RAND_MAX) * 5000.0;
amp = (random() / RAND_MAX) * .5;
phase = (random() / RAND_MAX) * TWOPI;
freq = (random() / (audio) RAND_MAX) * 5000.0;
amp = (random() / (audio) RAND_MAX) * .5;
phase = (random() / (audio) RAND_MAX) * TWOPI;
out->vec_space[i][0] = freq;
sine(in->sr, amp, freq, phase, in, i);
dsm3(in, in, i, i);
Expand Down
37 changes: 37 additions & 0 deletions data_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include "signals.c"
#include "osc.c"
#include "dsm.c"
#include "bitmath.c"
#include "data.c"

int main(void) {

size_t sr = 192000;
size_t in_len = 64;
size_t out_len = 1;
size_t dim = 64;

Sig* in = malloc(sizeof(Sig));
Sig* out = malloc(sizeof(Sig));
sig_alloc(in, dim, in_len, sr);
sig_alloc(out, dim, out_len, sr);

freq_est_data(in, out);

sig_print(in, 30);
sig_print(out, 30);

sig_free(in);
sig_free(out);

return EXIT_SUCCESS;

}


1 change: 1 addition & 0 deletions fulladder_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ int main(void) {
fclose(fptr);

return EXIT_SUCCESS;

}

0 comments on commit a14a336

Please sign in to comment.