Mindwerks / wildmidi

WildMIDI is a simple software midi player which has a core softsynth library that can be used with other applications.
https://github.com/Mindwerks/wildmidi
Other
201 stars 41 forks source link

add tempomult option to control playing speed #253

Open yotam-medini opened 3 weeks ago

yotam-medini commented 3 weeks ago

This --tempomult option is very useful for practicing music. Especially for choir singers.

psi29a commented 3 weeks ago

Can you explain how this would be used? Can you provide an example? :)

(aside from, speed it up :P )

sezero commented 3 weeks ago

BTW, This is an API + ABI change: Do we really want this?

yotam-medini commented 3 weeks ago

Say for example we download https://www.cpdl.org/wiki/images/7/74/Ws-bwv-mp76.mid and play the ~15 seconds segment 0:40-0:55 via wildmidi -i 40 -j 55 Ws-bwv-mp76.mid We can play it slower - for easy practicing - via (will take ~18 seonds) wildmidi -i 40 -j 55 -T 0.8 Ws-bwv-mp76.mid or faster - as the choir conductor's taste - via (will take ~8 seconds) wildmidi -i 40 -j 55 -T 1.8 Ws-bwv-mp76.mid

I chose the '-T' option character as timidity has similar option: -T n, --adjust-tempo=n Adjust tempo to n%; 120 play MOD files with an NTSC Amiga's timing.

yotam-medini commented 3 weeks ago

About the API change. An alternative would be to introduce global :(static): variable(s) and add API functions to get/set them.

Also for both API-change or API-additions it may be better instead of the 'float tempo_mult' value to have something like

  struct _parse_cfg {
    float tempo_mult;
    // possible more future parameters
  };

with

  void init_parse_cfg(struct _parse_cfg *p) {
    p->tempo_mult = 1.0f;
    // possible more default future settings
  }

and in wildmidi.c have

  static _parse_cfg parse_cfg;
  ...
  int main(int argc, char **argv) {
    ...
    init_parse_cfg(&parse_cfg);
    ...
  }

and pass &parse_cfg instead of tempo_mult. This will allow for future enhancements without API change.