shithub: aubio

Download patch

ref: 357f81e2b95e86c7378fba81335b56a78ccee7b6
parent: 929d76cc4f028a0c9ddf36a66c3063ced1ae82b9
author: Paul Brossier <piem@piem.org>
date: Tue Oct 30 08:56:50 EDT 2018

[cmd] add --silence and --release-drop to notes subcommand

--- a/python/lib/aubio/cmd.py
+++ b/python/lib/aubio/cmd.py
@@ -101,6 +101,8 @@
             help='estimate midi-like notes (monophonic)')
     subparser.add_input()
     subparser.add_buf_hop_size()
+    subparser.add_silence()
+    subparser.add_release_drop()
     subparser.add_time_format()
     subparser.add_verbose_help()
     subparser.set_defaults(process=process_notes)
@@ -207,6 +209,12 @@
                 action="store", dest="silence", default=-70,
                 help="silence threshold")
 
+    def add_release_drop(self):
+        self.add_argument("-d", "--release-drop",
+                metavar = "<value>", type=float,
+                action="store", dest="release_drop", default=10,
+                help="release drop threshold")
+
     def add_minioi(self, default="12ms"):
         self.add_argument("-M", "--minioi",
                 metavar = "<value>", type=str,
@@ -379,6 +387,10 @@
     def __init__(self, args):
         self.parse_options(args, self.valid_opts)
         self.notes = aubio.notes(**self.options)
+        if args.silence is not None:
+            self.notes.set_silence(args.silence)
+        if args.release_drop is not None:
+            self.notes.set_release_drop(args.release_drop)
         super(process_notes, self).__init__(args)
     def __call__(self, block):
         return self.notes(block)