In my program I control the velocity, but I saw on https://midi.org/forum/18396-velocity-vs-volume that changing the velocity affects how it sounds, should I use "MIDI Master Volume message" instead? problem with this is that a file can contain it and change the volume
[code type=markup]
velocity = velocity * volumen
[/code]
The velocity affect's a single note's volume (and maybe other parameters).
The expression (CC 11) affects the entire channel, and should be used by the file for temporary changes.
The volume (CC 7) affects the entire channel, and should be set once at the beginning of the file so that the player can adjust it later.
The master volume (universal SysEx 04 01) affects all channels and should not be set by the file.
There is no guarantee that files do what they should do.
Thanks it has worked for me.