Changeset 6bba139
- Timestamp:
- Oct 4, 2018, 6:35:14 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
- Children:
- f8c5452
- Parents:
- f761f06
- Location:
- src/notes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/notes/notes.c
rf761f06 r6bba139 1 1 /* 2 Copyright (C) 2014 Paul Brossier <piem@aubio.org>2 Copyright (C) 2014-2018 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_ LEVEL_DROP 10.28 #define AUBIO_DEFAULT_NOTES_RELEASE_DROP 10. 29 29 // increase to 10. for .1 cent precision 30 30 // or to 100. for .01 cent precision … … 60 60 61 61 smpl_t last_onset_level; 62 smpl_t level_delta_db;62 smpl_t release_drop_level; 63 63 }; 64 64 … … 107 107 108 108 o->last_onset_level = AUBIO_DEFAULT_NOTES_SILENCE; 109 o-> level_delta_db = AUBIO_DEFAULT_NOTES_LEVEL_DROP;109 o->release_drop_level = AUBIO_DEFAULT_NOTES_RELEASE_DROP; 110 110 111 111 return o; … … 146 146 { 147 147 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 err = AUBIO_FAIL; 155 } else { 156 o->release_drop_level = release_drop_level; 157 } 158 return err; 159 } 160 161 smpl_t aubio_notes_get_release_drop(const aubio_notes_t *o) 162 { 163 return o->release_drop_level; 148 164 } 149 165 … … 211 227 } 212 228 } else { 213 if (curlevel < o->last_onset_level - o-> level_delta_db)229 if (curlevel < o->last_onset_level - o->release_drop_level) 214 230 { 215 231 // send note off -
src/notes/notes.h
rf761f06 r6bba139 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 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 109 139 #ifdef __cplusplus 110 140 }
Note: See TracChangeset
for help on using the changeset viewer.