Changes in / [ed596f7:f9400d0]


Ignore:
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • azure-pipelines.yml

    red596f7 rf9400d0  
    11#  configuration file for azure continuous integration
    22jobs:
    3 
    43- job: linux
    54  pool:
    65    vmImage: 'Ubuntu 16.04'
     6
    77  steps:
    88  - script: |
    99      make
    1010    displayName: 'make'
    11     env:
    12       CFLAGS: -Werror
    13 
    1411- job: windows
    1512  pool:
    1613    vmIMage: 'VS2017-Win2016'
     14
    1715  steps:
    1816  - script: |
     
    2624  pool:
    2725    vmIMage: macOS-10.13
     26
    2827  steps:
    2928  - script: |
     
    3534      make
    3635    displayName: 'make'
    37     env:
    38       CFLAGS: -Werror
  • doc/about.rst

    red596f7 rf9400d0  
    6060-------
    6161
    62 aubio is a `free <https://www.debian.org/intro/free>`_ and `open source
     62aubio is a `free <http://www.debian.org/intro/free>`_ and `open source
    6363<http://www.opensource.org/docs/definition.php>`_ software; **you** can
    6464redistribute it and/or modify it under the terms of the `GNU
  • doc/aubiomfcc.txt

    red596f7 rf9400d0  
    5252  url:
    5353
    54   https://engineering.purdue.edu/~malcolm/interval/1998-010/ (see file mfcc.m)
     54  http://cobweb.ecn.purdue.edu/~malcolm/interval/1998-010/ (see file mfcc.m)
    5555
    5656SEE ALSO
  • doc/aubionotes.txt

    red596f7 rf9400d0  
    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.
  • doc/conf.py

    red596f7 rf9400d0  
    4646# General information about the project.
    4747project = u'aubio'
    48 copyright = u'2018, Paul Brossier'
     48copyright = u'2016, Paul Brossier'
    4949
    5050# The version info for the project you're documenting, acts as replacement for
  • doc/python_module.rst

    red596f7 rf9400d0  
    8080.. _demo_filter.py: https://github.com/aubio/aubio/blob/master/python/demos/demo_filter.py
    8181.. _python tests: https://github.com/aubio/aubio/blob/master/python/tests
     82
  • examples/aubionotes.c

    red596f7 rf9400d0  
    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

    red596f7 rf9400d0  
    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

    red596f7 rf9400d0  
    5555// more general stuff
    5656smpl_t silence_threshold = -90.;
    57 smpl_t release_drop = 10.;
    5857uint_t mix_input = 0;
    5958
  • python/demos/demo_bpm_extract.py

    red596f7 rf9400d0  
    2323            pass
    2424        else:
    25             raise ValueError("unknown mode {:s}".format(params.mode))
     25            print("unknown mode {:s}".format(params.mode))
    2626    # manual settings
    2727    if 'samplerate' in params:
     
    7070    parser.add_argument('-m', '--mode',
    7171            help="mode [default|fast|super-fast]",
    72             dest="mode", default='default')
     72            dest="mode")
    7373    parser.add_argument('sources',
    74             nargs='+',
     74            nargs='*',
    7575            help="input_files")
    7676    args = parser.parse_args()
  • python/ext/aubiomodule.c

    red596f7 rf9400d0  
    118118  smpl_t output;
    119119
    120   if (!PyArg_ParseTuple (args,
    121         "" AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR,
    122         &input, &samplerate, &fftsize)) {
     120  if (!PyArg_ParseTuple (args, "|" AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR , &input, &samplerate, &fftsize)) {
    123121    return NULL;
    124122  }
     
    135133  smpl_t output;
    136134
    137   if (!PyArg_ParseTuple (args,
    138         "" AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR,
    139         &input, &samplerate, &fftsize)) {
     135  if (!PyArg_ParseTuple (args, "|" AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR , &input, &samplerate, &fftsize)) {
    140136    return NULL;
    141137  }
     
    152148  smpl_t output;
    153149
    154   if (!PyArg_ParseTuple (args,
    155         "" AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR,
    156         &input, &samplerate, &fftsize)) {
     150  if (!PyArg_ParseTuple (args, "|" AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR, &input, &samplerate, &fftsize)) {
    157151    return NULL;
    158152  }
     
    169163  smpl_t output;
    170164
    171   if (!PyArg_ParseTuple (args,
    172         "" AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR,
    173         &input, &samplerate, &fftsize)) {
     165  if (!PyArg_ParseTuple (args, "|" AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR AUBIO_NPY_SMPL_CHR, &input, &samplerate, &fftsize)) {
    174166    return NULL;
    175167  }
  • python/ext/py-filterbank.c

    red596f7 rf9400d0  
    9595  if (self->vec.length != self->win_s / 2 + 1) {
    9696    PyErr_Format(PyExc_ValueError,
    97                  "input cvec has length %d, but filterbank expects length %d",
     97                 "input cvec has length %d, but fft expects length %d",
    9898                 self->vec.length, self->win_s / 2 + 1);
    9999    return NULL;
     
    140140  if (err > 0) {
    141141    PyErr_SetString (PyExc_ValueError,
    142         "error when running set_triangle_bands");
     142        "error when setting filter to A-weighting");
    143143    return NULL;
    144144  }
     
    159159  if (err > 0) {
    160160    PyErr_SetString (PyExc_ValueError,
    161         "error when running set_mel_coeffs_slaney");
     161        "error when setting filter to A-weighting");
    162162    return NULL;
    163163  }
  • python/lib/aubio/cmd.py

    red596f7 rf9400d0  
    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):
     
    515503def main():
    516504    parser = aubio_parser()
    517     if sys.version_info[0] != 3:
    518         # on py2, create a dummy ArgumentParser to workaround the
    519         # optional subcommand issue. See https://bugs.python.org/issue9253
    520         # This ensures that:
    521         #  - version string is shown when only '-V' is passed
    522         #  - help is printed if  '-V' is passed with any other argument
    523         #  - any other argument get forwarded to the real parser
    524         parser_root = argparse.ArgumentParser(add_help=False)
    525         parser_root.add_argument('-V', '--version', help="show version",
    526                 action="store_true", dest="show_version")
    527         args, extras = parser_root.parse_known_args()
    528         if args.show_version == False: # no -V, forward to parser
    529             args = parser.parse_args(extras, namespace=args)
    530         elif len(extras) != 0: # -V with other arguments, print help
    531             parser.print_help()
    532             sys.exit(1)
    533     else: # in py3, we can simply use parser directly
    534         args = parser.parse_args()
     505    args = parser.parse_args()
    535506    if 'show_version' in args and args.show_version:
    536507        sys.stdout.write('aubio version ' + aubio.version + '\n')
  • python/lib/aubio/midiconv.py

    red596f7 rf9400d0  
    22""" utilities to convert midi note number to and from note names """
    33
    4 __all__ = ['note2midi', 'midi2note', 'freq2note', 'note2freq']
     4__all__ = ['note2midi', 'midi2note', 'freq2note']
    55
    66import sys
    7 from ._aubio import freqtomidi, miditofreq
    8 
    97py3 = sys.version_info[0] == 3
    108if py3:
     
    6664    _valid_octaves = range(-1, 10)
    6765    if not isinstance(note, str_instances):
    68         msg = "a string is required, got {:s} ({:s})"
    69         raise TypeError(msg.format(str(type(note)), repr(note)))
     66        raise TypeError("a string is required, got %s (%s)" % (note, str(type(note))))
    7067    if len(note) not in range(2, 5):
    71         msg = "string of 2 to 4 characters expected, got {:d} ({:s})"
    72         raise ValueError(msg.format(len(note), note))
     68        raise ValueError("string of 2 to 4 characters expected, got %d (%s)" \
     69                         % (len(note), note))
    7370    notename, modifier, octave = [None]*3
    7471
     
    9491        raise ValueError("%s is not a valid octave" % octave)
    9592
    96     midi = 12 + octave * 12 + _valid_notenames[notename] \
    97             + _valid_modifiers[modifier]
     93    midi = 12 + octave * 12 + _valid_notenames[notename] + _valid_modifiers[modifier]
    9894    if midi > 127:
    9995        raise ValueError("%s is outside of the range C-2 to G8" % note)
     
    134130        raise TypeError("an integer is required, got %s" % midi)
    135131    if midi not in range(0, 128):
    136         msg = "an integer between 0 and 127 is excepted, got {:d}"
    137         raise ValueError(msg.format(midi))
    138     _valid_notenames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#',
    139             'A', 'A#', 'B']
     132        raise ValueError("an integer between 0 and 127 is excepted, got %d" % midi)
     133    _valid_notenames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
    140134    return _valid_notenames[midi % 12] + str(int(midi / 12) - 1)
    141135
     
    160154    'A3'
    161155    """
    162     nearest_note = int(freqtomidi(freq) + .5)
    163     return midi2note(nearest_note)
    164 
    165 def note2freq(note):
    166     """Convert note name to corresponding frequency, in Hz.
    167 
    168     Parameters
    169     ----------
    170     note : str
    171         input note name
    172 
    173     Returns
    174     -------
    175     freq : float [0, 23000[
    176         frequency, in Hz
    177 
    178     Example
    179     -------
    180     >>> aubio.note2freq('A4')
    181     440
    182     >>> aubio.note2freq('A3')
    183     220.1
    184     """
    185     midi = note2midi(note)
    186     return miditofreq(midi)
     156    from aubio import freqtomidi
     157    return midi2note(int(freqtomidi(freq)))
  • python/tests/test_aubio_cmd.py

    red596f7 rf9400d0  
    2020
    2121    def test_samples2seconds(self):
    22         self.assertEqual(aubio.cmd.samples2seconds(3200, 32000),
    23                 "0.100000\t")
     22        self.assertEqual(aubio.cmd.samples2seconds(3200, 32000), "0.100000\t")
    2423
    2524    def test_samples2milliseconds(self):
    26         self.assertEqual(aubio.cmd.samples2milliseconds(3200, 32000),
    27                 "100.000000\t")
     25        self.assertEqual(aubio.cmd.samples2milliseconds(3200, 32000), "100.000000\t")
    2826
    2927    def test_samples2samples(self):
    30         self.assertEqual(aubio.cmd.samples2samples(3200, 32000),
    31                 "3200\t")
     28        self.assertEqual(aubio.cmd.samples2samples(3200, 32000), "3200\t")
    3229
    3330if __name__ == '__main__':
  • python/tests/test_note2midi.py

    red596f7 rf9400d0  
    44from __future__ import unicode_literals
    55
    6 from aubio import note2midi, freq2note, note2freq, float_type
     6from aubio import note2midi, freq2note
    77from nose2.tools import params
    88import unittest
     
    112112class freq2note_simple_test(unittest.TestCase):
    113113
    114     def test_freq2note_above(self):
     114    def test_freq2note(self):
    115115        " make sure freq2note(441) == A4 "
    116116        self.assertEqual("A4", freq2note(441))
    117 
    118     def test_freq2note_under(self):
    119         " make sure freq2note(439) == A4 "
    120         self.assertEqual("A4", freq2note(439))
    121 
    122 class note2freq_simple_test(unittest.TestCase):
    123 
    124     def test_note2freq(self):
    125         " make sure note2freq('A3') == 220"
    126         self.assertEqual(220, note2freq("A3"))
    127 
    128     def test_note2freq_under(self):
    129         " make sure note2freq(A4) == 440"
    130         if float_type == 'float32':
    131             self.assertEqual(440, note2freq("A4"))
    132         else:
    133             self.assertLess(abs(note2freq("A4")-440), 1.e-12)
    134117
    135118if __name__ == '__main__':
  • python/tests/test_notes.py

    red596f7 rf9400d0  
    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
  • python/tests/test_slicing.py

    red596f7 rf9400d0  
    3535    def test_slice_start_every_blocksize(self):
    3636        hopsize = 200
    37         regions_start = [i*hopsize for i in range(0, n_slices)]
     37        regions_start = [i*hopsize for i in range(1, n_slices)]
    3838        slice_source_at_stamps(self.source_file, regions_start, output_dir = self.output_dir,
    3939                hopsize = 200)
     
    4141    def test_slice_start_every_half_blocksize(self):
    4242        hopsize = 200
    43         regions_start = [i*hopsize//2 for i in range(0, n_slices)]
     43        regions_start = [i*hopsize//2 for i in range(1, n_slices)]
    4444        slice_source_at_stamps(self.source_file, regions_start,
    4545                output_dir = self.output_dir, hopsize = 200)
  • src/io/source_avcodec.c

    red596f7 rf9400d0  
    3535// determine whether we use libavformat from ffmpeg or from libav
    3636#define FFMPEG_LIBAVFORMAT (LIBAVFORMAT_VERSION_MICRO > 99 )
    37 // max_analyze_duration2 was used from ffmpeg libavformat 55.43.100 -> 57.2.100
     37// max_analyze_duration2 was used from ffmpeg libavformat 55.43.100 through 57.2.100
    3838#define FFMPEG_LIBAVFORMAT_MAX_DUR2 FFMPEG_LIBAVFORMAT && ( \
    3939      (LIBAVFORMAT_VERSION_MAJOR == 55 && LIBAVFORMAT_VERSION_MINOR >= 43) \
     
    9393};
    9494
    95 // create or re-create the context when _do or _do_multi is called
    96 void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s,
    97     uint_t multi);
    98 // actually read a frame
    99 void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s,
    100     uint_t * read_samples);
     95// hack to create or re-create the context the first time _do or _do_multi is called
     96void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s, uint_t multi);
     97void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s, uint_t * read_samples);
    10198
    10299uint_t aubio_source_avcodec_has_network_url(aubio_source_avcodec_t *s);
     
    115112
    116113
    117 aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path,
    118     uint_t samplerate, uint_t hop_size) {
     114aubio_source_avcodec_t * new_aubio_source_avcodec(const char_t * path, uint_t samplerate, uint_t hop_size) {
    119115  aubio_source_avcodec_t * s = AUBIO_NEW(aubio_source_avcodec_t);
    120116  AVFormatContext *avFormatCtx = s->avFormatCtx;
     
    133129  }
    134130  if ((sint_t)samplerate < 0) {
    135     AUBIO_ERR("source_avcodec: Can not open %s with samplerate %d\n",
    136         path, samplerate);
     131    AUBIO_ERR("source_avcodec: Can not open %s with samplerate %d\n", path, samplerate);
    137132    goto beach;
    138133  }
    139134  if ((sint_t)hop_size <= 0) {
    140     AUBIO_ERR("source_avcodec: Can not open %s with hop_size %d\n",
    141         path, hop_size);
     135    AUBIO_ERR("source_avcodec: Can not open %s with hop_size %d\n", path, hop_size);
    142136    goto beach;
    143137  }
     
    179173    char errorstr[256];
    180174    av_strerror (err, errorstr, sizeof(errorstr));
    181     AUBIO_ERR("source_avcodec: Could not find stream information "
    182         "for %s (%s)\n", s->path, errorstr);
     175    AUBIO_ERR("source_avcodec: Could not find stream information " "for %s (%s)\n", s->path,
     176        errorstr);
    183177    goto beach;
    184178  }
     
    220214  avCodecCtx = avcodec_alloc_context3(codec);
    221215  if (!avCodecCtx) {
    222     AUBIO_ERR("source_avcodec: Failed to allocate the %s codec context "
    223         "for path %s\n", av_get_media_type_string(AVMEDIA_TYPE_AUDIO),
    224         s->path);
     216    AUBIO_ERR("source_avcodec: Failed to allocate the %s codec context for path %s\n",
     217        av_get_media_type_string(AVMEDIA_TYPE_AUDIO), s->path);
    225218    goto beach;
    226219  }
     
    237230  /* Copy codec parameters from input stream to output codec context */
    238231  if ((err = avcodec_parameters_to_context(avCodecCtx, codecpar)) < 0) {
    239     AUBIO_ERR("source_avcodec: Failed to copy %s codec parameters to "
    240         "decoder context for %s\n",
    241         av_get_media_type_string(AVMEDIA_TYPE_AUDIO), s->path);
     232    AUBIO_ERR("source_avcodec: Failed to copy %s codec parameters to decoder context for %s\n",
     233       av_get_media_type_string(AVMEDIA_TYPE_AUDIO), s->path);
    242234    goto beach;
    243235  }
     
    247239    char errorstr[256];
    248240    av_strerror (err, errorstr, sizeof(errorstr));
    249     AUBIO_ERR("source_avcodec: Could not load codec for %s (%s)\n", s->path,
    250         errorstr);
     241    AUBIO_ERR("source_avcodec: Could not load codec for %s (%s)\n", s->path, errorstr);
    251242    goto beach;
    252243  }
     
    275266
    276267  /* allocate output for avr */
    277   s->output = (smpl_t *)av_malloc(AUBIO_AVCODEC_MAX_BUFFER_SIZE
    278       * sizeof(smpl_t));
     268  s->output = (smpl_t *)av_malloc(AUBIO_AVCODEC_MAX_BUFFER_SIZE * sizeof(smpl_t));
    279269
    280270  s->read_samples = 0;
     
    304294}
    305295
    306 void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s,
    307     uint_t multi)
    308 {
     296void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s, uint_t multi) {
    309297  // create or reset resampler to/from mono/multi-channel
    310298  if ( (multi != s->multi) || (s->avr == NULL) ) {
     
    321309#endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
    322310
    323     av_opt_set_int(avr, "in_channel_layout",  input_layout,              0);
    324     av_opt_set_int(avr, "out_channel_layout", output_layout,             0);
    325     av_opt_set_int(avr, "in_sample_rate",     s->input_samplerate,       0);
    326     av_opt_set_int(avr, "out_sample_rate",    s->samplerate,             0);
     311    av_opt_set_int(avr, "in_channel_layout",  input_layout,           0);
     312    av_opt_set_int(avr, "out_channel_layout", output_layout,          0);
     313    av_opt_set_int(avr, "in_sample_rate",     s->input_samplerate,    0);
     314    av_opt_set_int(avr, "out_sample_rate",    s->samplerate,          0);
    327315    av_opt_set_int(avr, "in_sample_fmt",      s->avCodecCtx->sample_fmt, 0);
    328316#if HAVE_AUBIO_DOUBLE
    329     av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_DBL,         0);
    330 #else
    331     av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_FLT,         0);
     317    av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_DBL,      0);
     318#else
     319    av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_FLT,      0);
    332320#endif
    333321    // TODO: use planar?
     
    341329      char errorstr[256];
    342330      av_strerror (err, errorstr, sizeof(errorstr));
    343       AUBIO_ERR("source_avcodec: Could not open resampling context"
    344          " for %s (%s)\n", s->path, errorstr);
     331      AUBIO_ERR("source_avcodec: Could not open resampling context for %s (%s)\n",
     332          s->path, errorstr);
    345333      return;
    346334    }
     
    359347}
    360348
    361 void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s,
    362     uint_t * read_samples)
    363 {
     349void aubio_source_avcodec_readframe(aubio_source_avcodec_t *s, uint_t * read_samples) {
    364350  AVFormatContext *avFormatCtx = s->avFormatCtx;
    365351  AVCodecContext *avCodecCtx = s->avCodecCtx;
     
    402388      char errorstr[256];
    403389      av_strerror (err, errorstr, sizeof(errorstr));
    404       AUBIO_ERR("source_avcodec: could not read frame in %s (%s)\n",
    405           s->path, errorstr);
     390      AUBIO_ERR("source_avcodec: could not read frame in %s (%s)\n", s->path, errorstr);
    406391      s->eof = 1;
    407392      goto beach;
     
    421406  if (ret < 0) {
    422407    if (ret == AVERROR(EAGAIN)) {
    423       //AUBIO_WRN("source_avcodec: output is not available right now - "
    424       //    "user must try to send new input\n");
     408      //AUBIO_WRN("source_avcodec: output is not available right now - user must try to send new input\n");
    425409      goto beach;
    426410    } else if (ret == AVERROR_EOF) {
    427       AUBIO_WRN("source_avcodec: the decoder has been fully flushed, "
    428           "and there will be no more output frames\n");
     411      AUBIO_WRN("source_avcodec: the decoder has been fully flushed, and there will be no more output frames\n");
    429412    } else {
    430413      AUBIO_ERR("source_avcodec: decoding errors on %s\n", s->path);
     
    441424#endif
    442425  if (got_frame == 0) {
    443     AUBIO_WRN("source_avcodec: did not get a frame when reading %s\n",
    444         s->path);
     426    AUBIO_WRN("source_avcodec: did not get a frame when reading %s\n", s->path);
    445427    goto beach;
    446428  }
     
    449431  if (avFrame->channels != (sint_t)s->input_channels) {
    450432    AUBIO_WRN ("source_avcodec: trying to read from %d channel(s),"
    451         "but configured for %d; is '%s' corrupt?\n",
    452         avFrame->channels, s->input_channels, s->path);
    453     goto beach;
    454   }
    455 #else
    456 #warning "avutil < 53 is deprecated, crashes might occur on corrupt files"
     433        "but configured for %d; is '%s' corrupt?\n", avFrame->channels,
     434        s->input_channels, s->path);
     435    goto beach;
     436  }
    457437#endif
    458438
     
    475455#endif /* HAVE_AVRESAMPLE || HAVE_SWRESAMPLE */
    476456  if (out_samples <= 0) {
    477     AUBIO_WRN("source_avcodec: no sample found while converting frame (%s)\n",
    478         s->path);
     457    AUBIO_WRN("source_avcodec: no sample found while converting frame (%s)\n", s->path);
    479458    goto beach;
    480459  }
     
    494473}
    495474
    496 void aubio_source_avcodec_do(aubio_source_avcodec_t * s, fvec_t * read_data,
    497     uint_t * read) {
     475void aubio_source_avcodec_do(aubio_source_avcodec_t * s, fvec_t * read_data, uint_t * read){
    498476  uint_t i;
    499477  uint_t end = 0;
     
    527505}
    528506
    529 void aubio_source_avcodec_do_multi(aubio_source_avcodec_t * s,
    530     fmat_t * read_data, uint_t * read) {
     507void aubio_source_avcodec_do_multi(aubio_source_avcodec_t * s, fmat_t * read_data, uint_t * read){
    531508  uint_t i,j;
    532509  uint_t end = 0;
     
    574551
    575552uint_t aubio_source_avcodec_seek (aubio_source_avcodec_t * s, uint_t pos) {
    576   int64_t resampled_pos =
    577     (uint_t)ROUND(pos * (s->input_samplerate * 1. / s->samplerate));
     553  int64_t resampled_pos = (uint_t)ROUND(pos * (s->input_samplerate * 1. / s->samplerate));
    578554  int64_t min_ts = MAX(resampled_pos - 2000, 0);
    579555  int64_t max_ts = MIN(resampled_pos + 2000, INT64_MAX);
     
    583559    ret = AUBIO_OK;
    584560  } else {
    585     AUBIO_ERR("source_avcodec: failed seeking in %s (file not opened?)",
    586         s->path);
     561    AUBIO_ERR("source_avcodec: failed seeking in %s (file not opened?)", s->path);
    587562    return ret;
    588563  }
     
    595570      min_ts, resampled_pos, max_ts, seek_flags);
    596571  if (ret < 0) {
    597     AUBIO_ERR("source_avcodec: failed seeking to %d in file %s",
    598         pos, s->path);
     572    AUBIO_ERR("source_avcodec: failed seeking to %d in file %s", pos, s->path);
    599573  }
    600574  // reset read status
  • src/mathutils.c

    red596f7 rf9400d0  
    523523  /* log(freq/A-2)/log(2) */
    524524  midi = freq / 6.875;
    525   midi = LOG (midi) / 0.6931471805599453;
     525  midi = LOG (midi) / 0.69314718055995;
    526526  midi *= 12;
    527527  midi -= 3;
     
    535535  if (midi > 140.) return 0.; // avoid infs
    536536  freq = (midi + 3.) / 12.;
    537   freq = EXP (freq * 0.6931471805599453);
     537  freq = EXP (freq * 0.69314718055995);
    538538  freq *= 6.875;
    539539  return freq;
  • src/notes/notes.c

    red596f7 rf9400d0  
    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

    red596f7 rf9400d0  
    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}
  • src/spectral/filterbank_mel.h

    red596f7 rf9400d0  
    5959
    6060  The filter coefficients are built according to Malcolm Slaney's Auditory
    61   Toolbox, available online at the following address (see file mfcc.m):
    62 
    63   https://engineering.purdue.edu/~malcolm/interval/1998-010/
     61  Toolbox, available at http://engineering.purdue.edu/~malcolm/interval/1998-010/
     62  (see file mfcc.m).
    6463
    6564*/
  • src/spectral/mfcc.h

    red596f7 rf9400d0  
    2727
    2828  The implementation follows the specifications established by Malcolm Slaney
    29   in its Auditory Toolbox, available online at the following address (see
    30   file mfcc.m):
     29  in its Auditory Toolbox, available online (see file mfcc.m).
    3130
    32   https://engineering.purdue.edu/~malcolm/interval/1998-010/
     31  http://engineering.ecn.purdue.edu/~malcolm/interval/1998-010/
    3332
    3433  \example spectral/test-mfcc.c
  • src/spectral/phasevoc.c

    red596f7 rf9400d0  
    213213    synthold[i] += synth[i + pv->hop_s] * pv->scale;
    214214}
    215 
    216 uint_t aubio_pvoc_get_win(aubio_pvoc_t* pv)
    217 {
    218   return pv->win_s;
    219 }
    220 
    221 uint_t aubio_pvoc_get_hop(aubio_pvoc_t* pv)
    222 {
    223   return pv->hop_s;
    224 }
  • src/spectral/phasevoc.h

    red596f7 rf9400d0  
    8989*/
    9090uint_t aubio_pvoc_get_win(aubio_pvoc_t* pv);
    91 
    9291/** get hop size
    9392
  • src/synth/wavetable.c

    red596f7 rf9400d0  
    165165  aubio_wavetable_set_amp (s, 0.);
    166166  //s->last_pos = 0;
    167   return aubio_wavetable_set_playing (s, 0);
     167  return aubio_wavetable_set_playing (s, 1);
    168168}
    169169
  • src/synth/wavetable.h

    red596f7 rf9400d0  
    5151*/
    5252aubio_wavetable_t * new_aubio_wavetable(uint_t samplerate, uint_t hop_size);
     53
     54/** load source in wavetable
     55
     56  \param o wavetable, created by new_aubio_wavetable()
     57  \param uri the uri of the source to load
     58
     59  \return 0 if successful, non-zero otherwise
     60
     61*/
     62uint_t aubio_wavetable_load( aubio_wavetable_t * o, const char_t * uri );
    5363
    5464/** process wavetable function
Note: See TracChangeset for help on using the changeset viewer.