Hi, I've come across pure data as a way to change the cc value my hi hat is outputting, which being a cheap drum kit, is either 0 or 127. I want to change the 0 to be a number like 50 and then output that along with the rest of the midi data to a drum software. I have set up the virtual midi driver, but I can't for the life of me get the Pd code to work. Any help? The hi hat is cc 4. Thanks!
-
Midi cc rewriting
-
@APP_1000 Try this....... this.pd
It will receive from all channels and output to channel 1.
To change the output midi channel number add the number you want to the "add back ctrl no" message and to the "invert ctrl/vel" message.
i.e. for midi channel 6 the messages would be [$1 4 6( and [$2 $1 6(
David.
-
@whale-av Thanks for this! it does successfully rewrite the cc values but no other midi info from my electric drum kit is going into the software. Im using loopbe1 as the input for the drum software / output for pd. Very new to pd so not really sure at all what's going on, please would you be able to help me diagnose the issue? thanks
here's a screenshot of the drum software midi input, no other drums are being registered -
@APP_1000 Are all the messages from the drum kit cc messages?
I might have made a mistake though, as I have no midi equipment for testing.
David. -
@whale-av yup the only input being recieved from the loopbe1 in the drum software is the cc messages
-
@APP_1000 But what are the incoming messages from the cheap drumkit.... only cc or also note etc.?
David. -
@whale-av oh i see sorry
all midi data is being recieved from the drum kit into pd -
@APP_1000 Then you probably just need a bypass in the patch for the other midi messages..... a [notein] connected directly to a [noteout].... etc...... all except [midiin]/[midiout] and [ctlin]/[ctlout]....
David.
-
@whale-av thank you so much that seems to be doing the right thing!
i was also wondring if theres anyway to automate the patches running like on startup, or if it's possible to run the patch through python. Do you have any ideas about these? -
@APP_1000 What machine is it going to run on, and what operating system..?
David. -
@whale-av sorry, should have said - windows 10, laptop
-
@APP_1000 What do you mean by "on startup"...? Do you boot your computer every time you open it?... probably not, you probably always come back from "sleep" nowadays..?
If you do reboot then you could add a shortcut containing the necessary command to the windows Startup folder (if that still exists in widows 10)..... or run a batch file in that folder.
For Python, do you mean Python automating the patch opening?
David. -
@whale-av yeah fair enough i don't think the thing about start up would work.
Yup, for python i would want the script to open the pd file and also the exe file for the drum software. I've tried doing it through command prompt (within python and not in python) but it keeps telling me that 'pd' is not recognized as an internal or external command,
operable program or batch file, even if i try and run it from within the supposed pd source files location (which i believe is AppData/Local/Pd as i can't find anything else... but i'm probably wrong somewhere. -
@APP_1000 You can simply double-click the patch file....... which will open Pd and the patch.
In Python for windows I think......import os os.startfile(path)
"path" is probably the whole path from C: including the file name and the extention.
I don't know whether it will need forward or backward slashes...... and I don't know for python, but in windows you should enclose the whole path in double quotes if there are any spaces in the path or filename..... e.g........ "C:\Users\David\Desktop\pd forum\4way audio switch\switcher.pd"
The patch should then automatically open Pd as it would when it is double-clicked.
David. -
@whale-av Thanks David, i feel like a really wally for not getting that myself. Thanks for all the help and patience. On a final note is it possible to run patches without the UI being open (headlessly), and how? Thanks
-
@APP_1000 You will use the -nogui flag in the command line..... either in the Pd preferences - Startup if you never want the GUI..... or in a batch file that starts the patch.
A batch file would look like........."C:\Program Files (x86)\pd\bin\pd.com" -path C:\Users\David\Desktop\PDMusic\Minx\ -nogui -open Minx_Run.pd exit
Maybe possible in Python but I don't straight away know how to do that.
You could call the batch file from Python.... but as it is an executable you would need something other than os.startfile I think.
You should find an answer here...... https://stackoverflow.com/questions/5469301/run-a-bat-file-in-windows-using-python-code
David.