PYIN Parameters » History » Version 42
Chris Cannam, 2020-03-17 07:34 PM
1 | 1 | Chris Cannam | h1. PYIN Parameters |
---|---|---|---|
2 | 1 | Chris Cannam | |
3 | 35 | Chris Cannam | h3. The pYIN plugin |
4 | 35 | Chris Cannam | |
5 | 1 | Chris Cannam | Tony uses a Vamp plugin called "pYIN":/projects/pyin for pitch and note analysis. |
6 | 1 | Chris Cannam | |
7 | 36 | Chris Cannam | The plugin can be used in other Vamp plugin hosts as well: see the "pYIN project page":/projects/pyin to download the plugin separately from Tony. |
8 | 36 | Chris Cannam | |
9 | 36 | Chris Cannam | This page may be helpful if you need to get results from pYIN that match those generated in Tony (or vice versa). |
10 | 1 | Chris Cannam | |
11 | 41 | Chris Cannam | h3. Audio signal normalisation |
12 | 41 | Chris Cannam | |
13 | 41 | Chris Cannam | Tony normalises all loaded audio files by scaling to a signal peak of +/- 1.0 before analysis. If you are trying to match Tony's behaviour in another application, look for an option to do this. For example in "Sonic Annotator":https://vamp-plugins.org/sonic-annotator you will need the @--normalise@ option. |
14 | 41 | Chris Cannam | |
15 | 42 | Chris Cannam | This is relevant because of the use by default of the "penalise soft pitches" parameter, which if enabled has a different result in un-normalised audio owing to the different effective threshold. |
16 | 41 | Chris Cannam | |
17 | 35 | Chris Cannam | h3. pYIN parameters that Tony uses |
18 | 35 | Chris Cannam | |
19 | 24 | Chris Cannam | pYIN has a number of processing parameters which can be adjusted, and Tony contains a number of options (on the Analysis menu) which adjust some of them. However, the names, identifiers, and default values of the pYIN parameters do not match those used in Tony. Generally this is because the parameters found in pYIN are continuous value ranges, while the settings in Tony are all on-off toggles. |
20 | 1 | Chris Cannam | |
21 | 1 | Chris Cannam | Here is a table showing the correspondence between Tony menu options and pYIN parameters, as of Tony v2.1 and pYIN v1.1. |
22 | 1 | Chris Cannam | |
23 | 30 | Chris Cannam | |*Tony option*|*pYIN parameter name*|*pYIN parameter id*|*pYIN parameter type*|*pYIN default value*|*Value when Tony option is on*|*Value when Tony option is off*|*Tony option default*| |
24 | 30 | Chris Cannam | |Unbiased Timing (slow)|Use non-standard precise YIN timing (slow)|@precisetime@|Toggle|Off|On|Off|Off| |
25 | 30 | Chris Cannam | |Penalise Soft Pitches|Suppress low amplitude pitch estimates|@lowampsuppression@|Range 0.0-1.0|0.1|0.2|0.0|On| |
26 | 30 | Chris Cannam | |High Onset Sensitivity|Onset sensitivity|@onsetsensitivity@|Range 0.0-1.0|0.7|0.7|0.0|On| |
27 | 30 | Chris Cannam | |Drop Short Notes|Duration pruning threshold|@prunethresh@|Range 0.0-0.2|0.1|0.1|0.0|On| |
28 | 11 | Chris Cannam | |
29 | 31 | Chris Cannam | *Note*: There is a bug in Tony v2.1 (as well as earlier releases) in the handling of the "Penalise Soft Pitches" option. When you first run the application, this option is shown as ticked in the menu, but it is not actually activated when running pYIN (the pYIN parameter is instead set to 0.0). If you switch the option off and on again in the menu, or select "Reset Options to Defaults", then the parameter will subsequently be set correctly. This state is remembered in subsequent runs, so you only have to do this once. The bug will be fixed in Tony v2.1.1. This does unfortunately mean the behaviour of v2.1.1 "out of the box" will differ slightly from the (erroneous) first-run behaviour of v2.1. |
30 | 16 | Chris Cannam | |
31 | 35 | Chris Cannam | h3. Other pYIN parameters |
32 | 35 | Chris Cannam | |
33 | 32 | Chris Cannam | There are also some parameters in pYIN that cannot be changed in Tony - the application leaves these all at their default values. They are: |
34 | 33 | Chris Cannam | |
35 | 33 | Chris Cannam | |*pYIN parameter name*|*pYIN parameter id*|*pYIN parameter type*|*Default*| |
36 | 33 | Chris Cannam | |Yin threshold distribution|@threshdistr@|8 distinct options|"Beta (mean 0.15)"| |
37 | 33 | Chris Cannam | |Fixed-lag smoothing|@fixedlag@|Toggle|On| |
38 | 10 | Chris Cannam | |Output estimates classified as unvoiced?|@outputunvoiced@|Three-way toggle|Off| |
39 | 1 | Chris Cannam | |
40 | 40 | Chris Cannam | h3. How to set these parameters when using pYIN in Sonic Annotator |
41 | 37 | Chris Cannam | |
42 | 37 | Chris Cannam | (See also the "Sonic Annotator documentation":/projects/sonic-annotator/wiki) |
43 | 37 | Chris Cannam | |
44 | 37 | Chris Cannam | You can specify a plugin for Sonic Annotator using the @-d@ (default) flag, which tells it to run a plugin with the default parameters: |
45 | 37 | Chris Cannam | |
46 | 37 | Chris Cannam | <pre> |
47 | 39 | Chris Cannam | $ sonic-annotator -d vamp:pyin:pyin:smoothedpitchtrack audio.wav -w csv --csv-one-file output.csv |
48 | 37 | Chris Cannam | </pre> |
49 | 37 | Chris Cannam | |
50 | 38 | Chris Cannam | But if you want to set any parameters to non-default values, you need a transform specification file. You can create a skeleton and then edit it: |
51 | 37 | Chris Cannam | |
52 | 38 | Chris Cannam | <pre> |
53 | 38 | Chris Cannam | $ sonic-annotator -s vamp:pyin:pyin:smoothedpitchtrack > pitchtrack.ttl |
54 | 38 | Chris Cannam | </pre> |
55 | 38 | Chris Cannam | |
56 | 38 | Chris Cannam | Then edit the file @pitchtrack.ttl@ and change the parameter values in it. For example, you might change this block |
57 | 38 | Chris Cannam | |
58 | 38 | Chris Cannam | <pre> |
59 | 38 | Chris Cannam | vamp:parameter_binding [ |
60 | 38 | Chris Cannam | vamp:parameter [ vamp:identifier "onsetsensitivity" ] ; |
61 | 38 | Chris Cannam | vamp:value "0.7"^^xsd:float ; |
62 | 38 | Chris Cannam | ] ; |
63 | 38 | Chris Cannam | vamp:parameter_binding [ |
64 | 38 | Chris Cannam | vamp:parameter [ vamp:identifier "outputunvoiced" ] ; |
65 | 38 | Chris Cannam | vamp:value "0"^^xsd:float ; |
66 | 38 | Chris Cannam | ] ; |
67 | 38 | Chris Cannam | </pre> |
68 | 38 | Chris Cannam | |
69 | 38 | Chris Cannam | to |
70 | 38 | Chris Cannam | |
71 | 38 | Chris Cannam | <pre> |
72 | 38 | Chris Cannam | vamp:parameter_binding [ |
73 | 38 | Chris Cannam | vamp:parameter [ vamp:identifier "onsetsensitivity" ] ; |
74 | 38 | Chris Cannam | vamp:value "0.0"^^xsd:float ; |
75 | 38 | Chris Cannam | ] ; |
76 | 38 | Chris Cannam | vamp:parameter_binding [ |
77 | 38 | Chris Cannam | vamp:parameter [ vamp:identifier "outputunvoiced" ] ; |
78 | 38 | Chris Cannam | vamp:value "2"^^xsd:float ; |
79 | 38 | Chris Cannam | ] ; |
80 | 38 | Chris Cannam | </pre> |
81 | 38 | Chris Cannam | |
82 | 38 | Chris Cannam | to adjust the onset sensitivity and also tell pYIN to return negative values for unvoiced frames. Then run Sonic Annotator with this transform file: |
83 | 38 | Chris Cannam | |
84 | 38 | Chris Cannam | <pre> |
85 | 39 | Chris Cannam | $ sonic-annotator -t pitchtrack.ttl audio.wav -w csv --csv-one-file output.csv |
86 | 38 | Chris Cannam | </pre> |
87 | 37 | Chris Cannam | |
88 | 35 | Chris Cannam | h3. Screenshots |
89 | 10 | Chris Cannam | |
90 | 34 | Chris Cannam | |*Options in the Analysis menu of Tony that control pYIN parameters*|*Options available when using pYIN directly in Sonic Visualiser*| |
91 | 34 | Chris Cannam | |!Screenshot_2019-11-18_13-03-34.png!|!Screenshot_2019-11-18_13-04-25.png!| |