From: mathiasfriman <notifications@github.com>
To: ahlstromcj/sequencer64 <sequencer64@noreply.github.com>
Cc: "C. Ahlstrom" <ahlstromcj@gmail.com>, Mention <mention@noreply.github.com>
Subject: Re: [ahlstromcj/sequencer64] midi control out (#58)

[-- Autoview using elinks -dump '/tmp/mutt.html' --]
   First, kudos for a great software, it has almost everything I need! :)

   I've tried [1]@igorangst fork just now, configured it with

   ./configure --enable-midictrlout

   I'm aiming at triggering some patterns/sequences with my novation
   Launchpad Pro. I have been able to use the [midi-control] for a 8x4-grid
   and an 8x8 grid using mididings, but the [midi-control-out] resets itself
   to all zeroes [0 0 0 0 0 0] on all 0-31 fields when i quit seq64 if my
   data looks like this:

   0 [0 0 0 0 0] [0 0 0 0 0] [0 2 144 81 16] [0 0 0 0 0]
   [..]
   31 [0 0 0 0 0] [0 0 0 0 0] [0 2 144 58 16] [0 0 0 0 0]

   It had to do with me not enabling (on/off-ing) the entries. When I put a 1
   to enable the entries, they do not reset.

   To send flashing green when queued I should use a row like

   0 [0 0 0 0 0] [0 0 0 0 0] [1 2 144 81 16] [0 0 0 0 0]

   where 2 is the MIDI-channel that is mandatory for getting the button to
   blink. However, when I quit seq64 the 2 is gone. I see that the control
   out is hardwired to MIDI-channel 15, where can I change this in the code?

   This is really the only thing left - in an otherwise great (!!) piece of
   software - that stops me from using it in a live setting. I'm happy to
   test, however I'm not a C-developer..

