Help creating a simple test sine wave plugin

This should be an easy one!

I’m building a sequencer app, using Tracktion for the timeline and plugin management. It’s not really designed to make any sound, but I do want to have a built in synth just for testing, so that the user can easily generate some notes without having to go through the whole setup of routing plugins, etc. Right now I’m using a 4osc plugin for this, with code borrowed from the EngineInPlugin demo:

            const auto newPlugin = edit.getPluginCache().createNewPlugin(te::FourOscPlugin::xmlTypeName, {}); 
     
                    juce::String organPatch = "<PLUGIN type=\"4osc\" windowLocked=\"1\" id=\"1069\" enabled=\"1\" filterType=\"1\" presetDirty=\"0\" presetName=\"4OSC: Organ\" filterFreq=\"127.00000000000000000000\" ampAttack=\"0.06000002384185791016\" ampDecay=\"10.00000000000000000000\" ampSustain=\"40.00000000000000000000\" ampRelease=\"0.40000000596046447754\" waveShape1=\"2\" tune2=\"-24.00000000000000000000\" waveShape2=\"1\"> <MACROPARAMETERS id=\"1069\"/> <MODIFIERASSIGNMENTS/> <MODMATRIX/> </PLUGIN>";

                    juce::XmlDocument doc(organPatch);
                    if (auto e = doc.getDocumentElement())
                    {
                        auto vt = juce::ValueTree::fromXml(*e);
                        if (vt.isValid())
                            newPlugin->restorePluginStateFromValueTree(vt);
                    }

However this sounds awful! The sound is too rick, and really all I want is a sine wave generator, or something else that’s very smooth. Here are three options I’ve considered:

  1. I could alter the Xml settings for the 4osc so that it gives a less complex sound.
  2. I could use some other, simpler built-in Tracktion plugin.
  3. I create my own plugin, with just a simple sine wave output.

Which option would be the most straightforward here?

I’ve already poked around with option 1, trying to change the Xml settings, but this hasn’t seemed so straight-forward. I feel a bit lazy for asking such a simple question, but it will probably take me hours to work it out by myself, and some general guidance would really help.

Grab Waveform Free, add 4OSC to a track and create a simple sound that you want. Save the Edit and then look at the file as XML, you can then just copy the state in to your code.

1 Like

Great idea Dave. I already have a license for Waveform, so this won’t be a problem.