Changeset 6bba139 for src


Ignore:
Timestamp:
Oct 4, 2018, 6:35:14 PM (6 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
Children:
f8c5452
Parents:
f761f06
Message:

src/notes/notes.h: add get/set for release drop level (closes: #203)

Location:
src/notes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/notes/notes.c

    rf761f06 r6bba139  
    11/*
    2   Copyright (C) 2014 Paul Brossier <piem@aubio.org>
     2  Copyright (C) 2014-2018 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_LEVEL_DROP 10.
     28#define AUBIO_DEFAULT_NOTES_RELEASE_DROP 10.
    2929// increase to 10. for .1  cent precision
    3030//      or to 100. for .01 cent precision
     
    6060
    6161  smpl_t last_onset_level;
    62   smpl_t level_delta_db;
     62  smpl_t release_drop_level;
    6363};
    6464
     
    107107
    108108  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;
    110110
    111111  return o;
     
    146146{
    147147  return aubio_onset_get_minioi_ms(o->onset);
     148}
     149
     150uint_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
     161smpl_t aubio_notes_get_release_drop(const aubio_notes_t *o)
     162{
     163  return o->release_drop_level;
    148164}
    149165
     
    211227    }
    212228  } else {
    213     if (curlevel < o->last_onset_level - o->level_delta_db)
     229    if (curlevel < o->last_onset_level - o->release_drop_level)
    214230    {
    215231      // send note off
  • src/notes/notes.h

    rf761f06 r6bba139  
    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 */
     116smpl_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*/
     137uint_t aubio_notes_set_release_drop (aubio_notes_t *o, smpl_t release_drop);
     138
    109139#ifdef __cplusplus
    110140}
Note: See TracChangeset for help on using the changeset viewer.