rualark / MGenPortal

Web interface to MGen, allowing to analyze, correct and perform music
http://artportal.su/ctools
GNU Affero General Public License v3.0
3 stars 0 forks source link

User is able to change settings for empty instrument, which results in config error #359

Closed rualark closed 5 years ago

rualark commented 5 years ago

image

rualark commented 5 years ago

Everything seems ok in initial config: Instruments = "Flute,Flute,Oboe,Clarinet,Clarinet,Bassoon,Horn,Horn,Trumpet,Timbales,Cymbals american,Violins section,Violins section,Violins II section,Violins II section,Violas section,Violas section,Cellos section,Contrabasses section" # Injected by Marie-Helene Choquette at 2019-03-29 04:07:03

rualark commented 5 years ago

But next config shows problem: Instruments = "Flute,Flute,Oboe,Clarinet,Clarinet,Bassoon,Horn,Horn,Trumpet,Timbales,Cymbals american,Violins section,Violins section,Violins II section,Violins II section,Violas section,Violas section,Cellos section,Contrabasses section" # Injected by Marie-Helene Choquette at 2019-03-29 04:07:03 "//21": Volume = "0" # Injected by Marie-Helene Choquette at 2019-03-29 04:36:03 "//20": Volume = "0" # Injected by Marie-Helene Choquette at 2019-03-29 04:36:03 "Contrabasses section/Arco/19": Volume = "88" # Injected by Marie-Helene Choquette at 2019-03-29 04:36:03 "Violas section/Arco/16": Volume = "88" # Injected by Marie-Helene Choquette at 2019-03-29 04:36:03 "Trumpet/Normal/9": Volume = "113" # Injected by Marie-Helene Choquette at 2019-03-29 04:36:03

rualark commented 5 years ago

Actually, there are only 19 instruments, but user changes volume for instruments 20 and 21

rualark commented 5 years ago

Yet there seems to be some instrument 21: image

rualark commented 5 years ago

Which is actually empty even at 0 dB render: image

This is also proven correct by midi file explorer: image

rualark commented 5 years ago

So this problem seems to happen because of empty tracks. What happens if there are empty tracks in between?

rualark commented 5 years ago

Empty example shows that first and last empty tracks are omitted: image

But later they are added at the bottom: image

rualark commented 5 years ago

So, first tracks are lost, while last tracks are sent to default instrument: image

image

rualark commented 5 years ago

Solutions:

Usually empty tracks are not needed, but in some situations it is convenient to show them, so that instrument mapping becomes universal

rualark commented 5 years ago

The source of this problem lies in two different MIDI import algorithms in PHP and C++

rualark commented 5 years ago

Last track can actually contain unneeded information