Resource icon

OBS Python Midi Control 1

noisetteofaddedia submitted a new resource:

Midi Control - Control OBS with a MIDI controller

This script allows you to control OBS in studio mode with a MIDI controller
You can use yout midi to :
- trigger current transition
- select preview scene
- select transition

How to install it
- install rtmidi (https://pypi.org/project/python-rtmidi/)
- add script to obs

How to use it
- Choose you midi controller in the list
- choose if you want to use Note or Control change for each parameter
- select the parameter address to use for transition, or to select the first scene or...

Read more about this resource...
 

NeoCortex1997

New Member
noisetteofaddedia submitted a new resource:

Midi Control - Control OBS with a MIDI controller



Read more about this resource...

I want to use this Script under Linux and obs displays an error that it is unable to import rt-midi.
I already installed rt-midi inside of my user "context" and inside of the global "context" and whe i tested it in the default python interpreter it worked just fine.

This is the whole error:
Code:
Traceback (most recent call last):

File "/home/stefan/Downloads/obsMidiClient.py", line 2, in <module>

   import rtmidi

   File "/home/stefan/.local/lib/python3.6/site-packages/rtmidi/__init__.py", line 4, in <module>

    from ._rtmidi import *  # noqa

 ImportError: /home/stefan/.local/lib/python3.6/site-packages/rtmidi/_rtmidi.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError

 Error in sys.excepthook:

 Traceback (most recent call last):

   File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook

     from apport.fileutils import likely_packaged, get_recent_crashes

   File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>

    from apport.report import Report

   File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>

    import apport.fileutils

   File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>

     from apport.packaging_impl import impl as packaging

  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>

     import apt

  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>

     import apt_pkg

 ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError

Original exception was:

Traceback (most recent call last):

   File "/home/stefan/Downloads/obsMidiClient.py", line 2, in <module>

     import rtmidi

   File "/home/stefan/.local/lib/python3.6/site-packages/rtmidi/__init__.py", line 4, in <module>

     from ._rtmidi import *  # noqa

 ImportError: /home/stefan/.local/lib/python3.6/site-packages/rtmidi/_rtmidi.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError

Is this Problem Known and does a fix for it exist?
Thanks in advance:
Neo
 
In this Azure build python scripting now works, (!WARNING!) this is a developer build, stable forthcoming releases, should include this.

Attached, is a minorly edited script, shall we add this to the main repo, noisetteofaddedia?

System: MacOS 10.13.4, Python 3.7.5 (from brew)
 

Attachments

  • obsMidiClient.py.zip
    2.1 KB · Views: 83

FuriousGreenCloud

New Member
In this Azure build python scripting now works, (!WARNING!) this is a developer build, stable forthcoming releases, should include this.

Attached, is a minorly edited script, shall we add this to the main repo, noisetteofaddedia?

System: MacOS 10.13.4, Python 3.7.5 (from brew)

Attachments
 

Attachments

  • obsMidiClient.py.zip
    2.1 KB · Views: 78

scottclark

New Member
First off, thank you for this. Second, I'm a total noob, I've used only one script in OBS previously (for a countdown timer). I got rt-midi installed successfully, and this script to appear and it lets me add it into OBS Studio. That's the part where I am stuck. Instructions say "choose your controller from The List." Where do I find "The List" in OBS Studio? or is that a text file somewhere I need to edit? thank you to anyone who helps, I appreciate it!
 

scottclark

New Member
FIXED!!! did some more digging as it was needed. Got it to work and it's awesome!!! I had to use a midi out port on my DAW so that I could control both it and OBS studio. Now I am muting and running faders on my audio channels and controlling transport (in FL Studio), AND selecting scenes on OBS Studio - from the same X-Touch Mini controller. THIS IS AWESOME, THANK YOU!!!

First off, thank you for this. Second, I'm a total noob, I've used only one script in OBS previously (for a countdown timer). I got rt-midi installed successfully, and this script to appear and it lets me add it into OBS Studio. That's the part where I am stuck. Instructions say "choose your controller from The List." Where do I find "The List" in OBS Studio? or is that a text file somewhere I need to edit? thank you to anyone who helps, I appreciate it!
 

Felipe Machado

New Member
FIXED!!! did some more digging as it was needed. Got it to work and it's awesome!!! I had to use a midi out port on my DAW so that I could control both it and OBS studio. Now I am muting and running faders on my audio channels and controlling transport (in FL Studio), AND selecting scenes on OBS Studio - from the same X-Touch Mini controller. THIS IS AWESOME, THANK YOU!!!
can you explain more?
tkx
 

edocsyl

New Member
Hello. I would like to Map a Midi Fader to the "Transition Fader" in the OBS Studio mode, to live mixing two scenes together.

I have already extended the script to map a new midi value variable, but cannot access this "Transition Fader" function in obs. I did not find anything in the python documentation. Does anyone have an idea?
 

edocsyl

New Member
This is some Code i added:

Python:
....
    if midiParams[7]:
        fadeTransition(value)
...
    midiParams = ["",0,"",0,"",0, False,0];
...
    transitionFaderAddress = obs.obs_properties_add_int(props, "transitionFaderMidiAddress", "Transition Fader Midi Address", 0, 127, 1)
..
    midiParams[7] = obs.obs_data_get_int(settings, "transitionFaderMidiAddress")
..

def fadeTransition(num):
    trans = obs.obs_frontend_get_current_transition()
    print("Test")
    # Down below is the code which is not working
    obs.obs_transition_set_size(trans,num)

This is the function i would like to use:
1590402790336.png
 

moody.d

New Member
This is a great addition to OBS, and just what we need! The only issue at the moment is that the scene transitions aren't actually happening, and we aren't sure what we're doing wrong.

The script is installed, and I'm getting the setup screen as expected.
I set "Scene set midi type" to "Note On"
I set "First scene midi address" to "1".
When I trigger my note down, it shows up in the script log as:
[Script] Note 2 2
But the scene doesn't change to scene 2 like I believe it should.

What do you think I'm doing wrong? Is there a specific note intensity I'm supposed to be using?

Thanks in advance!
 

moody.d

New Member
This is a great addition to OBS, and just what we need! The only issue at the moment is that the scene transitions aren't actually happening, and we aren't sure what we're doing wrong.

The script is installed, and I'm getting the setup screen as expected.
I set "Scene set midi type" to "Note On"
I set "First scene midi address" to "1".
When I trigger my note down, it shows up in the script log as:
[Script] Note 2 2
But the scene doesn't change to scene 2 like I believe it should.

What do you think I'm doing wrong? Is there a specific note intensity I'm supposed to be using?

Thanks in advance!

So, after debugging the script for a while, I found out what the issue is. The command "obs_frontend_set_current_preview_scene" is supposed to immediately trigger a scene change when OBS is not in Studio Mode. However, it simply doesn't work on a Mac, unless you put OBS back in Studio mode. In other words, this script will only work on a Mac if OBS is in Studio Mode.

Because I don't want to use Studio Mode, the simple fix was to change the command above to "obs_frontend_set_current_scene". This triggers the scene change immediately, whether in Studio Mode or not.

Thanks again for a very useful script!
 

javierdiazm

New Member
Hi there

I have not been able to load the script, I am on ubuntu 18.04 and installed the module like this:

$ sudo pip3 install python-rtmidi

When I load the script I got this error:

[obsMidiClient.py] Traceback (most recent call last):
[obsMidiClient.py] File "/home/javier/Desktop/obsMidiClient.py", line 2, in <module>
[obsMidiClient.py] import rtmidi
[obsMidiClient.py] File "/usr/local/lib/python3.6/dist-packages/rtmidi/__init__.py", line 4, in <module>
[obsMidiClient.py] from ._rtmidi import * # noqa
[obsMidiClient.py] ImportError: /usr/local/lib/python3.6/dist-packages/rtmidi/_rtmidi.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError

but if I import the module from the terminal, it does not happen:

javier@Bullet:~/Desktop$ python3.6
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rtmidi
>>>
 

javierdiazm

New Member
I want to use this Script under Linux and obs displays an error that it is unable to import rt-midi.
I already installed rt-midi inside of my user "context" and inside of the global "context" and whe i tested it in the default python interpreter it worked just fine.

This is the whole error:
Code:
Traceback (most recent call last):

File "/home/stefan/Downloads/obsMidiClient.py", line 2, in <module>

   import rtmidi

   File "/home/stefan/.local/lib/python3.6/site-packages/rtmidi/__init__.py", line 4, in <module>

    from ._rtmidi import *  # noqa

ImportError: /home/stefan/.local/lib/python3.6/site-packages/rtmidi/_rtmidi.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError

Error in sys.excepthook:

Traceback (most recent call last):

   File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook

     from apport.fileutils import likely_packaged, get_recent_crashes

   File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>

    from apport.report import Report

   File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>

    import apport.fileutils

   File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>

     from apport.packaging_impl import impl as packaging

  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>

     import apt

  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>

     import apt_pkg

ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError

Original exception was:

Traceback (most recent call last):

   File "/home/stefan/Downloads/obsMidiClient.py", line 2, in <module>

     import rtmidi

   File "/home/stefan/.local/lib/python3.6/site-packages/rtmidi/__init__.py", line 4, in <module>

     from ._rtmidi import *  # noqa

ImportError: /home/stefan/.local/lib/python3.6/site-packages/rtmidi/_rtmidi.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError

Is this Problem Known and does a fix for it exist?
Thanks in advance:
Neo

Hi, I am running into similar problems, were you able to fix it??
 
Top