# Mlp controlling parameters of a vst written in rust!

**URL:** <https://discourse.flucoma.org/t/mlp-controlling-parameters-of-a-vst-written-in-rust/1088>\
**Category:** Code Sharing\
**Created:** [November 10, 2021, 2:46am UTC](https://discourse.flucoma.org/t/mlp-controlling-parameters-of-a-vst-written-in-rust/1088 "2021-11-10T02:46:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![liamfissell](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/l/e9bcb4/32.png) [@liamfissell](https://discourse.flucoma.org/u/liamfissell)\
**Post date:** [November 10, 2021, 2:46am UTC](https://discourse.flucoma.org/t/mlp-controlling-parameters-of-a-vst-written-in-rust/1088/1 "2021-11-10T02:46:31Z")

</div>

Using [baseplug](https://github.com/wrl/baseplug) and [neuroflow](https://github.com/MikhailKravets/NeuroFlow), I cobbled together a (GUI-less) VST that, with the help of a neural network, controls two aspects of the sound (left and right volume) with only one parameter exposed to the host. I tried to independently control resonance and cutoff of a lowpass filter to show that it was truly two parameters changing under the hood rather than one control for “panning” but I turned out to be even worse at DSP than I remembered lol. I think with some slight improvements this could streamline my VST dev; I spend a _shocking_ amount of time right now just trying to get my parameter controls to be intuitive. I’ll note the code is still a mess, though. I couldn’t figure out how to load a file properly so I literally just re-train the network every time you load the plugin lol.

Here’s a github link to the code and some binaries: [GitHub - audiodog301/mlplugin](https://github.com/audiodog301/mlplugin)

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [November 10, 2021, 10:11am UTC](https://discourse.flucoma.org/t/mlp-controlling-parameters-of-a-vst-written-in-rust/1088/2 "2021-11-10T10:11:29Z")

</div>

> [@liamfissell](#):
>
> I couldn’t figure out how to load a file properly so I literally just re-train the network every time you load the plugin

your friend is the `write` and `read` will write/read the state of the MLP object to a file. It is in JSON so you can even read it, and/or use training to/from elsewhere (scikitlearn for instance if you are a python master)

---

<div class="post-metadata">

**Author:** ![tedmoore](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tedmoore/32/439_2.png) [@tedmoore](https://discourse.flucoma.org/u/tedmoore)\
**Post date:** [November 10, 2021, 9:32pm UTC](https://discourse.flucoma.org/t/mlp-controlling-parameters-of-a-vst-written-in-rust/1088/3 "2021-11-10T21:32:05Z")

</div>

Hi @liamfissell!

Welcome to the Discourse! This sounds like a cool project. I’ll be curious to see how it develops. I don’t think I can help you with either the baseplug or neuroflow stuff, but I had a thought. As you know, doing stuff like controlling volume, panning, filter parameters and stuff is quite easy and flexible in Max, so maybe it would be interesting for you to try prototyping some ideas in Max using the `fluid.mlpregressor~` for the kind of control you’re looking for. That way once you get something that feels right you can go back to rust-land and implement it?

You could even see if there’s a clever way to convert the JSON output of `fluid.mlpregressor~` to a format that neuroflow could load?

Cheers,

T

---

<div class="post-metadata">

**Author:** ![liamfissell](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/l/e9bcb4/32.png) [@liamfissell](https://discourse.flucoma.org/u/liamfissell)\
**Post date:** [November 10, 2021, 11:38pm UTC](https://discourse.flucoma.org/t/mlp-controlling-parameters-of-a-vst-written-in-rust/1088/4 "2021-11-10T23:38:51Z")

</div>

That’s exactly what I was considering actually! Max MSP is perfect for prototyping this sort of thing, especially when FluCoMa tools exist. Next time I’m not super busy 24/7 (this weekend?) I hope to look at `neuroflow`'s `.flow` files that save network state and see if they are similar to JSON from fluid’s `mlpregressor~`.

---

<div class="post-metadata">

**Author:** ![liamfissell](https://discourse.flucoma.org/letter_avatar_proxy/v4/letter/l/e9bcb4/32.png) [@liamfissell](https://discourse.flucoma.org/u/liamfissell)\
**Post date:** [November 10, 2021, 11:41pm UTC](https://discourse.flucoma.org/t/mlp-controlling-parameters-of-a-vst-written-in-rust/1088/5 "2021-11-10T23:41:23Z")

</div>

(update: it looks like `.flow` files are going to be not practical to touch at all, but `neuroflow` has a possible upcoming feature for serializing to JSON)
