MEC setup for Soundplane (controlling Aalto)

Hello! I am new to MEC, and am trying to get a working alternative to the Madrona SoundPlane app, which is crashing on my M1 Mac.

I have MEC compiled and running, with a json config that seems to be at least partially working:

{
    "mec"  :  {
        "soundplane"  :  {
            "voices" : 4,
            "steal voices" : true
        }
    },

    "mec-app"  :  {
        "realtime" : true,
        "outputs" : {
            "console" : {
                "throttle" : 0
            },
            "midi" : {
                "mpe" : true,
                "virtual" : 1,
                "voices" : 4,
                "pitchbend range" : 48.0,
                "device" : "MEC Soundplane"
            }
        }
    }
}

I can see output in the console when I run this. touchOn, touchContinue and touchOff messages with note and x/y/z values.

MIDI Monitor shows me various MPE-looking output as well: Pitch Wheel, Brightness, Channel Pressure, and Note Off. But nothing seems to play when I set up a controller in Bitwig and enable MPE for Aalto.

What seems odd to me is there are no Note On events for the channels, only control and Note Off events. I suspect this might be why I’m not hearing anything with Aalto/Bitwig.

Is there anyone with a working SoundPlane/MEC/Bitwig/Aalto solution that might be able to compare notes? Thanks!

-Josh

hmm…

I sold my Soundplane quite a while ago, and have not updated MEC in a long time…
so, I don’t really know what state this is in, nor have a way of testing it.

what does the console log say for the touchOn?
Im wondering if the Z value is too low for touch on, ifs it 0 this could be a problem…

not really, sure… what to say, certainly if you have SOME midi, then no particular reason why the note on should not be sent - and yeah, if they are missing, Id assume aalto / bitwig will not do very much.

have you tried using OSC output instead? frankly, I much prefer the feel of OSC into aalto over using MPE - its a lot more expresive.

also, out of interest a couple of questions:

  1. what platform are you running on?
  2. have you tried with the Madrona Labs Soundplane app?
  1. I’m running MEC on the latest ARM64 macOS.
  2. Yes, the Madrona official app sort of works but crashes on startup unless you unplug the SP at the right moment. I think Randy is working on a fix, but no time frame. MEC seems to be a lot closer to working.

I figured out how to hard code a touchOn velocity in mec_mpe_processor.cpp and that got Aalto working, but it’s a hack job. At least it got me unstuck and it’s currently working more reliably than the Madrona app!

1 Like

ok, (depending on your change), if a static velocity works, then my suspicion about z being too low is likely correct…

basically the velocity calculator used was build for the eigenharp which have very different hardware characteristics.

Ive created a branch which you can try, that tidies this up a bit, and also allows the calculator to be ā€˜fine tunes’

new github branch

code changes are on a new branch, that Ive pushed
branch = sb_test

new config allow

the new block should allow something like

        "soundplane"  :  {
            "voices" : 15,
            "velocity count" : 4,
            "velocity curve" : 4.0,
            "velocity scale" : 4.0,
            "throttle" : 0,
            "steal voices" : true
        }

note: a missing key above, will default to the values shown above.
i.e. you don’t need all / any of keys :wink:

note 2: when using aalto be careful of ā€œvoicesā€ !

the above is the ā€˜default’ and what was being used, and not working, asI think it yielded too small values - that said it was clamped to 0.01, so Id have expected a velocity of 1 (midi) which would be ok!

what values?
this is HIGHLY hardware dependent, which is probably why the defaults fail!

velocity count

number of pressure samples to use, should be 2-N.
depends on frequency of data… more will be sluggish, but should feel more predictable

note: voice does not start until we have N samples.

velocity scale

this is a ā€˜gain’ on pressure samples.
ideally, this is set with a 'max velocityplayed, thatvel_count` samples will approach 1.0.
i.e. the less samples used, the higher this likey needs to be.

velocity curve

this is a curve used to adjust the computed velocity.

1.0 = linear
< 1.0 = more sensitive 
> 1.0 = less sensitive

sensitive is not a good word really, its more how aggressively the samples ramp up on the device. ie. do you get higher value pressure samples faster (for N)

I suspect this could be the main culprit…
as the Eigenharp is a LOT more sensitive than the soundplane and with less travel, so I’d not be surprised for velocity if this had to be ā€˜damped a bit’

may be try linear, or even < 1.0

