Changes in / [4bc10e2:cefa29d]


Ignore:
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • doc/aubionotes.txt

    r4bc10e2 rcefa29d  
    77  aubionotes [[-i] source]
    88             [-r rate] [-B win] [-H hop]
    9              [-O method] [-t thres] [-d drop]
     9             [-O method] [-t thres]
    1010             [-p method] [-u unit] [-l thres]
    1111             [-T time-format]
     
    6969  loudest ones. A value of -90.0 would select all onsets. Defaults to -90.0.
    7070
    71   -d, --release-drop  Set the release drop threshold, in dB. If the level is
    72   found to drop more than this amount since the last note has started, the
    73   note will be turned-off. Defaults to 10.
    74 
    7571  -T, --timeformat format  Set time format (samples, ms, seconds). Defaults to
    7672  seconds.
  • examples/aubionotes.c

    r4bc10e2 rcefa29d  
    2222#define PROG_HAS_PITCH 1
    2323#define PROG_HAS_ONSET 1
    24 #define PROG_HAS_NOTES 1
    2524#define PROG_HAS_SILENCE 1
    2625#define PROG_HAS_JACK 1
     
    8483    }
    8584  }
    86   if (release_drop != 10.) {
    87     if (aubio_notes_set_release_drop (notes, release_drop) != 0) {
    88       errmsg ("failed setting notes release drop to %.2f\n",
    89           release_drop);
    90     }
    91   }
    9285
    9386  examples_common_process((aubio_process_func_t)process_block, process_print);
  • examples/parse_args.h

    r4bc10e2 rcefa29d  
    4848// more general stuff
    4949extern smpl_t silence_threshold;
    50 extern smpl_t release_drop;
    5150extern uint_t mix_input;
    5251// midi tap
     
    109108      "                 a value in dB, for instance -70, or -100; default=-90\n"
    110109#endif /* PROG_HAS_SILENCE */
    111 #ifdef PROG_HAS_NOTES
    112       "       -d      --release-drop     select release drop threshold\n"
    113       "                 a positive value in dB; default=10\n"
    114 #endif
    115110      "       -T      --time-format      select time values output format\n"
    116111      "                 (samples, ms, seconds) default=seconds\n"
     
    163158    "s:"
    164159#endif /* PROG_HAS_SILENCE */
    165 #ifdef PROG_HAS_NOTES
    166     "d:"
    167 #endif /* PROG_HAS_SILENCE */
    168160#ifdef PROG_HAS_OUTPUT
    169161    "mf"
     
    201193    {"silence",               1, NULL, 's'},
    202194#endif /* PROG_HAS_SILENCE */
    203 #ifdef PROG_HAS_NOTES
    204     {"release-drop",          1, NULL, 'd'},
    205 #endif /* PROG_HAS_NOTES */
    206195    {"time-format",           1, NULL, 'T'},
    207196#ifdef PROG_HAS_OUTPUT
     
    285274      case 's':                /* silence threshold */
    286275        silence_threshold = (smpl_t) atof (optarg);
    287         break;
    288       case 'd':                /* release-drop threshold */
    289         release_drop = (smpl_t) atof (optarg);
    290276        break;
    291277      case 'm':                /* mix_input flag */
  • examples/utils.c

    r4bc10e2 rcefa29d  
    5555// more general stuff
    5656smpl_t silence_threshold = -90.;
    57 smpl_t release_drop = 10.;
    5857uint_t mix_input = 0;
    5958
  • python/lib/aubio/cmd.py

    r4bc10e2 rcefa29d  
    102102    subparser.add_input()
    103103    subparser.add_buf_hop_size()
    104     subparser.add_silence()
    105     subparser.add_release_drop()
    106104    subparser.add_time_format()
    107105    subparser.add_verbose_help()
     
    209207                action="store", dest="silence", default=-70,
    210208                help="silence threshold")
    211 
    212     def add_release_drop(self):
    213         self.add_argument("-d", "--release-drop",
    214                 metavar = "<value>", type=float,
    215                 action="store", dest="release_drop", default=10,
    216                 help="release drop threshold")
    217209
    218210    def add_minioi(self, default="12ms"):
     
    391383        self.parse_options(args, self.valid_opts)
    392384        self.notes = aubio.notes(**self.options)
    393         if args.silence is not None:
    394             self.notes.set_silence(args.silence)
    395         if args.release_drop is not None:
    396             self.notes.set_release_drop(args.release_drop)
    397385        super(process_notes, self).__init__(args)
    398386    def __call__(self, block):
  • python/tests/test_notes.py

    r4bc10e2 rcefa29d  
    66
    77AUBIO_DEFAULT_NOTES_SILENCE = -70.
    8 AUBIO_DEFAULT_NOTES_RELEASE_DROP = 10.
    98AUBIO_DEFAULT_NOTES_MINIOI_MS = 30.
    109
     
    3938        self.o.set_silence(val)
    4039        assert_equal (self.o.get_silence(), val)
    41 
    42     def test_get_release_drop(self):
    43         assert_equal (self.o.get_release_drop(), AUBIO_DEFAULT_NOTES_RELEASE_DROP)
    44 
    45     def test_set_release_drop(self):
    46         val = 50
    47         self.o.set_release_drop(val)
    48         assert_equal (self.o.get_release_drop(), val)
    49 
    50     def test_set_release_drop_wrong(self):
    51         val = -10
    52         with self.assertRaises(ValueError):
    53             self.o.set_release_drop(val)
    5440
    5541from .utils import list_all_sounds
  • src/notes/notes.c

    r4bc10e2 rcefa29d  
    11/*
    2   Copyright (C) 2014-2018 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2014 Paul Brossier <piem@aubio.org>
    33
    44  This file is part of aubio.
     
    2626
    2727#define AUBIO_DEFAULT_NOTES_SILENCE -70.
    28 #define AUBIO_DEFAULT_NOTES_RELEASE_DROP 10.
    2928// increase to 10. for .1  cent precision
    3029//      or to 100. for .01 cent precision
     
    5857
    5958  uint_t isready;
    60 
    61   smpl_t last_onset_level;
    62   smpl_t release_drop_level;
    6359};
    6460
     
    106102  aubio_notes_set_minioi_ms (o, AUBIO_DEFAULT_NOTES_MINIOI_MS);
    107103
    108   o->last_onset_level = AUBIO_DEFAULT_NOTES_SILENCE;
    109   o->release_drop_level = AUBIO_DEFAULT_NOTES_RELEASE_DROP;
    110 
    111104  return o;
    112105
     
    146139{
    147140  return aubio_onset_get_minioi_ms(o->onset);
    148 }
    149 
    150 uint_t aubio_notes_set_release_drop(aubio_notes_t *o, smpl_t release_drop_level)
    151 {
    152   uint_t err = AUBIO_OK;
    153   if (release_drop_level <= 0.) {
    154     AUBIO_ERR("notes: release_drop should be >= 0, got %f\n", release_drop_level);
    155     err = AUBIO_FAIL;
    156   } else {
    157     o->release_drop_level = release_drop_level;
    158   }
    159   return err;
    160 }
    161 
    162 smpl_t aubio_notes_get_release_drop(const aubio_notes_t *o)
    163 {
    164   return o->release_drop_level;
    165141}
    166142
     
    209185      //notes->data[0] = o->curnote;
    210186      //notes->data[1] = 0.;
    211       //AUBIO_WRN("notes: sending note-off at onset, not enough level\n");
    212187      notes->data[2] = o->curnote;
    213188    } else {
     
    217192        /* kill old note */
    218193        //send_noteon(o->curnote,0, o->samplerate);
    219         //AUBIO_WRN("notes: sending note-off at onset, new onset detected\n");
    220194        notes->data[2] = o->curnote;
    221195        /* get and send new one */
     
    225199        o->curnote = new_pitch;
    226200      }
    227       o->last_onset_level = curlevel;
    228201    }
    229202  } else {
    230     if (curlevel < o->last_onset_level - o->release_drop_level)
    231     {
    232       // send note off
    233       //AUBIO_WRN("notes: sending note-off, release detected\n");
    234       notes->data[0] = 0;
    235       notes->data[1] = 0;
    236       notes->data[2] = o->curnote;
    237       // reset last_onset_level to silence_threshold
    238       o->last_onset_level = o->silence_threshold;
    239       o->curnote = 0;
    240     }
    241     else if (o->median)
    242     {
     203    if (o->median) {
    243204      if (o->isready > 0)
    244205        o->isready++;
     
    247208        /* kill old note */
    248209        //send_noteon(curnote,0);
    249         if (o->curnote != 0)
    250         {
    251           //AUBIO_WRN("notes: sending note-off, new note detected\n");
    252           notes->data[2] = o->curnote;
    253         }
     210        notes->data[2] = o->curnote;
    254211        o->newnote = aubio_notes_get_latest_note(o);
    255212        o->curnote = o->newnote;
  • src/notes/notes.h

    r4bc10e2 rcefa29d  
    107107uint_t aubio_notes_set_minioi_ms (aubio_notes_t *o, smpl_t minioi_ms);
    108108
    109 /** get notes object release drop level, in dB
    110 
    111   \param o notes detection object as returned by new_aubio_notes()
    112 
    113   \return current release drop level, in dB
    114 
    115  */
    116 smpl_t aubio_notes_get_release_drop (const aubio_notes_t *o);
    117 
    118 /** set note release drop level, in dB
    119 
    120   This function sets the release_drop_level parameter, in dB. When a new note
    121   is found, the current level in dB is measured. If the measured level drops
    122   under that initial level - release_drop_level, then a note-off will be
    123   emitted.
    124 
    125   Defaults to `10`, in dB.
    126 
    127   \note This parameter was added in version `0.4.8`. Results obtained with
    128   earlier versions can be reproduced by setting this value to `100`, so that
    129   note-off will not be played until the next note.
    130 
    131   \param o notes detection object as returned by new_aubio_notes()
    132   \param release_drop new release drop level, in dB
    133 
    134   \return 0 on success, non-zero otherwise
    135 
    136 */
    137 uint_t aubio_notes_set_release_drop (aubio_notes_t *o, smpl_t release_drop);
    138 
    139109#ifdef __cplusplus
    140110}
Note: See TracChangeset for help on using the changeset viewer.