-
zigmhount
@oid Thanks for your answer.
I followed your advice and spent quite some time learning a bit how Csound works - a bit overwhelming indeed.Then I realized that I'd love to be able to play this synth when connecting my MIDI controller to my smartphone, so I tried to run a slightly modified version of the CSD file on Csound for Android, but I didn't manage to get anything but crashes. Then I tried with csound6~ as a Pd external on PdDroidParty and MobMuPlat, but externals of course don't work on these. Then I considered running Linux on old smartphones and tablets, but I couldn't properly access the soundcard without root access. Then I fell back and looked for handpan soundfonts, but I could find only 1 or 2 (for free) in a single scale.
Then I finally came back to Pure Data and realized that my best chance was to convert this Csound patch into Pd vanilla and run it on MobMuPlat.
Which I've done! yay!
I've had quite a few challenges and the sound isn't perfect yet, but it works, and I'm also adjusting a few things to my preferences. I'm also including the r_cycle functionalities to tune the Launchpad and it's a lot of fun! I might be able to spend my Sunday sitting in the grass and playing handpan on my MIDI controller connected to my smartphone
I will push it to Github eventually, right now it's still a little too messy for sharing, but if anyone passing by is interested, just let me know!
Cheers! -
zigmhount
Hi everyone,
I've been playing a bit with a Csound handpan synth from here and I've used the r_cycle external to make a handpan with my Launchpad
(the patch is not very complicated so I didn't try to make it neat, sorry!).
The csound patch maps specific MIDI notes to the synth according to a scale, and the Pd patch lights up the pads so each colored group of pads sends the corresponding MIDI note to CSound:
I'm super happy with it, but the next step is to make it configurable: the csound patch contains many different scales defined with
giNotes = ftgen(0, 0, -<number of notes>, -2, <list of note numbers> )
:; B Kurd ;giNotes = ftgen(0, 0, -10, -2, 47, 54, 55, 57, 59, 61, 62, 64, 66, 69) ; B Golden Arcadia giNotes = ftgen(0, 0, -9, -2, 47, 51, 54, 58, 59, 61, 65, 66, 68)
So instead of editing the CSD file and changing the color mapping of the launchpad when I want to change scale, I would like to send a list/array/table of note numbers from Pd to [csound6~] via a message (and adjust the MIDI notes sent by the launchpad at the same time).
I know basically nothing about Csound, so I've read up and found examples usingchnget
/chnset
orinvalue
which seem relatively straightforward to change the value of a single int variable. However I don't really have any idea on how to pass the list/array of scale notes using chnset or invalue, or if there is a better way to do it.Maybe someone around here has an idea? Thanks for reading so far in any case
-
zigmhount
@whale-av Hmm thanks, this sounds like I might actually be better off with running parallel pd processes right from a shell script and communicating via netsend (this laptop has only 2 cores, so audio processing is all running in the same patch anyway, and controls+GUI in the other), rather than trying hard to get it working with [pd~] and possibly hit some more undocumented limitations later on...
I guess I'll try a bit more, and let's see where I end up -
zigmhount
I think I finally figured it out!
Well, not sure it solves all my problems, but at least here is a limitation of pd~: midi inputs and outputs (obviously)! There were a few of those in one of the libraries called by mybigpatch.pd (r_cycle).So here is my way around it, in case it might help others:
- In the main patch, capture notein and send
[notein $1 $2 $3(
to[pd~]
:
- in the pd~ subprocess, capture the incoming in an abstraction ./myfolder/notein.pd:
and replace all instances of[notein]
with[./myfolder/notein]
- similarly for noteout, an abstraction ./myfolder/noteout.pd to use in the pd~ subprocess:
and replace all instances of [noteout] with[./myfolder/noteout]
- in the main patch, replace noteout with [r noteout]:
- and the same thing with ctlin, ctlout, bendin, bendout, midiin, midiout, etc.
And the command line magic trick (that it took me a while to figure out) in order to replace all this easily in all pd files:
$ sed -i 's+\(touchin\|polytouchin\|bendin\|notein\|ctlin\|midiin\|midiout\|noteout\|ctlout\)+'./myfolder/'&+' *.pd
, which will prepend any instance of notein & co with./myfolder/
.Improvement suggestions are of course welcome.
Cheers! - In the main patch, capture notein and send
-
zigmhount
@mtdr2012 Hey, my bug report seems to still be open: https://git.purrdata.net/jwilkes/purr-data/-/issues/672 but maybe you can help solving it over there
I've moved from Purr-data to vanilla a couple of months after that issue so I can't really help anymore, sorry ! I'm focusing less on the UI now, so whenever I need a control for a knob I just use a centered hslider instead. -
zigmhount
Hello,
I've been working for a few months on a patch that got more complicated than I had planned, and I finally decided to split it into subprocesses to avoid audio clicks when UI elements refresh. In the past I've done it with 2 separate pd processed and osc calls between both, but I'd like to try with [pd~] instead (which I've read about bit never actually used for real).
So as a first step I'm just trying to load my whole complicated patch inside a [pd~] subprocess (with DSP on in both of course) using a simple[pd~ start mybigpatch.pd( | [pd~ -ninsig 8 -noutsig 2]
It works with a simple patch in the same folder, however with the big one, the subprocess starts, loads the libraries, and immediately closes, showing only
pd~: No such file or directory
in the parent process' Pd console window.
I get no more details when adding-d 4
,-stderr
,-verbose
or even-noloadbang
(in case it's the patch initiation that failed).
My "big patch" will call many abstractions, initiate arrays, soundfilers and load text files into [text] objects so there are quite a few possibilities for not finding files - however the exact same patch starts perfectly from the same folder. Using the whole path to the patch in [pd~ ( also doesn't help.Are there any known limitations to what [pd~] can or cannot do compared to the main parent pd process?
Thanks!
-
zigmhount
Also, I'm curious about the buttons you'll choose for this!
I can't mold silicon buttons or 3d-print the enclosure myself, so I may have to go for bulky arcade buttons, not sure yet. -
zigmhount
@jaffasplaffa I recently built my first device, a USB midi footswitch with an arduino. A bit of googling led me to the awesome MIDI Control Surface library.
The main thing to be careful about IMO is to get the right board to communicate directly over USB (Micro, Leonardo, Teensy, see the documentation), otherwise (Uno, Nano) you will need a serial-MIDI converter software like hairless (with GUI) or ttymidi (command line).
For the LED lighting I took inspiration from my other commercial controllers, and set the arduino's code to light up the LEDs by sending a notein and then it off with a noteoff (if you have multiple colors or blinking mode, you can use different velocities, e.g. 36 1 1 for solid green on button 36 (channel 1), 36 2 1 for blinking green, 36 3 1 for red, etc.
You can also hardcode the LEDs status with the buttons status, but you may loose flexibility (especially when using Pd, but it may be more complicated to use a DAW if you have to set up when to light up the LEDs, not sure).Now I am looking into building another controller with faders and knobs, and there I'll indeed also need multiplexers, as I believe that the bigger Arduino I could find had ~40pins. You will probably need digital pins for the buttons and LEDs, while potentiometers need analog pins (as far as I could understand so far, but I'm also new to this!).
In any case, regardless of how you initially program the arduino (e.g. only notein/noteout to control the LEDs), you can just decide otherwise later on and reprogram it (just like you would update a commercial controller's firmware) to change the note numbers of each button, add special modes to give other functionalities to the same buttons, this kind of things.
Let me know how it goes
I'm hoping to get started on mine in 2 weeks or so.
-
zigmhount
Thank you @oid , I should have thought about that right away!
Turns out thataseqdump
doesn't show any difference (NoteOn with velocity 0 is interestingly displayed as NoteOff, but it works anyway on the 64bits machine to turn off the LED).I found one cause by chance however: If I connect Pd with the MIDI device via ALSA-MIDI, it works fine, but if I connect them via JACK-MIDI, I can't turn off the LEDs!
So when I connect PD with the controller with
aconnect 130:1 24:0
it does work fine on both laptops. Not sure whether that might be caused by a2jmidid in the end, but I guess it is solved (and indeed not related to Pd!). -
zigmhount
So, continuing my investigations, I have had no more success with [cyclone/xnoteout] and raw hex midi messages sent to [midiout]. And not better either if I start jack with
-Xraw
, and both laptops use the same version of a2jmidid.Two more details:
- laptop where it works: Jack 1.9.14, 64 bits
- laptop where it doesn't work: Jack 1.9.12, 32 bits. I could try to upgrade jack to 1.9.14 but it may have to use different repositories or potentially mess up dependencies.