Godtone (talk | contribs)
m My Python 3 code: fix var name
Godtone (talk | contribs)
Installation issues/troubleshooting strategies/recommendations:: add details about manual MIDI input and output routing, and add details about how to fix windows fussiness EG reinstallation and restarting
Line 1,544: Line 1,544:
=== Installation issues/troubleshooting strategies/recommendations: ===
=== Installation issues/troubleshooting strategies/recommendations: ===
The most potentially difficult part is that depending on what OS you are using, how you have Python installed, what version, etc. there can be complications so that running <code>pip install rtmidi</code> in a terminal does not work. I list potential issues below, so please read carefully for something applicable to your case if it isn't going smoothly.
The most potentially difficult part is that depending on what OS you are using, how you have Python installed, what version, etc. there can be complications so that running <code>pip install rtmidi</code> in a terminal does not work. I list potential issues below, so please read carefully for something applicable to your case if it isn't going smoothly.
Todo: Explain how to put it into programmer mode in the case of Launchpad X and Launchpad Pro MK3.


0. Technically not an issue with rtmidi, but an easy one to solve: you forgot to update the firmware of your launchpad to be up-to-date via the official site: https://components.novationmusic.com/
0. Technically not an issue with rtmidi, but an easy one to solve: you forgot to update the firmware of your launchpad to be up-to-date via the official site: https://components.novationmusic.com/
Line 1,557: Line 1,559:
4.1. I haven't seen this issue, but possibly if <code>pip install --only-binary :all: rtmidi</code> seems to work but then brings an error when trying to use the code, try <code>pip install --only-binary :all: python-rtmidi</code> in case it helps.
4.1. I haven't seen this issue, but possibly if <code>pip install --only-binary :all: rtmidi</code> seems to work but then brings an error when trying to use the code, try <code>pip install --only-binary :all: python-rtmidi</code> in case it helps.


5. If you are on Windows, make sure you have [https://www.tobias-erichsen.de/software/loopmidi.html loopMIDI] installed and running with the default port name! (The default name should work; the code searches for a name starting with "loop".)
5. If you are on Windows, make sure you have [https://www.tobias-erichsen.de/software/loopmidi.html loopMIDI] installed and running with the default port name! (The default name should work; the code searches for the first name starting with "loop".)
 
6. '''If after all these remedies it doesn't work,''' then it's likely because the attempt at autoselecting the name of the MIDI input and MIDI output failed. To fix this:
 
6.1. First check that the Launchpad (after being set into programmer mode) is responsive by using it as a MIDI input on [[Scale Workshop]] and checking if one of the Launchpad-related options makes Scale Workshop clearly press/release notes based on what you are pressing/releasing (so not as a mess of noise data, but as obviously directly responding to you touching the Launchpad). If this doesn't work (no [[#Success indicators]]), see (step 0.) and try restarting your computer (which is much more likely to be a relevant fix if you are using Windows).
 
6.2. Look at the output of running <code>iso()</code>; specifically, it'll tell you <code>midi outputs detected:</code> followed by a list of the ''text strings'' that correspond to valid MIDI outputs detected (here meaning valid devices/targets which the code can ''output''/''send'' MIDI data to); so you want to find the one that corresponds to telling the Launchpad how to light up, EG {{nowrap| <code>iso(midi_out_col{{=}}'MIDIOUT2 (LPX MIDI) 2')</code> }} if you saw {{nowrap| <code>MIDIOUT2 (LPX MIDI) 2</code> }} in the list.  If this is the only fix that was needed, you should see all [[#Success indicators]].
 
6.3. '''If this did not fix it,''' you should get a new error with new information to help you; you should see <code>midi_inputs_detected:</code> followed by a list of the ''text strings'' that correspond to valid MIDI inputs (here meaning valid devices/targets that the code can ''input''/''read'' MIDI data from); so you want to find the one that corresponds to receiving the data about what pads and buttons are pressed on the Launchpad, EG {{nowrap| <code>iso(midi_out_col{{=}}'MIDIOUT2 (LPX MIDI) 2',midi_input{{=}}'MIDIIN2 (LPX MIDI) 1')</code> }} if you saw {{nowrap| <code>MIDIIN2 (LPX MIDI) 1</code> }} in the list, where note we need to keep the {{nowrap| <code>midi_out_col=...</code> }} part so that we don't go back to failing at the first error. Again, if this was the last fix that was needed, you should see all [[#Success indicators]]. If you ''still'' can't get it working, see the final remedies below:
 
7. '''Final remedies''' (mainly for Windows being janky):


'''Mix and match these solutions as you find them potentially relevant to your situation, and hopefully you should be able to get it working.'''
7.1. Try uninstalling and reinstalling <code>rtmidi</code> and <code>python-rtmidi</code> with <code>pip</code> (or if on your system that corresponds to Python 2 rather than Python 3, then with <code>pip3</code> instead):
<pre>
pip uninstall python-rtmidi
pip uninstall mido
pip install mido
pip install python-rtmidi
</pre>
 
7.2. Restart the system (this is especially likely to fix things if you use Windows). (Possibly followed by uninstalling and reinstalling if that didn't fix it or fix something at least.)
 
7.3. Try installing (or if you did that, uninstalling and reinstalling) <code>rtmidi</code> in case it helps (note the distinctness from <code>python-rtmidi</code>). I vaguely recall this being a valid installation target in some cases.
 
'''Mix and match these solutions as you find them potentially relevant to your situation, and hopefully you should be able to get it working.''' Also, remember, the order of doing these can matter; for example, if the installation is subtly bugged for whatever incomprehensible reason, then that'll invalidate all the other steps you took so you'll have to do them again with a non-bugged installation.


Feel free to send me a friend request to ask me for help on Discord (<code>@osmiumic</code>).
Feel free to send me a friend request to ask me for help on Discord (<code>@osmiumic</code>).
==== Success indicators ====
If your fixes worked, then assuming you didn't specify a colouring so that you didn't specify anything other than running either <code>iso()</code>, <code>iso(midi_out_col='...')</code> or <code>iso(midi_out_col='...',midi_input='...')</code>, the launchpad should turn fully cyan. Then, assuming the call to <code>iso(...)</code> is currently running in your terminal/console, you should be able to see MIDI data being printed to the terminal/console whenever you press and release a pad or button on your Launchpad. As a result, and assuming that if on Windows you set up loopMIDI correctly and that it's running, you should be able to select the appropriate instance of RtMidi or loopMIDI as a MIDI input in Scale Workshop and play whatever scale you have loaded via the Launchpad. ''Remember to allow the website MIDI permissions first before looking at its list of MIDI inputs, as there can be a small (few seconds) latency for it to update the list of detected MIDI inputs, and that list may not update unless you close the browser and open it again to hard-refresh the page.''


=== Isomorphic keyboard code for launchpads with programmer mode ===
=== Isomorphic keyboard code for launchpads with programmer mode ===