throttle

throttling of messages in microseconds, only used for ā€˜touchContinue’.
only needed for embedded platforms, of when using hardware midi targets, that may not cope with high frequency of messages.

bare in mind ā€œconsoleā€ is also for testing, you’d likely want this off or throttled for ā€˜real’ use, as its extra cpu/io… though I think it shouldn’t affect things too much.

Important Notes

Untested

I did NOT test this, I have no way to do so… it may be bugged :wink:
I did add a few comments

note: there is an assumption that its the calculated velocity, but there might be something else going on, as I said, im confused as Id expect the vel calc to yield min 0.01 → 1 midi.
but could be pow was returning invalid value, which might have screwed it (fixed)

Hardware dependent

these values are very dependent on hardware, and theres no ā€˜right’ answer, really you need to play and feel them out.

Id probably start with linear scale, so vel_curve = 1.0, then test.
then adjust vel_scale to see if velocity is too low and max velocity.
you can then adjust vel_curve to get a progressive feel.

adjust vel_count if its feeling way too sluggish.
its a trade off,
vel_count 2, would be faster, but likely much less predictable.
vel_count > 4, would be slower, but (hopefully) more predicable.

Changes

mainly, just allowed velocity calculator to be configurable.
but I also did tidy the calculator code.

  • removed some code that felt hardware specific (e.g preloading at zero point on regression)
  • check for pow going out of bounds

these do mean the ā€˜default’ values for vel_curve / vel_scale could be ā€˜off’ even for eigenharp, as that preload changes the regression.
but it feels like its now more correct/logical - but as above, untested, so could have broken it completely :wink:

testing / logging

uncomment out include for logging
uncomment the line for calculated velocity to see

Soundplane velocity

Im going to be honest, I found velocity (using ML app) not very predictable, though it used as simple algo iirc.
Its partly down to the tech used, generally I found soundplane better for slow/evolving pressures, rather than strikes.

is fixed velocity bad?

NO - the Haken continuum uses fixed velocity, because pressure is MUCH better if you have a sensitive controller - you PLAY the curve.
this is also why I much prefer OSC / T3D with aalto !

ofc, the drawback is most synths are based around velocity, so dont have the subtly of pressure :wink:

tl;dr; if you using soundplane, and mainly aalto, stick with fixed velocity, but even better used osc/t3d which is supported in MEC.
and make sure your patches use Z , rather than the aalto envelope and velocity.

the MEC repo contains an osc example… you are interested in outputs with ā€œoscā€, just copy that block

btw: if you change ā€œmidiā€ to ā€œamidiā€, then the midi block cannot be found and so will not be used, this is how you disable/change outputs

honestly, I rarely used the soundplane with anything other than ML vsts for this reason … that an Aalto is my favourite VST by far!


Summary

hopefully this will help you get more out of MEC/Soundplane.

sorry, not much more I can do, and im doing this ā€˜blind’, as I dont have a Soundplane anymore (I do miss it , its a lovely instrument ! )

also, frankly Ive moved on from MEC for my Eigenharps and Erae, the code is a bit ā€˜dated’, and also as I dont have the Soundplane - my newer solutions are simpler as they dont have to support it.

also, bare in mind, MEC was mainly for other platforms (embedded mainly) i.e. those that didn’t have the ML Soundplane App, really macOS (and the console app) was just there for testing purposes.

anyway, sounds like you are able to adjust code (and/or possibly use AI tools), so feel free to fork it, and see if you can fine tune it to your tastes.

if you just focus on mec_soundplane.h/cpp and the mpe processor its not much code really and there is logging so you can track whats going on.
so its quite a simple code base to work with!

Good Luck,

Mark aka TheTechnobaer

2 Likes

Excellent, thank you! I will give this a try and let you know if it works.

I actually did point Claude Code at MEC and the Madrona codebase and had it copy Randy’s method for calculating velocity, which worked pretty well, but I can’t speak to the quality of the fix without being more familiar with the project overall. I’ll compare how you implemented it.

Thanks so much for the help and encouragement :smiley:

-Josh

1 Like

cool, Im I don’t think I looked at what Randy did, buts its likely to be similar - though, Im sure he played with the ā€˜parameters’ so it felt right to him.

I’d personally not spend too much time on it…

