Git Product home page Git Product logo

Comments (12)

widdowson avatar widdowson commented on May 25, 2024 2

You might also consider having the config prompt ask someone to press and release a button. Then, have them do it again.
That will either give you four events (If I'm understanding this issue correctly) 1) on 127 2) off 127 3) on 0 4) off 0, or it will give you potentially enough data from which to autodetect what kind of button/toggle something is.

That's a little more "automagical" of a solution; your choice of course on whether you want to be intuitive and sensing, or explicit, in your UX.

from miditoobs.

noamsmadja avatar noamsmadja commented on May 25, 2024 1

worked.

changed to what lebaston100 suggested and set the button a setMute. then headed into the config file du[licated the entry and changed to mute on 127 and unmute on 0.

from miditoobs.

lebaston100 avatar lebaston100 commented on May 25, 2024

Currently that is intended behaviour. But i want to change that in the future. It's the same base problem as this one: #24

If you want to use the toggle function in the meantime you have to program your controller to send a value of 127 every time the button is pressed.

from miditoobs.

cpyarger avatar cpyarger commented on May 25, 2024

from miditoobs.

LukeBoland avatar LukeBoland commented on May 25, 2024

I changed

    def handle_midi_input(self, message, deviceID, deviceName):
        self.log.debug("Received %s %s %s %s %s", str(message), "from device", deviceID, "/", deviceName)

        if message.type == "note_on":
            return self.handle_midi_button(deviceID, message.channel, message.type, message.note)

to

    def handle_midi_input(self, message, deviceID, deviceName):
        self.log.debug("Received %s %s %s %s %s", str(message), "from device", deviceID, "/", deviceName)

        if message.type == "note_on" or message.type == "note_off":
            return self.handle_midi_button(deviceID, message.channel, message.type, message.note)

and then manually added a "note_off" entry in the config file to get this behavior.

That seemed to be the only change needed in main.py. I may look at setup.py next to make button-mapping easier...

from miditoobs.

lebaston100 avatar lebaston100 commented on May 25, 2024

Implementation is the easy part here, the thing i'm worried about is UX. Because for the controllers that use "note_on" and "note_off" you get a "double" even which could confuse users.

from miditoobs.

LukeBoland avatar LukeBoland commented on May 25, 2024

Well, that's what's working for me, and at least there's enough information here for others who need that functionality to implement it, and get running.

Might need to add a question like the "is this a fader or a button" for buttons that asks whether it's a momentary or toggle button, and if toggle, what to set the on and off to separately. Or ignore the off.

Two very similar edits got setup.py working with mapping note_off.

from miditoobs.

lebaston100 avatar lebaston100 commented on May 25, 2024

yea, the information is now here if someone needs it.
I'll think about how to aproach that because it's the same for the value in control_change messages.

from miditoobs.

noamsmadja avatar noamsmadja commented on May 25, 2024

I changed

    def handle_midi_input(self, message, deviceID, deviceName):
        self.log.debug("Received %s %s %s %s %s", str(message), "from device", deviceID, "/", deviceName)

        if message.type == "note_on":
            return self.handle_midi_button(deviceID, message.channel, message.type, message.note)

to

    def handle_midi_input(self, message, deviceID, deviceName):
        self.log.debug("Received %s %s %s %s %s", str(message), "from device", deviceID, "/", deviceName)

        if message.type == "note_on" or message.type == "note_off":
            return self.handle_midi_button(deviceID, message.channel, message.type, message.note)

and then manually added a "note_off" entry in the config file to get this behavior.

That seemed to be the only change needed in main.py. I may look at setup.py next to make button-mapping easier...

I made the change you suggested but i couldn't figure about where to add the "note_off" in the config file.
"5": { "msg_type": "control_change", "msgNoC": 112, "input_type": "button", "action": "{\"request-type\": \"ToggleMute\", \"message-id\" : \"1\", \"source\": \"elgato\"}", "deviceID": 1, "bidirectional": false }

this is the code that was added for the toggleMute button i chose. but i don't see a "note_on" so it is not obvious for me how to duplicate the entry with a note off

from miditoobs.

lebaston100 avatar lebaston100 commented on May 25, 2024

Your controller seems to send control_change messages, not note_on or note_off.
If you use the most recent setup.py from github there will also be a value named msgVoV that is the midi control change value. You would have to add a check to the main.py to check for that value, that's something i will do in the future.
Or you can try to reprogramm your controller to send note_on and note_off, these would go into the "msg_type" field.

from miditoobs.

noamsmadja avatar noamsmadja commented on May 25, 2024

updated my setup.py with the one on github.
{also, my coding skill is very basic but thought i would try to help 👯 }

i see now that my controller sends control_change and i can't change that in my controller. with that said i headed to main.py to try and figure where to start:

I figured that since handle_midi_input receives message.type: "control_change" the handle_midi_fader function is handling my input. I was thinking that by allowing the function to add "or value == 0" in the if statement, it will also fire the toggle but it didn't do the trick.
if input_type == "button": if (value == 127 or value == 0) and not self.send_action(result): continue

since my toggle sends either 0 or 127 i thought the problem is that nothing fires when it sends 0 but i guess i didnt understand that correctly :D

I will wait for that feature to be added since it seems I can't figure how to implement it myself :)

from miditoobs.

lebaston100 avatar lebaston100 commented on May 25, 2024

Try something in that direction instead. I've not tested in but in theory it should check if the msgVoV matches the current input value so it doesn't trigger the same action twice.
if input_type == "button": if value == result["msgVoV"] and not self.send_action(result): continue

from miditoobs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.