I juet our together a phatstack with a piano hat, drum hat and speakerphat and with the drum hat I am noticing it is sometimes not hitting but releasing which is resulting in no sound on that hit, as u can see in my pic.
How fast are you hitting the pad in this instance? It’s highly possible you’ve already lifted your finger and triggered a release before the Python code has had time to read the current state.
Looks like it might be necessary for the cap touch library to generate a “Hit” if it sees a “Release” without a previous hit, and vice versa.
Thanks for the response, about 2 hits in a second, not too fast I think. Here is a little vid, you can see it does a double release twice
It’s not a huge deal, I am testing it out as our students will be using it at school in our Maker Space and they might not even notice that it wont pick up sometimes. Just wondering is there any way to up the sensitivity of the pads or change how quickly python reads the current state, or are both of those set? On a side note is there any way to record a track directly onto the Pi? Love what Pimoroni creates and my students are really excited about these new tools.
There are quite a lot of calibration options for the touch IC, but not many of them are easy to tweak via the library. Could be worth me looking into that in more depth.
If you’re plugging it onto a powered-on Pi it might be worth power-cycling the Pi, since the power-on calibration of the IC might be causing suboptimal sensitivity (sometimes you can completely disable some pads by holding them while attaching the HAT to a powered-on Pi) although I can’t recall if I added forced-recalibration to fix this.
So, yes, it’s technically possible!
Recording is an interesting one, it should be easy enough to save each drum hit into a python
dict with time quantization and then play that data back.
I would do something like:
drum_sequence = [ for x in range(8)]
And in the on press/release handlers:
This would have the effect of saving the time hit for every drum channel, which you could then dump to a file and play back with a Python script.
You could also use Python MIDI to create a track and add NoteOnEvent and NoteOffEvent events for each drum hit. See: https://github.com/vishnubob/python-midi#Building_a_MIDI_File_from_scratch
But you would need to write a Python script to play that back anyway, or configure a DAW with the right drum sounds mapped.
That said, having a MIDI file output (importable into probably every DAW) is likely more useful than an arbitrary text format.
thnx so much! i’ll give your ideas a try