Date: Wed, 05 Jun 2019 03:50:53 -0700
From: Igor Angst <notifications@github.com>
To: ahlstromcj/sequencer64 <sequencer64@noreply.github.com>
Cc: "C. Ahlstrom" <ahlstromcj@gmail.com>, Mention <mention@noreply.github.com>
Subject: Re: [ahlstromcj/sequencer64] midi control out (#58)

[-- Autoview using elinks -dump '/tmp/mutt.html' --]
   Hi,
   I confirm that there is a problem with inactive entries not being saved
   and thus being reset to 0. It has been some time that I worked on this,
   and I'm really happy that there is somebody out there ready to give it a
   try with a real piece of hardware. I will try and fix this as soon as I
   can spare some time. It is quite possible that I didn't implement the
   channel, since I only use channel 1 in my hardware. As far as I remember,
   15 is the number of the (ALSA/Jack) output and does not refer to the MIDI
   channel.

Date: Thu, 06 Jun 2019 09:03:02 +0000 (UTC)
From: mathiasfriman <notifications@github.com>
To: ahlstromcj/sequencer64 <sequencer64@noreply.github.com>
Cc: "C. Ahlstrom" <ahlstromcj@gmail.com>, Mention <mention@noreply.github.com>
Subject: Re: [ahlstromcj/sequencer64] midi control out (#58)

[-- Autoview using elinks -dump '/tmp/mutt.html' --]
   Awesome!
   I'll change the m_buss(2) parameter in libseq64/src/midi_control_out.cpp
   back to m_buss(15) then. Wingin' it a bit... :)

   If I may make a wish list it would be to have the grid on the Launchpad
   Pro reflect the grid in Sequencer64, maybe with some sort of translation
   table between the default colors in Seq64:

     * Red
     * Green
     * Yellow
     * Blue
     * Magenta
     * White
     * Dark red
     * Dark Green
     * Dark Yellow
     * Dark Blue
     * Dark Magenta
     * Dark Cyan
     * Orange
     * Dark Orange

   That would (in my mind at least) allow for e.g. setting a 3-color scheme
   for the controllers that does not have full RGB-color LEDs, just by
   adjusting the color codes. Also, I would not use the Red and Green colors
   (why, I hope will be apparent below), and may want to translate them into
   some other colors instead.

   I would also like Sequencer64 to mimick the behaviour of the Launchpad
   when used with Ableton Live (which I have never done, just seen videos).
   That means that

     * When queuing a sequence, it should be flashing green. (MIDI-Ch 2,
       NoteOn, Pad XX, Color)
     * When playing a sequence, it should be pulsing green. (MIDI-Ch 3,
       NoteOn, Pad XX, Color)
     * When arming a track to record, it should be flashing red. (MIDI-Ch 2,
       NoteOn, Pad XX, Color)
     * When recording in a sequence, it should be pulsing red. (MIDI-Ch 3,
       NoteOn, Pad XX, Color)

   Stopping these requires a send of a (MIDI-Ch 1, NoteOn, Pad XX, Color) to
   the Launchpad Pro.

   It is also possible to light several LEDs with a single SysEx-message on
   the Launchpad Pro, further detailed in the [1]programmers reference but
   that might not be a way forward for other controllers, so maybe it's best
   to stick with MIDI messages.

   Also, the pad note numbers seems to vary wildly even within the Launchpad
   family of controllers...

Date: Thu, 06 Jun 2019 08:32:04 -0700
From: mathiasfriman <notifications@github.com>
To: ahlstromcj/sequencer64 <sequencer64@noreply.github.com>
Cc: "C. Ahlstrom" <ahlstromcj@gmail.com>, Mention <mention@noreply.github.com>
Subject: Re: [ahlstromcj/sequencer64] midi control out (#58)

[-- Autoview using elinks -dump '/tmp/mutt.html' --]
   I'm starting seq64 with the -j option to connect it to JACK transport and
   use JACK midi, not ALSA.

   If in Sequencer64 I open a sequence and select MIDI Output Bus "[0] 0:0
   seq64:system midi_playback_1" and MIDI channel 1, 2 or 3 and connect that
   bus/port in Qjackctl to the writable/input port "system: midi_playback_2"
   I can light up the LaunchPad Pro buttons by playing/sending MIDI notes to
   it.

   However, I can't get anything to light up using the Launchpad Pro
   triggering patterns. They queue up and start playing, but not a single
   indication on the LPPro.

   Do I have to connect some ports in JACK to get it to work, or how do I go
   about it?

Date: Thu, 06 Jun 2019 12:27:50 -0700
From: mathiasfriman <notifications@github.com>
To: ahlstromcj/sequencer64 <sequencer64@noreply.github.com>
Cc: "C. Ahlstrom" <ahlstromcj@gmail.com>, Mention <mention@noreply.github.com>
Subject: Re: [ahlstromcj/sequencer64] midi control out (#58)

[-- Autoview using elinks -dump '/tmp/mutt.html' --]
   These lines in libseq64/src/perform.cpp:

 #ifdef SEQ64_MIDI_CTRL_OUT
     if (status | c_status_queue)
         m_midi_ctrl_out->send_event(midi_control_out::action_queue_on);

   and these lines of code in libseq64/src/sequence.cpp:

 #ifdef SEQ64_MIDI_CTRL_OUT
     if (m_queued)
     {
         m_parent->get_midi_control_out()->send_seq_event(number(), midi_control_out
::seq_action_queue);

   only get executed when I quit seq64, not when queueing the various
   sequences during play.

   Maybe I'm not doing something right? As I said previously, I'm just
   guessing here to try to find something that seems to have a bearing on
   what I'm trying to accomplish..

Date: Fri, 07 Jun 2019 00:57:57 -0700
From: Igor Angst <notifications@github.com>
To: ahlstromcj/sequencer64 <sequencer64@noreply.github.com>
Cc: "C. Ahlstrom" <ahlstromcj@gmail.com>, Mention <mention@noreply.github.com>
Subject: Re: [ahlstromcj/sequencer64] midi control out (#58)

[-- Autoview using elinks -dump '/tmp/mutt.html' --]
   Thanks for the feedback. By "get executed" I suppose you mean that the
   messages only make it out to the Launch Pad when you quit seq64. I guess
   this is related to the fact that the MIDI output bus needs a flush. I
   could not figure out why this is the case, it seems to depend on the
   underlying MIDI implementation. Maybe [1]@ahlstromcj knows more about
   this. Can you try the following:

   The functions send_(seq)_event have an optional boolean argument, telling
   it to flush the bus after sending. So change the code snippets to
   if (status | c_status_queue)
   m_midi_ctrl_out->send_event(midi_control_out::action_queue_on, true);
   and
   m_parent->get_midi_control_out()->send_seq_event(number(),
   midi_control_out::seq_action_queue, true);


Date: Fri, 07 Jun 2019 06:56:54 -0700
From: mathiasfriman <notifications@github.com>
To: ahlstromcj/sequencer64 <sequencer64@noreply.github.com>
Cc: "C. Ahlstrom" <ahlstromcj@gmail.com>, Mention <mention@noreply.github.com>
Subject: Re: [ahlstromcj/sequencer64] midi control out (#58)

[-- Autoview using elinks -dump '/tmp/mutt.html' --]
   Tried this, and that doesn't do the trick. :(

   I've set a number of printf statements in the various files just after the
   #ifdef SEQ64_MIDI_CTRL_OUT lines. It doesn't print regularly. It's like it
   doesn't even enter the #ifdef SEQ64_MIDI_CTRL_OUT conditionals until it
   bursts a number of the printf-statements in a random fashion without any
   discernable pattern.

   This is probably not the best way to do this, but I'm not much of a
   programmer.. :/ So this is what got printed after starting seq64:

 [..]
 Input ports (9):
   [0] 0:0 system:midi_playback_1
   [1] 0:1 system:midi_playback_2
   [2] 0:2 system:midi_playback_3
   [3] 0:3 system:midi_playback_4
   [4] 0:4 system:midi_playback_5
   [5] 0:5 system:midi_playback_6
   [6] 0:6 system:midi_playback_7
   [7] 0:7 system:midi_playback_8
   [8] 0:8 system:midi_playback_9
 Output ports (5):
   [1] 0:1 system:midi_capture_2
   [2] 0:2 system:midi_capture_3
   [3] 0:3 system:midi_capture_4
   [4] 0:4 system:midi_capture_5

 [JACK sync enabled]
 [JACK sync still enabled]
 [JACK sync still enabled]

   After a while, all these printf statements come in one single burst,
   triggered by what? I don't know.
   I've tried to show where I've put the print statements with the syntax -
   path/to/file: row

 Sending play midi control - libseq64/src/sequence.cpp: 4802
 Sending midi control event action queue on - libseq64/src/perform.cpp: 5517
 MIDI CTRL OUT defined - libseq64/src/sequence.cpp: 1032
 queued out - libseq64/src/sequence.cpp: 1035
 Sending play midi control - libseq64/src/sequence.cpp: 4802
 MIDI CTRL OUT defined
 queued out
 Sending play midi control
 MIDI CTRL OUT defined
 queued out
 Sending play midi control
 MIDI CTRL OUT defined
 queued out
 Sending play midi control
 MIDI CTRL OUT defined
 queued out
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 MIDI CTRL OUT defined
 queued out
 Sending play midi control
 MIDI CTRL OUT defined
 queued out
 Sending play midi control
 Sending midi-control-event queue off - libseq64/src/perform.cpp: 5553
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play midi control
 Sending play m
   And there it stops for quite some time..

   As an example, in the file libseq64/src/perform.cpp on row 5553 it looks
   like this:

 #ifdef SEQ64_MIDI_CTRL_OUT
     if (status | c_status_queue)
         printf("Sending midi-control-event queue off");
         m_midi_ctrl_out->send_event(midi_control_out::action_queue_off);

   In libseq64/src/sequence.cpp in sequence::toggle_queued ():

 #ifdef SEQ64_MIDI_CTRL_OUT
     printf("MIDI CTRL OUT defined");
     if (m_queued)
     {
         printf("queued out");
         m_parent->get_midi_control_out()->send_seq_event(number(), midi_control_out
::seq_action_queue, 1);

   Nothing is lit on the launchpad when the burst comes.


Date: Sat, 08 Jun 2019 01:44:50 -0700
From: mathiasfriman <notifications@github.com>
To: ahlstromcj/sequencer64 <sequencer64@noreply.github.com>
Cc: "C. Ahlstrom" <ahlstromcj@gmail.com>, Mention <mention@noreply.github.com>
Subject: Re: [ahlstromcj/sequencer64] midi control out (#58)

[-- Autoview using elinks -dump '/tmp/mutt.html' --]
   Great news Chris! Sorry for the late reply, but I'm in Sweden, GMT+2 so I
   have saturday morning now...

   Igors fork is a couple of changes behind master so that's a bit of a
   nuisance when switching between them, since the rc-files are not 100%
   backwards compatible and tend to overwrite each other.. :)

   I've attached my rc below. Here's what happens when I start seq64 with it
   (using ALSA midi this time to see if it made a difference. It didn't.):

 Reading rc configuration /home/mathias/.config/sequencer64/sequencer64.rc]
 [set_seq_event] 0 0
 [set_seq_event] 0 1
 [set_seq_event] 0 2
 [set_seq_event] 1 2
 [set_seq_event] 2 2
 [set_seq_event] 3 2
 [set_seq_event] 4 2
 [set_seq_event] 5 2
 [set_seq_event] 6 2
 [set_seq_event] 7 2
 [set_seq_event] 8 2
 [set_seq_event] 9 2
 [set_seq_event] 10 2
 [set_seq_event] 11 2
 [set_seq_event] 12 2
 [set_seq_event] 13 2
 [set_seq_event] 14 2
 [set_seq_event] 15 2
 [set_seq_event] 16 2
 [set_seq_event] 17 2
 [set_seq_event] 18 2
 [set_seq_event] 19 2
 [set_seq_event] 20 2
 [set_seq_event] 21 2
 [set_seq_event] 22 2
 [set_seq_event] 23 2
 [set_seq_event] 24 2
 [set_seq_event] 25 2
 [set_seq_event] 26 2
 [set_seq_event] 27 2
 [set_seq_event] 28 2
 [set_seq_event] 29 2
 [set_seq_event] 30 2
 [set_seq_event] 31 2
 filter-by-channel off
 [Reading user configuration /home/mathias/.config/sequencer64/sequencer64.usr]
 [JACK server already started]
 [JACK client:uuid is seq64_transport:24]
 [JACK sync slave]
 15 rtmidi ports created:
 Input ports (6):
   [0] 0:1 system:announce (system)
   [1] 14:0 Midi Through:Midi Through Port-0
   [2] 20:0 Launchpad Pro:Launchpad Pro MIDI 1
   [3] 20:1 Launchpad Pro:Launchpad Pro MIDI 2
   [4] 20:2 Launchpad Pro:Launchpad Pro MIDI 3
   [5] 133:0 KMidimon:KMidimon
 Output ports (9):
   [0] 14:0 Midi Through:Midi Through Port-0
   [1] 20:0 Launchpad Pro:Launchpad Pro MIDI 1
   [2] 20:1 Launchpad Pro:Launchpad Pro MIDI 2
   [3] 20:2 Launchpad Pro:Launchpad Pro MIDI 3
   [4] 128:0 TiMidity:TiMidity port 0
   [5] 128:1 TiMidity:TiMidity port 1
   [6] 128:2 TiMidity:TiMidity port 2
   [7] 128:3 TiMidity:TiMidity port 3
   [8] 133:0 KMidimon:KMidimon

 [JACK sync enabled]
 [JACK sync still enabled]
 [JACK sync still enabled]

   Maybe that's indended, but I can't see an output midi control out port
   that I can connect the LaunchPad Pro to. Is seq64 suppose to handle this
   internally?

   [1]sequencer64.rc.txt

-------------------------------------------------------

Hi,
I confirm that there is a problem with inactive entries not being saved and thus
being reset to 0. It has been some time that I worked on this, and I'm really
happy that there is somebody out there ready to give it a try with a real piece
of hardware. I will try and fix this as soon as I can spare some time. It is
quite possible that I didn't implement the channel, since I only use channel 1 in
my hardware. As far as I remember, 15 is the number of the (ALSA/Jack) output and
does not refer to the MIDI channel.

------------

I'm starting seq64 with the -j option to connect it to JACK transport and use
JACK midi, not ALSA.

If in Sequencer64 I open a sequence and select MIDI Output Bus "[0] 0:0
seq64:system midi_playback_1" and MIDI channel 1, 2 or 3 and connect that
bus/port in Qjackctl to the writable/input port "system: midi_playback_2" I can
light up the LaunchPad Pro buttons by playing/sending MIDI notes to it.

However, I can't get anything to light up using the Launchpad Pro triggering
patterns. They queue up and start playing, but not a single indication on the
LPPro.

Do I have to connect some ports in JACK to get it to work, or how do I go about
it?

-------------------------------------------------------

From: mathiasfriman <notifications@github.com>
To: ahlstromcj/sequencer64 <sequencer64@noreply.github.com>
Cc: "C. Ahlstrom" <ahlstromcj@gmail.com>, Mention <mention@noreply.github.com>
Subject: Re: [ahlstromcj/sequencer64] midi control out (#58)

[-- Autoview using elinks -dump '/tmp/mutt.html' --]
   I've used the last commit [1]de91c4e and the midi channel output works! I
   can now arm, mute and queue sequences like a boss. When I queue a non
   playing track, the pad flashes yellow, and then turns pulsating green when
   playing. If I mute a playing sequence with queueing enabled, the pad pulse
   green and occasionally flashes yellow, until it is muted. Instant
   feedback.

   That is so awesomely cool I can hardly keep myself from jumping up and
   down :)

   My midi-control-out section looks a lot like this. 16 is Green, 0 is Off,
   12 is yellow.

   arm, mute, queue

 0 [1 2 144 81 16] [1 0 144 81 0] [1 1 144 81 12] [0 0 0 0 0]
 1 [1 2 144 71 16] [1 0 144 71 0] [1 1 144 71 12] [0 0 0 0 0]

   Started with

 ./seq64 -j -t --option sets=8x8

   and tested the whole 64 grid. I have some weirdness with the mute groups,
   but the controls work flawlessly. Good work [2]@ahlstromcj and
   [3]@igorangst :)

   I find that on a grid of 8x8, one needs to check the computer screen for
   which pads to press since they are all unlit when not being played,
   regardless if they contain a sequence or not.

   For displaying sequences with some MIDI data in them to work on the
   Launchpad Pro, sequencer64 needs to send a NoteOn (144) to MIDI channel 1
   for the corresponding pad with a color value != 0

      Color       Midi-command
   Red          [1 0 144 XX 72]
   Green        [1 0 144 XX 76]
   Yellow       [1 0 144 XX 113]
   Blue         [1 0 144 XX 79]
   Magenta      [1 0 144 XX 53]
   White        [1 0 144 XX 3]
   Dark red     [1 0 144 XX 120]
   Dark Green   [1 0 144 XX 18]
   Dark Yellow  [1 0 144 XX 124]
   Dark Blue    [1 0 144 XX 46]
   Dark Magenta [1 0 144 XX 54]
   Dark Cyan    [1 0 144 XX 77]
   Orange       [1 0 144 XX 96]
   Dark Orange  [1 0 144 XX 9]
   OFF          [1 0 144 XX 0]

   If one would to this for each sequence when a new midi file is loaded or a
   sequence is created in the GUI, it would definitely be enough for my
   purposes at least. I would be more than happy with a monochrome
   visualization too :)

   The "mute" command in [midi-control-out] in the .rc file would also need
   to be replaced with the above command, since it can only send one color
   value (= velocity). Instead of just sending [1 0 144 XX 0] for each pad,
   it would have to take the color value of the sequence i Sequencer64 into
   account when sending the mute.

   But that's for another day. For now, I just want to say how grateful I am
   that you guys put so much effort into this wonderful piece of software! :)


