Changes in / [4bc10e2:cefa29d]
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/aubionotes.txt
r4bc10e2 rcefa29d 7 7 aubionotes [[-i] source] 8 8 [-r rate] [-B win] [-H hop] 9 [-O method] [-t thres] [-d drop]9 [-O method] [-t thres] 10 10 [-p method] [-u unit] [-l thres] 11 11 [-T time-format] … … 69 69 loudest ones. A value of -90.0 would select all onsets. Defaults to -90.0. 70 70 71 -d, --release-drop Set the release drop threshold, in dB. If the level is72 found to drop more than this amount since the last note has started, the73 note will be turned-off. Defaults to 10.74 75 71 -T, --timeformat format Set time format (samples, ms, seconds). Defaults to 76 72 seconds. -
examples/aubionotes.c
r4bc10e2 rcefa29d 22 22 #define PROG_HAS_PITCH 1 23 23 #define PROG_HAS_ONSET 1 24 #define PROG_HAS_NOTES 125 24 #define PROG_HAS_SILENCE 1 26 25 #define PROG_HAS_JACK 1 … … 84 83 } 85 84 } 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 }92 85 93 86 examples_common_process((aubio_process_func_t)process_block, process_print); -
examples/parse_args.h
r4bc10e2 rcefa29d 48 48 // more general stuff 49 49 extern smpl_t silence_threshold; 50 extern smpl_t release_drop;51 50 extern uint_t mix_input; 52 51 // midi tap … … 109 108 " a value in dB, for instance -70, or -100; default=-90\n" 110 109 #endif /* PROG_HAS_SILENCE */ 111 #ifdef PROG_HAS_NOTES112 " -d --release-drop select release drop threshold\n"113 " a positive value in dB; default=10\n"114 #endif115 110 " -T --time-format select time values output format\n" 116 111 " (samples, ms, seconds) default=seconds\n" … … 163 158 "s:" 164 159 #endif /* PROG_HAS_SILENCE */ 165 #ifdef PROG_HAS_NOTES166 "d:"167 #endif /* PROG_HAS_SILENCE */168 160 #ifdef PROG_HAS_OUTPUT 169 161 "mf" … … 201 193 {"silence", 1, NULL, 's'}, 202 194 #endif /* PROG_HAS_SILENCE */ 203 #ifdef PROG_HAS_NOTES204 {"release-drop", 1, NULL, 'd'},205 #endif /* PROG_HAS_NOTES */206 195 {"time-format", 1, NULL, 'T'}, 207 196 #ifdef PROG_HAS_OUTPUT … … 285 274 case 's': /* silence threshold */ 286 275 silence_threshold = (smpl_t) atof (optarg); 287 break;288 case 'd': /* release-drop threshold */289 release_drop = (smpl_t) atof (optarg);290 276 break; 291 277 case 'm': /* mix_input flag */ -
examples/utils.c
r4bc10e2 rcefa29d 55 55 // more general stuff 56 56 smpl_t silence_threshold = -90.; 57 smpl_t release_drop = 10.;58 57 uint_t mix_input = 0; 59 58 -
python/lib/aubio/cmd.py
r4bc10e2 rcefa29d 102 102 subparser.add_input() 103 103 subparser.add_buf_hop_size() 104 subparser.add_silence()105 subparser.add_release_drop()106 104 subparser.add_time_format() 107 105 subparser.add_verbose_help() … … 209 207 action="store", dest="silence", default=-70, 210 208 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")217 209 218 210 def add_minioi(self, default="12ms"): … … 391 383 self.parse_options(args, self.valid_opts) 392 384 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)397 385 super(process_notes, self).__init__(args) 398 386 def __call__(self, block): -
python/tests/test_notes.py
r4bc10e2 rcefa29d 6 6 7 7 AUBIO_DEFAULT_NOTES_SILENCE = -70. 8 AUBIO_DEFAULT_NOTES_RELEASE_DROP = 10.9 8 AUBIO_DEFAULT_NOTES_MINIOI_MS = 30. 10 9 … … 39 38 self.o.set_silence(val) 40 39 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 = 5047 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 = -1052 with self.assertRaises(ValueError):53 self.o.set_release_drop(val)54 40 55 41 from .utils import list_all_sounds -
src/notes/notes.c
r4bc10e2 rcefa29d 1 1 /* 2 Copyright (C) 2014 -2018Paul Brossier <piem@aubio.org>2 Copyright (C) 2014 Paul Brossier <piem@aubio.org> 3 3 4 4 This file is part of aubio. … … 26 26 27 27 #define AUBIO_DEFAULT_NOTES_SILENCE -70. 28 #define AUBIO_DEFAULT_NOTES_RELEASE_DROP 10.29 28 // increase to 10. for .1 cent precision 30 29 // or to 100. for .01 cent precision … … 58 57 59 58 uint_t isready; 60 61 smpl_t last_onset_level;62 smpl_t release_drop_level;63 59 }; 64 60 … … 106 102 aubio_notes_set_minioi_ms (o, AUBIO_DEFAULT_NOTES_MINIOI_MS); 107 103 108 o->last_onset_level = AUBIO_DEFAULT_NOTES_SILENCE;109 o->release_drop_level = AUBIO_DEFAULT_NOTES_RELEASE_DROP;110 111 104 return o; 112 105 … … 146 139 { 147 140 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;165 141 } 166 142 … … 209 185 //notes->data[0] = o->curnote; 210 186 //notes->data[1] = 0.; 211 //AUBIO_WRN("notes: sending note-off at onset, not enough level\n");212 187 notes->data[2] = o->curnote; 213 188 } else { … … 217 192 /* kill old note */ 218 193 //send_noteon(o->curnote,0, o->samplerate); 219 //AUBIO_WRN("notes: sending note-off at onset, new onset detected\n");220 194 notes->data[2] = o->curnote; 221 195 /* get and send new one */ … … 225 199 o->curnote = new_pitch; 226 200 } 227 o->last_onset_level = curlevel;228 201 } 229 202 } 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) { 243 204 if (o->isready > 0) 244 205 o->isready++; … … 247 208 /* kill old note */ 248 209 //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; 254 211 o->newnote = aubio_notes_get_latest_note(o); 255 212 o->curnote = o->newnote; -
src/notes/notes.h
r4bc10e2 rcefa29d 107 107 uint_t aubio_notes_set_minioi_ms (aubio_notes_t *o, smpl_t minioi_ms); 108 108 109 /** get notes object release drop level, in dB110 111 \param o notes detection object as returned by new_aubio_notes()112 113 \return current release drop level, in dB114 115 */116 smpl_t aubio_notes_get_release_drop (const aubio_notes_t *o);117 118 /** set note release drop level, in dB119 120 This function sets the release_drop_level parameter, in dB. When a new note121 is found, the current level in dB is measured. If the measured level drops122 under that initial level - release_drop_level, then a note-off will be123 emitted.124 125 Defaults to `10`, in dB.126 127 \note This parameter was added in version `0.4.8`. Results obtained with128 earlier versions can be reproduced by setting this value to `100`, so that129 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 dB133 134 \return 0 on success, non-zero otherwise135 136 */137 uint_t aubio_notes_set_release_drop (aubio_notes_t *o, smpl_t release_drop);138 139 109 #ifdef __cplusplus 140 110 }
Note: See TracChangeset
for help on using the changeset viewer.