annotate src/Instruments.h @ 213:5bde003a43a9

Make source sparsity configurable in instrument pack as well as pitch sparsity; make both equal to 1 for piano templates
author Chris Cannam
date Tue, 15 Jul 2014 13:28:25 +0100
parents 59e3cca75b8d
children ebe5e0942bb8
rev   line source
Chris@161 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@161 2
Chris@161 3 /*
Chris@161 4 Silvet
Chris@161 5
Chris@161 6 A Vamp plugin for note transcription.
Chris@161 7 Centre for Digital Music, Queen Mary University of London.
Chris@161 8
Chris@161 9 This program is free software; you can redistribute it and/or
Chris@161 10 modify it under the terms of the GNU General Public License as
Chris@161 11 published by the Free Software Foundation; either version 2 of the
Chris@161 12 License, or (at your option) any later version. See the file
Chris@161 13 COPYING included with this distribution for more information.
Chris@161 14 */
Chris@161 15
Chris@161 16 #include <vector>
Chris@161 17 #include <string>
Chris@161 18
Chris@161 19 #ifndef SILVET_INSTRUMENTS_H
Chris@161 20 #define SILVET_INSTRUMENTS_H
Chris@161 21
Chris@161 22 /**
Chris@161 23 * Define an instrument pack, i.e. a group of templates that are made
Chris@161 24 * available as a single preset at the user interface level. A pack
Chris@161 25 * might contain only a single instrument template (e.g. bassoon), or
Chris@161 26 * it may be a compound of several templates (e.g. different piano
Chris@161 27 * recordings forming a single piano pack), or it may be a group of
Chris@161 28 * distinct instrument templates (e.g. a pack containing all supported
Chris@161 29 * instruments, or potentially groupings such as string quartet or
Chris@161 30 * rock band).
Chris@161 31 */
Chris@161 32 class InstrumentPack
Chris@161 33 {
Chris@161 34 public:
Chris@161 35 static const int templateNoteCount;
Chris@161 36 static const int templateHeight;
Chris@161 37 static const int templateMaxShift;
Chris@161 38 static const int templateSize;
Chris@161 39
Chris@161 40 int lowestNote;
Chris@161 41 int highestNote;
Chris@183 42
Chris@183 43 int maxPolyphony; // realistic practical limit, not a theoretical one
Chris@183 44 float pitchSparsity;
Chris@213 45 float sourceSparsity;
Chris@183 46 float levelThreshold;
Chris@183 47
Chris@161 48 std::string name;
Chris@161 49
Chris@161 50 struct Templates {
Chris@161 51 int lowestNote;
Chris@161 52 int highestNote;
Chris@161 53 // templateNoteCount * templateSize
Chris@161 54 std::vector<std::vector<float> > data;
Chris@161 55 };
Chris@161 56
Chris@161 57 std::vector<Templates> templates;
Chris@161 58
Chris@161 59 static std::vector<InstrumentPack> listInstrumentPacks();
Chris@161 60
Chris@161 61 private:
Chris@161 62 InstrumentPack(int lowest, int highest, std::string n,
Chris@161 63 std::vector<Templates> tt) :
Chris@161 64 lowestNote(lowest),
Chris@161 65 highestNote(highest),
Chris@183 66 maxPolyphony(5),
Chris@183 67 pitchSparsity(1.1),
Chris@213 68 sourceSparsity(1.2),
Chris@183 69 levelThreshold(5),
Chris@161 70 name(n),
Chris@161 71 templates(tt) { }
Chris@161 72 };
Chris@161 73
Chris@161 74 #endif