Midier icon indicating copy to clipboard operation
Midier copied to clipboard

Support configuring gate value

Open razrotenberg opened this issue 4 years ago • 6 comments

Currently, gate is always 100%

razrotenberg avatar Sep 18 '20 22:09 razrotenberg

Hi and thank you for the awesome project! I would really need to be able to set the gate value to <100% though, in order to be able to correctly control my synth. Do you possibly have ideas how this could be implemented?

kausiala avatar Sep 05 '23 20:09 kausiala

hey @kausiala and thanks for reaching out! so as you can see I created this issue 3 years ago and unfortunately I forgot some things since then :grin:

can you pls elaborate on this need and why this is needed actually?

do you mean that you would like to be able to control how much time a note is being played? pls share as many details/info here as it would help me a lot refreshing my memory here :pray:

razrotenberg avatar Sep 06 '23 06:09 razrotenberg

Yes, I understand some things might be forgotten in three years :)

I am building a MIDI arpeggiator out of an old video editor remote control unit, to control a DIY analog synthesizer. Your projects have been very useful to get things going.

However, regarding this issue. In the synthesizer, there is an attack/release generator which is controlled by a gate signal. Whenever a MIDI note is playing, the gate is open. When the gate closes (note off), the release period of the AR cycle starts. The problem is, with 100% gate from the sequencer, the next note starts immediately after previous ends, and there is no time for the previous note to decay according to the release time.

What I would wish to have in Midier, is configurable gate value (as the issue title states) from 0->100%. So, as an example, for 1/8th notes with 50% gate, each note would actually play for 1/16th. So yes, essentially as you said, to control for how long time the note is played.

kausiala avatar Sep 06 '23 09:09 kausiala

hey @kausiala thanks for the details!

so I went over the code and it seems that this is the area in the code that is responsible for calculating when a not should stop playing. if I'm right, all that needs to be done is to multiply the calculated subdivisions variable by the gate value. so for example a gate value of 1.0 (100%) would give what is used today and a gate value of 0.5 (50%) will give 1/2 of the subdivision count.

do you think that I got it right? also, if you have a working setup, can you try modifying the code just to test if it works by replacing line 108 with:

const auto subdivisions = (unsigned)(Time::Subdivisions / count) * 0.5;

let me know if you have the time to test it so that we know it will work as expected :+1:

razrotenberg avatar Sep 07 '23 12:09 razrotenberg

Hi @razrotenberg, and big thanks for taking the time to help me out with this!

I made the test you suggested, and the result is as expected 👍

When I have the time, I will continue with this to make the gate value configurable.

kausiala avatar Sep 09 '23 08:09 kausiala

That's great to hear! Will wait to see your progress 😀

razrotenberg avatar Sep 09 '23 10:09 razrotenberg