Ignore:
Timestamp:
Mar 3, 2013, 8:09:48 PM (12 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
474a573
Parents:
abd326c
Message:

tests/src/: improve examples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tests/src/test-mathutils-window.c ΒΆ

    rabd326c r7e35b37  
    11#include <aubio.h>
    2 #include <stdlib.h>
     2#include <math.h>
     3#include <stdio.h>
    34
    4 int main( )
     5int main ()
    56{
    6   uint_t length;
    7   for (length = 2; length <= 5; length++)
    8   {
    9     fvec_t *t = new_aubio_window("rectangle", length);
    10     del_fvec(t);
    11     t = new_aubio_window("hamming", length);
    12     fvec_print(t);
    13     del_fvec(t);
    14     t = new_aubio_window("hanning", length);
    15     fvec_print(t);
    16     del_fvec(t);
    17     t = new_aubio_window("hanningz", length);
    18     fvec_print(t);
    19     del_fvec(t);
    20     t = new_aubio_window("blackman", length);
    21     fvec_print(t);
    22     del_fvec(t);
    23     t = new_aubio_window("blackman_harris", length);
    24     fvec_print(t);
    25     del_fvec(t);
    26     t = new_aubio_window("gaussian", length);
    27     fvec_print(t);
    28     del_fvec(t);
    29     t = new_aubio_window("welch", length);
    30     fvec_print(t);
    31     del_fvec(t);
    32     t = new_aubio_window("parzen", length);
    33     fvec_print(t);
    34     del_fvec(t);
    35     t = new_aubio_window("default", length);
    36     fvec_print(t);
    37     del_fvec(t);
     7  uint_t length = 0;
     8  uint_t n_length = 4, n_types = 10, i, t;
     9  uint_t lengths[4] = { 8, 10, 15, 16 };
     10  char *method = "default";
     11  char *window_types[10] = { "default",
     12    "rectangle", "hamming", "hanning", "hanningz",
     13    "blackman", "blackman_harris", "gaussian", "welch", "parzen"};
     14
     15  for ( t = 0; t < n_types; t ++ ) {
     16    for ( i = 0; i < n_length; i++)
     17    {
     18      length = lengths[i];
     19      method = window_types[t];
     20
     21      fvec_t * window = new_aubio_window(method, length);
     22
     23      fvec_set_window(window, method);
     24      fprintf(stdout, "length: %d, method: %s, window:, ", length, method);
     25      fvec_print(window);
     26
     27      del_fvec(window);
     28    }
    3829  }
    3930  return 0;
Note: See TracChangeset for help on using the changeset viewer.