sapphire icon indicating copy to clipboard operation
sapphire copied to clipboard

A "TubeMonster" engine

Open baconpaul opened this issue 10 months ago • 29 comments

Imagine

  1. The naive pitch detector of tree monster (https://github.com/surge-synthesizer/sst-effects/blob/c6bdfc3f358e1815d3412603bdab2015900e3b0b/include/sst/effects-shared/TreemonsterCore.h#L240)
  2. sets the frequency of a tube-unit instance
  3. and then feeds into a OJD wave shaper https://github.com/surge-synthesizer/sst-waveshapers/blob/2615805adfd7fc8db8eeafff6f4549b653d93cdf/include/sst/waveshapers/WaveshaperConfiguration.h#L66

you would have, basically, a tube-unit which kinda tracks your electric guitar and gunks it out on the end.

baconpaul avatar Jan 24 '25 22:01 baconpaul

The wavesgaper probably needs oversampling to not sound crap so let’s leave that out and instead just make a tube unit variant with frequency based on inbound detection (and so the root goes to an offset)

baconpaul avatar Jan 25 '25 12:01 baconpaul

Or use the flexible ADAA that works on any waveform (there's that paper about it...)

mkruselj avatar Jan 25 '25 13:01 mkruselj

Or use the flexible ADAA that works on any waveform (there's that paper about it...)

Even with the ADAA (which you could do with OJD - it is integratabtle) I think you'd still want oversampling at the end of the chain we imagine here.

but the point is more: there's plenty of downstream distortions. What we want is the pitch tracked tube unit and then you can stick your favorite overdrive on back of that.

baconpaul avatar Jan 25 '25 18:01 baconpaul

DryGuitarForDon.wav.zip

Don here's that wav file we discussed in email

baconpaul avatar Jan 25 '25 18:01 baconpaul

I created a tubemonster topic branch for this project. Depending on how wide we want the panel to be, we may need a shorter name. I'm pondering something in the realm of monsters, with tubular parts, so I thought of "Sapphire Hydra". I'm open to other short names, if we end up needing a short name.

cosinekitty avatar Jan 25 '25 19:01 cosinekitty

So the nice thing about tubemonster is it is a cross of tube unit and tree monster and so harkens to both (you can find tree monster in surge but also in bitwig!)

The panel will have more knobs the tube unit since it will need to contain the speed and filter controls for the pitch detector too so I think we will have space!

But before we get ahead let’s write it perhaps?

I don’t know what a topic branch is?

baconpaul avatar Jan 25 '25 20:01 baconpaul

OK, I created a clone of the Tube Unit panel but changed the title text to "tube monster". It looks great already, so no name change needed. Especially because you believe we will need more knobs.

cosinekitty avatar Jan 25 '25 20:01 cosinekitty

Oh yes, topic branch is just my way of saying a git branch for a given topic, in this case Tube Monster.

cosinekitty avatar Jan 25 '25 21:01 cosinekitty

Oh gotcha

baconpaul avatar Jan 25 '25 21:01 baconpaul

Image

Here's the tree monster rack panel

the four knobs under 'pitch detection' will be the ones you need.

Basically if you think of tree monster as

pitch detection -> set pitch on an oscillator -> ringmod that oscillator with the input signal

the pitch detection has speed and threshold clamps plus optional low and high pass filters pre-detection.

you could use the exact same technique (its the code linked above) to generate an imputed frequency then set the frequency knob in tube monster to be an 'offset' in semitones (probably) or v/oct (same thing just times 12)

that's sort of how i kinda figured it would happen

baconpaul avatar Jan 25 '25 21:01 baconpaul

oh also to test, tree monster outputs the v/oct implied for a signal so you can wire up and see that output in rack. the output is right there on the front panel.

tree monster also has an envelope follower which you can ignore.

baconpaul avatar Jan 25 '25 21:01 baconpaul

Oh cool, that helps a lot! I was wondering if it would be possible to prototype this using modules and cables in a VCV Rack patch. It sounds like the answer is yes. I will take a whack at this!

cosinekitty avatar Jan 25 '25 21:01 cosinekitty

https://www.youtube.com/watch?v=JnrhAOwDMrc

cosinekitty avatar Jan 25 '25 22:01 cosinekitty

Ha yeah that’s amazing

And I love your idea of env being a scaled modulator for airflow as well as detected frequency pushing around root frequency

baconpaul avatar Jan 25 '25 22:01 baconpaul

Thank you! I ended up playing around with it more. Added some chaos and this happened:

https://www.youtube.com/watch?v=FDceNkGtAO4

https://patchstorage.com/sapphire-plus-surge-xt-treemonster/

cosinekitty avatar Jan 26 '25 02:01 cosinekitty

I reviewed the idea and wrote a list of what I think the knobs and ports should be.

I'm trying to think more in terms of dual VCV Rack + DAW. So "knob" means "knob + attenuverter + CV input port" in VCV Rack, or "knob + parameter" in DAW. And "port" means explicit input/output port in VCV Rack, or implicit audio signal in DAW.

Like Paul said, use the 4 knobs from Tree Monster:

  • Thresh
  • Speed
  • Lo Cut
  • Hi Cut

We add these knobs:

  • Tube Unit Root Offset
  • Tube Unit Airflow Offset
  • Mix (chainable for DAW)

It has 2 inputs for stereo audio:

  • Left audio input
  • Right audio input

And stereo outputs:

  • Left audio output
  • Right audio output

I also think it would be great to output Tree Monster's CV signals for the outside world to use. This might be in VCV Rack only, because I think Paul told me general-purpose CV manipulation isn't as easy in the DAW world.

  • Tree Monster V/OCT output
  • Tree Monster ENV output

What do you all think?

cosinekitty avatar Jan 26 '25 16:01 cosinekitty

It would also have all the other knobs of tube unit still right like decay, vortex, etc....?

I think you may want an airflow offset from envelope and an absolute airflow. So "airflow = airflow base + env * airflow offset". Kinda like an attenuverter for the internal envelope

Otherwise sounds spot on.

baconpaul avatar Jan 26 '25 17:01 baconpaul

It would also have all the other knobs of tube unit still right like decay, vortex, etc....?

I'm not sure yet, because the more external control we give over those parameters, the harder it gets to make the sound tunable in a V/OCT sense. In fact, it may already still be something of a challenge, but I believe I can do it. Delay is probably still OK, but the others are problematic.

I think I may need to even change how Airflow works, because it also affects pitch, not just amplitude.

cosinekitty avatar Jan 26 '25 17:01 cosinekitty

Hmm I sort of feel it is better to have the user have everything and give them reasonable defaults … then they can explore the inharmonic mess if they want

See what I mean?

baconpaul avatar Jan 26 '25 17:01 baconpaul

And I don’t think you should feel compelled to have the item make the exact frequency for voct at all settings. Many other items don’t. But if you default everything you should be close

At least that’s what I think we want - at least for the guitar case

baconpaul avatar Jan 26 '25 18:01 baconpaul

OK, I won't worry too much about tunability for now. I can start with a more naive implementation, plus a unit test that reads a wav file (the guitar one you sent me) and writes a wav file.

Another question: is it better for me to submodule your sst-effects project or copy a few files? It seems like I'm using so little of it (just TreeMonster so far) that maybe I could just copy a few header files over. Or are there lots of nested include files that make it easier to submodule?

Thanks!

cosinekitty avatar Jan 26 '25 18:01 cosinekitty

I kinda figured yeah in this case you would just reimplement the algorithm without the dependencies and parameter code

It’s 50 lines of code and you can use the cytomic filter you already have instead of the Biquad making it really just a filter and count and smooth

baconpaul avatar Jan 26 '25 22:01 baconpaul

I'm making some progress by focusing just on the pitch/envelope detector part of Tree Monster. I have a prototype Sapphire Env module that is just that by itself, which seems very useful in the modular rack world. In the spirit of Tube Monster, I used Env to detect the "pitch" of a Tube Unit, then feed the pitch signal back through the root frequency CV input:

https://www.youtube.com/watch?v=-7Hr9z2X8eE

cosinekitty avatar Feb 07 '25 22:02 cosinekitty

Oh that's haunting and exciting both

baconpaul avatar Feb 08 '25 02:02 baconpaul

I'm close to finishing up an Env module based on TreeMonster's Env/Pitch detectors.

@baconpaul, as you suggested, I tried using the Cytomic bandpass filter as the pitch detector prefilter. I ended up liking the results so much that I'm keeping it that way. So now there are FREQ and RES knobs that help narrow in on the band of frequencies where your pitch note fundamentals are located:

Image

I think the next module I want to create is a feedback controller. In theory, this could help tune an "untunable" voice, so long as there is some way to use CV to make that voice change its pitch in some sense. The idea is to chain:

  1. A non-V/Oct tunable voice, but with some CV input that changes its pitch, e.g. Tube Unit.
  2. The Env module to detect the current pitch.
  3. The hypothetical feedback controller that compares the current pitch against some desired pitch. This feedback controller module has a signal input and a target input. It has an output port whose voltage can be used as CV to modify the pitch of the voice.

Put these together and you have a sort of thermostat thing that might either keep Tube Unit playing an actual melody, or fail in completely hilarious ways.

cosinekitty avatar Feb 11 '25 21:02 cosinekitty

Right basically an slow iterative solver for pitch

Clever

baconpaul avatar Feb 12 '25 13:02 baconpaul

I guess just assume your pitch is monotonic in voct and it’s pretty doable

baconpaul avatar Feb 12 '25 13:02 baconpaul

@baconpaul I just created a pre-release build of Env for people to play with. I'll be interested in what you think!

cosinekitty avatar Feb 12 '25 20:02 cosinekitty

And here is a 2-minute video demo:

https://www.youtube.com/watch?v=P8HinJX07t4

cosinekitty avatar Feb 13 '25 02:02 cosinekitty

This idea ended up going in a totally different direction. Closing this issue because my roadmap is already full and I don't plan on doing Tube Monster.

cosinekitty avatar Nov 17 '25 15:11 cosinekitty