allow to configure transient detection sensitivity

NB. this does not yet re-analyze regions when the config changes
and is hence also not [yet] exposed in the GUI.
This commit is contained in:
Robin Gareus
2016-05-25 17:52:50 +02:00
parent 5550eebe2f
commit 6c502b8315
4 changed files with 11 additions and 7 deletions

View File

@@ -19,6 +19,7 @@
#include "ardour/analyser.h"
#include "ardour/audiofilesource.h"
#include "ardour/rc_configuration.h"
#include "ardour/session_event.h"
#include "ardour/transient_detector.h"
@@ -110,6 +111,7 @@ Analyser::analyse_audio_file_source (boost::shared_ptr<AudioFileSource> src)
try {
TransientDetector td (src->sample_rate());
td.set_sensitivity (3, Config->get_transient_sensitivity()); // "General purpose"
if (td.run (src->get_transients_path(), src.get(), 0, results) == 0) {
src->set_been_analysed (true);
} else {

View File

@@ -98,6 +98,7 @@ CONFIG_VARIABLE (float, audio_playback_buffer_seconds, "playback-buffer-seconds"
CONFIG_VARIABLE (float, midi_track_buffer_seconds, "midi-track-buffer-seconds", 1.0)
CONFIG_VARIABLE (uint32_t, disk_choice_space_threshold, "disk-choice-space-threshold", 57600000)
CONFIG_VARIABLE (bool, auto_analyse_audio, "auto-analyse-audio", false)
CONFIG_VARIABLE (float, transient_sensitivity, "transient-sensitivity", 50)
/* OSC */

View File

@@ -37,10 +37,7 @@ public:
static std::string operational_identifier();
void set_threshold (float);
void set_sensitivity (float);
float get_threshold () const;
float get_sensitivity () const;
void set_sensitivity (uint32_t, float);
int run (const std::string& path, Readable*, uint32_t channel, AnalysisFeatureList& results);
void update_positions (Readable* src, uint32_t channel, AnalysisFeatureList& results);

View File

@@ -86,11 +86,15 @@ TransientDetector::set_threshold (float val)
}
void
TransientDetector::set_sensitivity (float val)
TransientDetector::set_sensitivity (uint32_t mode, float val)
{
if (plugin) {
plugin->selectProgram ("Percussive onsets");
plugin->setParameter ("sensitivity", val);
// see libs/vamp-plugins/OnsetDetect.cpp
//plugin->selectProgram ("General purpose"); // dftype = 3, sensitivity = 50, whiten = 0 (default)
//plugin->selectProgram ("Percussive onsets"); // dftype = 4, sensitivity = 40, whiten = 0
plugin->setParameter ("dftype", mode);
plugin->setParameter ("sensitivity", std::min (100.f, std::max (0.f, val)));
plugin->setParameter ("whiten", 0);
}
}