1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Mute/bypass controller

Discussion in 'Scripting Workshop' started by albertas123, Mar 31, 2014.

  1. albertas123

    albertas123 New Member

    Messages:
    16
    Hi!

    I've read a lot of different posts about scripting the mute/bypass function and I am very confused. One say it is possible, other say it is not...
    Since I am new to scripting I want to be sure if it is even worth trying...

    So what I need to do is simple. I have 10 different instruments loaded, all on the same midi channel. Let say they are all muted at the beginning. Now I want them to work as stomboxes. So if I press a button on my foot midi controller I will unmute the specific instrument. If I press another one - I will unmute other instruments. 10 instrument - 10 foot controller buttons. Thanks to this I can mix different instruments in my live performance. Now I only can do this with a mouse. I tried to do this with this (http://nilsliberg.se/ksp/scripts/scripts.html#midifilter) but with no success... so is it even possible? Thanks!
     
  2. albertas123

    albertas123 New Member

    Messages:
    16
    Anyone? I've been struggling with this for 2 months now...
     
  3. Big Bob

    Big Bob Forum Member

    Messages:
    606
    I'm not familiar with stomp boxes. What kind of MIDI data does it generate when you stomp on a button? Be as specific as you can.

    Also, is it important whether or not the instruments are actually Muted (bypassed), or would setting their Output volume level to -inf be just as good? Whether or not what you are trying to do is possible may depend on how literally what you are asking for has to be executed.

    Rejoice,

    Bob
     
  4. albertas123

    albertas123 New Member

    Messages:
    16
    Hey! Thanks for the answer. So the stombox works like this:

    1) If you want to enable the instrument, you press the button on your midi controller. Then it sends for example CC#101 with value of 127 (7F). The instrument is ON.
    2) If you want to disable the instrument, you press the same button again. Then it sends CC#101 with value of 00. The instrument is OFF.

    And it is very important. OFF menas that it does not generate any midi data. So the volume of -inf wouldn't do the job. The whole instrument must be disabled.
     
  5. Big Bob

    Big Bob Forum Member

    Messages:
    606
    What it are you referring to when you say that it does not generate? Instruments don't generate MIDI data (or are you referring to the stomp box or what). Or, do you mean the instrument must not respond to any midi data?

    There is no scripted control of the instrument Mute/Solo buttons so if this is a requirement, you are probably out of luck.

    However, the way you described how you want to use it, what difference does it make if an instrument responds to MIDI data or not if you can't hear it?

    You also say that you tried using Nils' MIDI Filter script but it was unsuccessful. Nils' script works by ingnoring MIDI notes in the NCB unless the selected filter condition is present. Why wouldn't this sort of thing work for your application?

    Until you have explained exactly what you need functionally, it will be difficult to say whether it can be done with scripting. As I said above, if your requirement is to have the script literally click the Mute button, it's not doable. On the other hand, if you just want to silence an instrument, there are numerous ways of doing it.

    Rejoice,

    Bob
     
    Last edited: May 1, 2014
  6. albertas123

    albertas123 New Member

    Messages:
    16
    Yes, I didn't make myself clear - I want the instrument not to respond to any midi data. I need to do it because:

    I use Kontakt in live situations. So I have multiple instruments loaded there and I need those instruments on the same midi channel, because I trigger them with my midi guitar which is always on the same midi channel. Now if I will be muting the instruments only by moving the volume knob, the data will still affect the CPU and I start to hear pops and clicks (there are 10 instruments playing simultanously so it is not very weird). So now you know why I need to disable the instrument so it won't respond to any midi data.

    I used Nils Midi Filter but unfortunately my midi guitar somehow affects the script while playing. Notes that I play are triggering the script ACTIVE buttons, although I do not touch my midi foot controller which is assigned to the ACTIVE buttons. I have no idea why it is happening... I read the instructions on how to control the script and I don't see how any midi notes may affect it, since I only operate on CC messages...
     
  7. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    If your instruments are all on the same MIDI channel, why not use the Instrument Banks instead? Then you switch between the instruments by sending program change messages...

    If need be, you can use the Transformer multiscript to change CC events to program change events.

    [​IMG]
     
    • Like Like x 1
  8. albertas123

    albertas123 New Member

    Messages:
    16
    Instrument Banks won't work as I need. Stompbox mode works in a way that I can mix the instruments and play for example, 3 simultanously. Just like you combine effects playing guitar (delay, reverb, crunch itp.). So in Instrument Bank I would just switch between them.
     
  9. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Hm... in that case, how about having this small script in each instrument you have on the same MIDI channel:

    Code:
    on note
        if (%CC[100] > 63)
            ignore_event($EVENT_ID)
        end if
    end on
    Then for each consecutive instrument increase the number for %CC[x]. And then adjust your stompbox controller so that each button sends a different CC, starting from CC 100. Or just use whatever CCs you need in whatever order you want.

    And definitely make sure that this script is in the FIRST script slot.
     
  10. Big Bob

    Big Bob Forum Member

    Messages:
    606
    Well the Instrument Mute button doesn't actually shut down MIDI activity, it makes it so the instrument doesn't respond to it.

    I presume you have tried what you want to do by simply using your mouse to Mute the instruments you want to silence and that this works properly for you? ie You don't get any pops and clicks, etc?

    If so, and you are willing to try a little experiment we might be able to settle this issue for you.

    What I have in mind is this. I'm attaching a very simple script that you can load in script slot 1 for each of your 10 instruments. This script has only a single button(labeled Mute) that will appear on each instrument's control panel. When all these buttons are off, the instruments should all play normally. However, whenever you turn on one or more of these scripted Mute buttons, the corresponding instruments should become silent. I'm doing this by blocking MIDI notes and CC messages from being processed by the instruments.

    Experiment with this and tell me if you get pops and clicks or if you get comparable performance to what you got using Kontakt's main instrument Mute buttons. Keep in mind that the panel button is only temporary and for purposes of this experiment. If this works functionally for your situation, it will be easy to arrange it so that you can control these scripts from your Stomp box without the need to access the script's control panel.

    Rejoice,

    Bob

    BTW Is your name Albertas or is that some madeup thing?

    EDIT: Ah, I see Mario has slipped in here while I was typing the above. Mario is suggesting something very similar to what the attached script does in that it blocks note messages in the NCB. The script I attached also blocks CC messages but that may be overkill.
     

    Attached Files:

    Last edited: May 1, 2014
  11. albertas123

    albertas123 New Member

    Messages:
    16
    Thanks for the scripts! I used EvilDragon script, because I can directly use CC messages from my foot controller. And it works great when I use it directly in Kontakt loaded on a track in Ableton Live! Although I have this one situation where it is not...

    I use a midi controller on my guitar called Fishman Triple Play. If you are not faimilar it is a device that makes the guitar works as a midi controller. This device has its own software where you load your VST's (http://www.sweetwater.com/images/closeup/750-TriplePlayPU_detail4.jpg). This soft appears in VST folder in my DAW. So what I have to do is load this soft on a track, then inside this soft I load a Kontakt and I can play. Unfortunately the script doesn't work like it suppose to. It looks like it treats CC messages like NOTE messages. For example:

    Code:
    on note
    if (%CC[30] > 63)
    ignore_event($EVENT_ID)
    end if
    end on
    
    With this code loaded I can play only half of my strings. The other strings are muted. If I change the value from 63 to 127 than all strings play, but If I change it to 1, than everything is muted. And of course my foot controller doesn't affect the instrument at all...
     
    Last edited: May 2, 2014
  12. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    That's bizarre... Could it be that it sends each string on a different MIDI channel?

    Try and monitor the MIDI data sent from Triple Play, then act accordingly.
     
  13. albertas123

    albertas123 New Member

    Messages:
    16
    That was a good guess. I've checked it and besides note messages it also sends CC#30, so the one I happen to use on the foot controller. Still I don't know why it wasn't a problem when I use it directly on Kontakt on a track. Anyway I will just reserve the CC#30 to the Triple Play and I am good to go. But I also noticed that in this particular case it receives all the CC's, regardless to the midi channel. How can I modify the script so it would accept the CC's only on a specific midi channel? Thx again!
     
  14. albertas123

    albertas123 New Member

    Messages:
    16
    I am not familiar with KSP scripting, but I've read a bit and this is how I try to accept the CC messages only on a specific midi channel:

    Code:
    on note
    if (%CC[36] > 63 and MIDI_CHANNEL = 3)
    ignore_event($EVENT_ID)
    end if
    end on
    
    It has no erros but it doesn't work. What may be the problem?
     
  15. Big Bob

    Big Bob Forum Member

    Messages:
    606
    MIDI_CHANNEL doesn't work in an instrument script, only in a multiscript. If you have Kontakt's MIDI channel set to something other than omni, there should be no MIDI messages getting 'inside' Kontakt from other MIDI channels. So I guess I would ask you how you have determined that such is the case?

    I think maybe you should wait for Mario (ED) to get back with you on this but I think he's getting married today so you may have a bit of a wait.;) But, be patient and I'm sure he'll be back to try to help you.

    If you want me to help you with this I would have to back you up a few posts because you made a few statements that aren't clear to me. But, since Mario jumped in here before I had a chance to finish what I started, I thought I'd just bow out (too many cooks in the kitchen and all that) :)

    Rejoice,

    Bob
     
  16. albertas123

    albertas123 New Member

    Messages:
    16
    How I send midi messages to Kontakt is this:

    1) I add a midi track -> I set up my guitar controller as an input -> I put Kontakt on a track
    2) I add second midi track -> I set up my midi foot pedal as an input -> I set up Kontakt from the first track as an Output

    Thanks to that, all the midi generated by my foot pedal goes directly to Kontakt.

    So now I want to "say" to the instrument: "Accept only CC messages on channel number X"
     
  17. Big Bob

    Big Bob Forum Member

    Messages:
    606
    Let me re-emphasize what I just asked in my prior post.

    If you have Kontakt's MIDI channel set to something other than omni, there should be no MIDI messages getting 'inside' Kontakt from other MIDI channels. So I guess I would ask you how you have determined that such is the case?

    Kontakt itself should reject any midi messages that are tagged with any midi channel other than what you set each instrument to receive on. So, unless you are using OMNI for a receiving channel, what makes you think that midi messages other than those on your set receiving channel are getting into Kontakt?

    I think perhaps my style of analyzing problems, one step at a time, doesn't click with you too well. :) Somewhere along the line, you decided that MIDI messages from other channels are getting into Kontakt but I want to know how you came to that conclusion. I think you should back up to where you made that assertion and further verify that that is indeed the case before trying to filter out unwanted data (which may not even exist).

    You also seem to have somewhat ignored Mario's thought about each guitar string sending on a different midi channel. Yet, isn't that a very common way for guitar controllers to work? Why did you at that point jump to the conclusion that the whole problem was due to unexpected CC30 messages and then that other midi channel data is somehow getting into Kontakt?

    I know that you are impatient to get to the solution of your problem but my style of problem solving is to take one logical step at a time and not just fire a shotgun with a broad beam and hope I hit something.:)

    Rejoice,

    Bob
     
  18. albertas123

    albertas123 New Member

    Messages:
    16
    Yeah, you are right it is a bit confusing :) I think it would be better to wait for Mario to step in.

    But I have other question in mind - is it possible to use this small script (yours or this from Mario) as a MultiScript? Because some of the instruments doesn't have any more empty slots, and those which are available are protected with password so I am unable to mute them...
     
  19. Big Bob

    Big Bob Forum Member

    Messages:
    606
    No, there is no note callback in multiscripts. Multiscripts operate strictly at the MIDI level and feed all Kontakt instruments in the rack. However, you might be able to write a MS that could do something similar.

    Password protected scripts can be moved if there are some empty slots. You can shift all the scripts to the right to free slot 1. Use save/load preset to move them. For example, if you have scripts in slots 1,2, and 3, do the following:
    1. Save script 3 as a preset named something like Script3.
    2. Select script slot 2 and save as a preset named something like Script 2.
    3. Select script slot 1 and save as a preset named something like Script 1.
    4. Select script slot 4 and load the preset you named Script 3.
    5. Select script slot 3 and load the preset you named Script 2.
    6. Select script slot 2 and load the preset you named Script 1.
    7. Finally, select script slot 1 and load the Empty preset and then resave the instrument under some new name.
    This new instrument now has an empty slot 1.

    If all script slots are in use and password protected, then you have a problem (unless you want to hack the password or try your hand at writing a multiscript).

    OK, I shall quietly fade out then :)

    Rejoice,

    Bob
     
  20. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    MIDI_CHANNEL does work in instrument script, but it has to be $MIDI_CHANNEL!