Expressive controllers don’t tend to be great with velocity… the issue is fundamentally that, they are designed around a continuous touch, not a strike (like a hammer/mallet/plectrum) - so velocity is really an approximation at best - they only do it because MIDI required it :wink:

put another way, velocity is very much a ā€˜piano thing’ (ok, mallets/sticks too).

the Soundplane hardware in particular, is pretty slow to react, so I doubt you’ll ever get a consistent playable velocity out of it…

again, this is ok, haken don’t bother either…they recognise its just not that kind of instrument , and so just stick to a static velocity aka a ā€˜gate’, then use pressure to allow the user to play the envelope.

I agree, pressure is far more useful for the touch instruments. As long as there’s enough velocity to trigger the note!

I opened a PR with one change from your branch. I actually meant to open the PR into my own fork, so feel free to ignore if you don’t want to merge it.

Claude did most of the work, but I think the change makes sense – it brings over a bit more of the Eigenharp’s touch() initialization code to accumulate pressure before setting the voice to the active state.

I tested it with the SoundPlane and it’s working great.

ah, ok…

initially, Id assumed the velocity detector (aka voice) was not being used for soundplane, I was a bit surprised to find it being used. it was a long time ago, so not sure if I had other ideas, if it was ā€˜half implemented’, or if I updated voice for eigenharp, and forgot the soundplane :laughing:

ok, Im not ready to put sb_test on master (which is your PR) , as it also affects the eigenharp (due to changes to voice) and so Id need to test that before merging (which is why I created the sb_test branch).
what I’ll do instead is look at your changes, and put them (in some form) into sb_test branch.

(so, I’ll likely reject the PR, as its for sb_test → master, for reasons above)

anyway, glad you got it working !

I’d still recommend t3d/osc over mpe midi for aalto however :laughing: , but its useful if you are using other mpe synths.

1 Like

OK, done (on sb_test), again untested…

so what Ive done is actually just use the eigenharp code entirely, its pretty clear that this was the ā€˜later implementation’, so soundplane was just ā€˜out of date’

so basically this is just cut n’ paste from eigenharp, so should fix any issues.

this means the properties for setting curve etc, are now using the ones Id already done for the Eigenharp (!), I’ll update above post to reflect.

also I have implemented throttling, in a similar way to eigenharp.
but if its set to zero (default), then it doesn’t change anything, its unthrottled.
this is mostly useful on embedded platforms , or if you are targeting hardware synths - which may not cope with un-throttled data.


as for WHY the difference at the start, that’s actually alluded to in the TODO comment, which Ive left in for now…

////////////////////////////////////////////////
// TODO
// 1. voices not needed? as soundplane already does touch alloction, just need to detemine on and off

basically the voice class also allocates its own voices, and what I was ā€˜debating’ was, is this necessary?

I don’t think the driver does velocity, though Id need to double check.
but the voice is still useful, as we potentially want to limit the number of touches - and the Soundplane driver does not support this, its always 16 voices. so once you limit that you need to track what touches have been ā€˜filtered’ and which not, also the whole steal voice scenario.

anyway, point being - this shows, this was done prior to me refining the voice code for the eigenharp … so yeah, likely had bugs that Id already fixed there :laughing:

Feel free to reject the PR, or I’ll close it. I’ll give your new update a go.

I do want to figure out the t3d as well, but at the moment it’s segfaulting the instant I touch the SP. Haven’t dug into it any further than that, though.

Thanks again, this was a fun weekend project :smiley:

-Josh

1 Like

it segfaults just with osc/t3d? i.e. its ok with midi?

odd, I used to use this a lot with both eigenharp and soundplane.
do you have a stack trace?

it’d be interesting to know if its the osc layer entirely, or some odd data being sent by the soundplane that triggers its.

its interesting you say it happens when you touch the soundplane,

iirc, the OSC layer is sending a regular ā€œpulseā€ even when touch is not present, so in theory, this should show that the osc layer is working.
… and so perhaps ā€˜unexpected’ data from soundplane layer e.g. perhaps sending a negative value which is not handled properly?

It could be useful to install Protokol , a free app, that can monitor osc and midi messages, to see if the osc layer is working.

1 Like

Yeah, only segfaulting with the OSC config. I suspect I did something wrong, either in the config file or when I compiled, since I’ve modified the config to target arm64 (well, Claude did, I am pretty green with C++).

I haven’t tried vanilla MIDI, just MPE. Your most recent changes are working well for me, though! Thanks.