Page 1 of 8

Beta testing for a totally new sampling/triggering alg

PostPosted: Mon Dec 18, 2023 9:41 pm
by dmitri
I've been working on a totally new sampling and triggering algorithm for some time. This new algorithm will work only on STM32F205, STM32F446 and GD32F405 based MegaDrum.
Here is the beta version of the firmware:
megadrum_beta_20241015.zip



This totally new algorithm is activated by enabling both 'Alt Sampling Alg' and 'Inputs Priority' in Misc Settings (either in the module directly or via MDMFX).

The main goal of this algorithm is to improve triggering for pads/cymbals with long vibration/aftertriggering.

I have one such bad mesh pad (dual piezo/piezo pad) and one bad cymbal (Yamaha style [but not Yamaha] 3way piezo/switch/switch cymbal) with which I've been testing this algorithm during development.
The good starting points for these bad pad and cymbal are:

For the bad mesh bad:
Retrigger: 1-10
DynLevel: 4
DynTime: 24
MinScan: 50-60 (this is because first half wave is quite long on the mesh pad)
If the precision rectifier is present:
Pos Level: 1
Pos Low: 15
Pos High: 28

For the bad cymbal:
Retrigger: 1-10
DynLevel: 4
DynTime: 24
Miscan: 15-20

Gains and HighLevels can be set to the same values as with the standard algorithm. Threshold for piezos likely can be set lower.

Not everything is implemented in this new algorithm, e.g. ProgramChange and CutOff in 'Function' are not implemented yet. XTalk suppression may be a bit off.

If MegaDrum is with a TFT LCD (tested with 320x240 LCDs) the following additional functionality is implemented:

The third page of the menu (Samples Graph page) is used to display a waveform (or two waveforms if a piezo/piezo dual pad) of the last triggered hit.
You can select 4 types of the displayed waveform(s).
0 - pure levels as registered before Gain adjustment and normalization. For dual piezo/piezo pads signals for both zones will be overlayed with different colors.
1 - same as 0 but split between head (in the top) and rim (in the bottom)
2 - normalized against HighLevel levels after Gain adjustment. For dual piezo/piezo pads signals for both zones will be overlayed with different colors.
3 - same as 2 but split between head (in the top) and rim (in the bottom)
4-7 - same as above but with slower refresh rate (full clear of the samples graph)
0-3 types may cause samples graph corruption for very fast rolls.


In addition it will show:
Sampled time period and number of samples taken (will depend on MinScan mostly)
Position of the signal peak both as a number and as '*' symbol in the waveform graph. Can be useful for Positional sensing fine tuning.

I implemented support for Roland 3way cymbals but I have not tested it.

If 'Inputs Priority' is not activated, this beta firmware should work exactly the same as the latest official firmware version.

Any feedback is welcome if you have time and willing to test.

Re: Beta testing for a totally new sampling/triggering alg

PostPosted: Wed Dec 20, 2023 11:32 pm
by dmitri
Update beta firmware in the first post.
Corrected Pedal and HiHat handling.

Re: Beta testing for a totally new sampling/triggering alg

PostPosted: Thu Dec 21, 2023 9:05 am
by ignotus
I gave the beta a whirl the other day, but upon immediately seeing that the hi hat pedal had stopped working at all I didn't get to test it much as I wanted to revert back to the old firmware to see if that was the problem. Since flashing firmware is an absolute PITA for me (doesn't work with any of my Linux computers - I have to set up an ancient WinXP box), I gave up on it.

The brief time I tested some pads it did seem promising though. I noticed that none of the switch inputs worked on my cymbals but maybe that's because their threshold needed to be recalibrated. I'll give this new version a test when I get some time.

Re: Beta testing for a totally new sampling/triggering alg

PostPosted: Thu Dec 21, 2023 4:51 pm
by dmitri
If you don't activate new algorithm the behaviour should remain the same and you should not need to roll back to the officical firmware (unless I really made a mistake somewhere in the beta firmware).

Re: Beta testing for a totally new sampling/triggering alg

PostPosted: Thu Dec 21, 2023 4:57 pm
by ignotus
I did deactivate the new algo (and inputs priority) and re-loaded my old config, but the hi hat pedal still wouldn't work, nor would the cymbal switches. I still haven't rolled back to properly check everything goes back to normal, though I don't see why it shouldn't.

Re: Beta testing for a totally new sampling/triggering alg

