Control Change 84 is Portamento Control*. On this site, see the List of Control Change Messages
and the MIDI 1.0 Detailed Specification
, PDF page 21 / printed page 16: "Portamento Control [...] communicates which note number the subsequent note is gliding from. [...] When a Note-On is received after a Portamento Control message, the voice's pitch will glide from the key specified in the Portamento Control message to the new Note-On's pitch at the rate set by the portamento time controller [CC5] (ignoring portamento on/off [CC65])."
If I understand correctly, Andrey is using a Yamaha PSR-SX900 to record Auto-Accompaniment chords into a Song. In the first recording (Test 1.mid), everything is correct -- various notes have a CC84 message in front of them. But when Andrey re-recorded part of the song starting at measure 17 (Test 2.mid), the Yamaha PSR-SX900 apparently modified and removed CC84 messages in measures 1 to 16. For example, here is the first chord that is changed:
Before (Test 1.mid) After (Test 2.mid)
Position Ch Kind Data Position Ch Kind Data
──────── ── ─────── ────────────── ──────── ── ─────── ──────────────
3:3:1856 12 Control CC 84, Val 45 3:3:1856 12 Control CC 84, Val 52
3:3:1856 12 Note On Key 50, Vel 30 3:3:1856 12 Note On Key 50, Vel 30
3:3:1856 12 Control CC 84, Val 64
3:3:1856 12 Note On Key 65, Vel 35 3:3:1856 12 Note On Key 65, Vel 35
3:3:1856 12 Control CC 84, Val 60
3:3:1856 12 Note On Key 62, Vel 20 3:3:1856 12 Note On Key 62, Vel 20
3:3:1856 12 Control CC 84, Val 52
3:3:1856 12 Note On Key 53, Vel 5 3:3:1856 12 Note On Key 53, Vel 5
In this chord, the last CC84 value was moved in front of the first note, and the other three CC84 messages were removed. There are various other chords in measures 1 to 16 that were changed the same way.
The CC84 and Note On messages in the chord are all at the same tick position, so maybe the Yamaha PSR-SX900 decided only the last CC84 value at that position was worth keeping. However, it seems strange that the Yamaha PSR-SX900 would correctly keep all of the CC84 messages during the original recording, it only modifies them when you re-record part of the song starting at a later position.
Andrey: Have you tried contacting Yamaha? On the Yamaha PSR-SX900 Downloads
page, I noticed the firmware update available is from earlier this year 2022, so Yamaha might still be actively supporting this keyboard. Perhaps Yamaha might be interested in trying to fix this bug. I see there is a "Product Registration" link above the download list. Maybe if you register and log in you might get a way to contact Yamaha support? Or maybe try something on the Contact Us
I'm not sure if we can help much, but if you tell us more details how you start the second recording, maybe we might notice some setting or procedure in the manual that you can try doing differently.
(* Note about Portamento Control: I originally thought the CC84 messages in Andrey's MIDI files were being used for their standard "Portamento Control" purpose. But later I noticed the chords that use CC84 in "Test 1.mid" mostly have notes that are very short in duration -- most of them are less than 0.1 second long. I now suspect the CC84 messages and these short chords are maybe being used to encode some kind of chord information and not intended to be actual protamentos? Whatever effect they actually have on the Yamaha PSR-SX900, I guess Andrey still wants them to be preserved.)