Jump to content

Fl studio script and midibox ng


ksir
 Share

Recommended Posts

hello, I use my controller with fl studio with which it is possible to create python scripts.

https://www.image-line.com/fl-studio-learning/fl-studio-online-manual/html/midi_scripting.htm


I have already tried with a small script which allows you to create a “learn” mode

Would it be possible to display the name of the parameter that I can retrieve with "getParamName" to display them on the screens of my midibox ng?

I think that fl studio's python scripts can be a very powerful tool combined with midibox ng. but I have no other idea of what could be interesting. If you have any suggestions

thank you



# name=ModulBox
# définir les variables

# Importer les modules nécessaires pour utiliser les fonctionnalités de FL Studio
import midi
import device
import playlist
import channels
import mixer
import patterns
import arrangement
import ui
import transport
import plugins
import general
import launchMapPages

# Définir le numéro du contrôleur MIDI que vous souhaitez utiliser pour le bouton Learn
BoutonLearn = 31

# Initialiser la variable Mode_Learn avec une valeur booléenne, Cette variable indique si le mode Learn est actif ou non
ModeLearn = False

# Fonction appelée lorsqu'un message MIDI est reçu par FL Studio
def OnMidiMsg(event): 
    # Utiliser la variable globale Mode_Learn dans la fonction OnMidiMsg
    global ModeLearn
    
    # Indiquer que l'événement n'a pas encore été traité
    event.handled = False 
    
    # Afficher des informations sur l'événement MIDI reçu
    print('MidiId: ', event.midiId, 'EventData1: ', event.data1, 'eventData2: ', event.data2,'eventMidiChan', event.midiChan, 'eventMidiPort: ', event.port) 
    
    # Si l'événement correspond à l'appui sur le bouton Learn, activer ou désactiver le mode Learn en fonction de la valeur de l'événement
    if event.data1 == BoutonLearn and event.data2 == 127:
            ModeLearn = True 
            print(ModeLearn,"Mode Learn actif.")            
    elif event.data1 == BoutonLearn and event.data2 == 0:
        ModeLearn = False 
        print(ModeLearn,"Mode Learn Inactif.")   
    
    # Si la valeur de l'événement est supérieure à 0 et que le mode Learn est actif, lier le dernier paramètre modifié au contrôleur MIDI utilisé et désactiver le mode Learn
    if event.data2 >0 and ModeLearn==True and event.data1 != BoutonLearn:	
        # Utiliser la fonction device.linkToLastTweaked() avec les arguments appropriés
        device.linkToLastTweaked(event.data1, event.midiChan+1,)
        ModeLearn = False 
        #test extinction led
        #device.midiOutMsg(176, event.midiChan, BoutonLearn, 0)
        device.midiOutMsg(176, 15, BoutonLearn, 0)
        print(ModeLearn,"Mode Learn Inactif.")
        # Indiquer que l'événement a été traité par le script en mettant la valeur de event.handled à True
        event.handled = True

    
    # Indiquer que l'événement a été traité par le script en mettant la valeur de event.handled à True
    #event.handled = True

'''
'''

 

Edited by ksir
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...