PostPosted: Sun Dec 24, 2023 4:33 pm
by dmitri
Update beta firmware in the first post.
Fixed inputs 41-48 not working properly, Pedal Alt Input not being activated and some smaller fixes and optimisation.

Re: Beta testing for a totally new sampling/triggering alg

PostPosted: Fri Dec 29, 2023 11:10 pm
by dmitri
Update beta firmware in the first post.
Fixed MIDI LED which I used for debugging and accidentally left as a debug pin in the previous Beta firmware versions and a few other changes since the last Beta:

Code: Select all
git log|grep -E "^   "|head -40|uniq|grep -v Merge
    Fixed DEBUG_ macros
    Removing unneeded DISABLE_ALL_INTERRUPTS and ENABLE_ALL_INTERRUPTS from work_with_inputs
    DEBUG_SYSTICK_STOP_AND_PRINT_STATS fix when compiling for Release
    Removed using LED for debugging
    Re-using PC8 and PC9 for debugging when using standard ili9340
    Added multiple C/C++ Mac config for different STM32 MegaDrum targets
    Added multiple C/C++ Win32 config for different STM32 MegaDrum targets
    Updating vscode project config
    DEBUG_SYSTICK_STOP_AND_PRINT_STATS adjustment
    Implementing Aftertouch for Roland 3way. Not tested
    Enabled debugging for assembler in STM32CubeIDE
    Reimplementing piezo/switch handling to piezo/switch/switch 3way Roland. Not tested
    Choking now works correctly with piezo/switch
    Working on troubleshooting triggered_inputs not cleared properly for piezo/switch(/switch)
    Troubleshooting pending note off
    Working on speeding up test_all_pads_n()
    Fixed get_next_pending_note_off_input and get_next_triggered_input returnin -1 (255) incorrectly
    Working on speeding up test_all_pads_n()
    testing static inline for speed
    Updated for GD32F405
    Sytick config fix for HAL

Re: Beta testing for a totally new sampling/triggering alg

PostPosted: Fri Jan 05, 2024 6:03 pm
by dmitri
Update beta firmware in the first post.
Implemented Program Change and Cut Off functionality and some smaller internal optimizations.

Re: Beta testing for a totally new sampling/triggering alg

PostPosted: Mon Jan 08, 2024 9:26 am
by ignotus
I finally had a chance to test the beta firmware (the latest version uploaded as of today). After hours of troubleshooting it turned out that my FW updating problems went away after switching USB ports on my PC... MDMFX still won't work for me, but at least the command line tool does with WINE. Another weird thing is that my saved settings wouldn't work for me even after going back to the old firmware they were made with - I had to set up all the pads again from scratch.

Anyway, I can get the beta firmware to work well for me, it allowed me to reduce DynLevel and DynTime on most pads (2/8 does it for me on most of them), and I could uncheck ExtraFalseSupp on a couple of particularly problematic cymbals. The only problem I've run into for now (I need to do some further testing) is that the edge switch on my piezo/switch cymbals will send aftertouch messages when choking, but won't do anything when hit - there's no edge hit note sent. I'll see if I can do some more testing this week.

Re: Beta testing for a totally new sampling/triggering alg

PostPosted: Mon Jan 08, 2024 8:53 pm
by dmitri
ignotus wrote:I finally had a chance to test the beta firmware (the latest version uploaded as of today). After hours of troubleshooting it turned out that my FW updating problems went away after switching USB ports on my PC... MDMFX still won't work for me, but at least the command line tool does with WINE. Another weird thing is that my saved settings wouldn't work for me even after going back to the old firmware they were made with - I had to set up all the pads again from scratch.

This is definitely not due to the firmware.

Anyway, I can get the beta firmware to work well for me, it allowed me to reduce DynLevel and DynTime on most pads (2/8 does it for me on most of them), and I could uncheck ExtraFalseSupp on a couple of particularly problematic cymbals.

With the new algorithm ExtraFalseSupp won't be needed (at least it is not needed with a couple of cymbals which have very bad aftervibration) and still allow fast rolls/triggering. ExtraFalseSupp is ignored when the new algorithm is enabled.

The only problem I've run into for now (I need to do some further testing) is that the edge switch on my piezo/switch cymbals will send aftertouch messages when choking, but won't do anything when hit - there's no edge hit note sent. I'll see if I can do some more testing this week.

There were some issues with one of the previous beta versions but now it should work perfectly. Are you sure you've loaded the latest beta firmware?