ℹ️ Two things first.
- Build the native DLL — nothing on this page runs without it, and the failure is a
DllNotFoundException(or aJuceAbiMismatchExceptionfrom a stale one). See Installation.- These samples let the engine pick the output device. That is fine for a first run, but an empty
OutputDeviceIdis also the usual explanation for "it opened and there is no sound" — read Devices before you conclude the audio is broken.
using JuceSharp;
using var engine = new JuceAudioEngine(new JuceEngineConfig
{
PreferredDriver = AudioDriver.Wasapi,
SampleRate = 48_000,
BufferFrames = 256,
});
engine.Start();
using var song = engine.OpenFile(@"C:\Music\track.wav");
song.Volume = 1.0f;
song.TempoRatio = 0.9f; // 10 % slower (Rubber Band time-stretch)
song.PitchSemitones = -2f; // 2 semitones down
song.Play();
Console.WriteLine($"Length: {song.Length}");
await Task.Delay(song.Length);using var engine = new JuceAudioEngine();
engine.Start();
using var amp = engine.LoadPlugin(@"C:\Program Files\Common Files\VST3\Helix Native.vst3");
amp.AttachToInput();
amp.ShowEditor(); // pops up the plugin's own UI on a JUCE-managed windowamp is a JuceAudioPlugin — disposing it
detaches from the graph and tears down the editor on the correct thread.
using var engine = new JuceAudioEngine();
engine.Start();
using var guitar = engine.LoadPlugin(@"C:\VST3\Ample Guitar SC.vst3");
guitar.AttachToInstrument();
engine.SendMidi(0x90, 60, 100); // note-on C4 vel=100
await Task.Delay(500);
engine.SendMidi(0x80, 60, 0); // note-off C4By default JuceSharp writes [native] … lines to the console if no
ILogger is supplied. Pipe to your own logging stack with:
using Microsoft.Extensions.Logging;
using var loggerFactory = LoggerFactory.Create(b => b.AddConsole());
var log = loggerFactory.CreateLogger<JuceAudioEngine>();
using var engine = new JuceAudioEngine(config: null, logger: log);See Logging & Diagnostics for the full sink list.