# No Output or Input following Juce Tutorial

**URL:** <https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899>\
**Category:** Audio Plugins\
**Created:** [May 7, 2021, 9:35pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899 "2021-05-07T21:35:09Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonygravell](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tonygravell](https://forum.juce.com/u/tonygravell)\
**Post date:** [May 7, 2021, 9:35pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/1 "2021-05-07T21:35:09Z")

</div>

I haven’t yet been able to get output or input from any Juce plugin. I followed this specific tutorial closely and after trying for awhile I decided to copy/paste the code exactly and I still have no input or output. Audio is simply cut off when the plugin is turned on. Since I’m new, this may be a project set up issue but its not a DAW issue because all other plugins work. Is there anything not included (code or set up) in this tutorial that you need to do for audio to pass through or get output? Any help is much appreciated.

[https://docs.juce.com/master/tutorial\_code\_basic\_plugin.html](https://docs.juce.com/master/tutorial_code_basic_plugin.html)

---

<div class="post-metadata">

**Author:** ![benvining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/benvining/32/9922_2.png) [@benvining](https://forum.juce.com/u/benvining)\
**Post date:** [May 7, 2021, 9:45pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/2 "2021-05-07T21:45:02Z")

</div>

what does the code in your processor’s `processBlock()` method look like?

---

<div class="post-metadata">

**Author:** ![tonygravell](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tonygravell](https://forum.juce.com/u/tonygravell)\
**Post date:** [May 7, 2021, 9:47pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/3 "2021-05-07T21:47:13Z")

</div>

```
void GainzAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
buffer.clear();
 
    juce::MidiBuffer processedMidi;
 
    for (const auto metadata : midiMessages)
    {
        auto message = metadata.getMessage();
        const auto time = metadata.samplePosition;
 
        if (message.isNoteOn())
        {
            message = juce::MidiMessage::noteOn (message.getChannel(),
                                                 message.getNoteNumber(),
                                                 (juce::uint8) noteOnVel);
        }
 
        processedMidi.addEvent (message, time);
    }
 
    midiMessages.swapWith (processedMidi);
}
```

---

<div class="post-metadata">

**Author:** ![benvining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/benvining/32/9922_2.png) [@benvining](https://forum.juce.com/u/benvining)\
**Post date:** [May 7, 2021, 9:47pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/4 "2021-05-07T21:47:58Z")

</div>

cool, so what this code does is clear the I/O audio buffer completely, and then output some midi notes.

You’ve told your plugin to output silence and MIDI, so that’s what it’s doing

---

<div class="post-metadata">

**Author:** ![tonygravell](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tonygravell](https://forum.juce.com/u/tonygravell)\
**Post date:** [May 7, 2021, 9:49pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/5 "2021-05-07T21:49:31Z")

</div>

Is this silence coming from buffer.clear(), and are you suggesting I remove that?

---

<div class="post-metadata">

**Author:** ![benvining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/benvining/32/9922_2.png) [@benvining](https://forum.juce.com/u/benvining)\
**Post date:** [May 7, 2021, 9:51pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/6 "2021-05-07T21:51:56Z")

</div>

yes, there is silence because you are calling `buffer.clear()`. If you remove that, the sound should flow cleanly through your plugin.

Calling `buffer.clear()` is a typical strategy as a “first step” in the processBlock() for synthesis plugins (not effects, obviously, because you want to work with the incoming audio, so you need it!), but if you do that, then you need to _fill_ the buffer again with something else, or it will output silence

---

<div class="post-metadata">

**Author:** ![tonygravell](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tonygravell](https://forum.juce.com/u/tonygravell)\
**Post date:** [May 7, 2021, 10:02pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/7 "2021-05-07T22:02:34Z")

</div>

I removed it and now audio comes through, but I have no functionality in the slider. Is there anything else in the code that would stop the midi messages from being affected by the slider?

---

<div class="post-metadata">

**Author:** ![benvining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/benvining/32/9922_2.png) [@benvining](https://forum.juce.com/u/benvining)\
**Post date:** [May 7, 2021, 10:27pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/8 "2021-05-07T22:27:00Z")

</div>

your midi messages aren’t doing anything to your audio. In order to hear it do something, you need to write code that does something to the audio in the buffer.

---

<div class="post-metadata">

**Author:** ![tonygravell](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tonygravell](https://forum.juce.com/u/tonygravell)\
**Post date:** [May 8, 2021, 11:34am UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/9 "2021-05-08T11:34:00Z")

</div>

That would make sense. I was under the assumption that this block of code, (which includes my noteOnVel member variable):  
if (message.isNoteOn())  
{  
message = juce::MidiMessage::noteOn (message.getChannel(),  
message.getNoteNumber(),  
(juce::uint8) noteOnVel);  
}

Changed the volume(velocity) of the notes from this function in my editor:

void TutorialPluginAudioProcessorEditor::sliderValueChanged (juce::Slider\* slider)  
{  
audioProcessor.noteOnVel = midiVolume.getValue();  
}

Is this not a correct assumption?

---

<div class="post-metadata">

**Author:** ![nicolasdanet](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nicolasdanet/32/56_2.png) [@nicolasdanet](https://forum.juce.com/u/nicolasdanet)\
**Post date:** [May 8, 2021, 12:47pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/10 "2021-05-08T12:47:18Z")

</div>

The `processBlock` method handles audio buffers AND [MIDI](https://en.wikipedia.org/wiki/MIDI) messages.  
Here you are modifying only MIDI messages.  
You are not doing anything to the audio buffers (you don’t generate/change any sound here).  
MIDI messages are not sounds.  
Synthesiser makes audio from MIDI messages.

---

<div class="post-metadata">

**Author:** ![tonygravell](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tonygravell](https://forum.juce.com/u/tonygravell)\
**Post date:** [May 8, 2021, 12:59pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/11 "2021-05-08T12:59:15Z")

</div>

That makes sense but I thought by changing the velocity, you would also be changing the sound, (not necessarily the audio from an audio buffer). That would make the notes lighter and therefore changing the audio. Unless for some reason that is also not happening here.

---

<div class="post-metadata">

**Author:** ![nicolasdanet](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nicolasdanet/32/56_2.png) [@nicolasdanet](https://forum.juce.com/u/nicolasdanet)\
**Post date:** [May 8, 2021, 1:14pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/12 "2021-05-08T13:14:41Z")

</div>

Change velocity of the MIDI messages will affect the sound generated by a synthesiser.  
I’m not sure you understand the difference between MIDI and DSP.  
It makes that discussion very… unintelligible. 😄

---

<div class="post-metadata">

**Author:** ![tonygravell](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tonygravell](https://forum.juce.com/u/tonygravell)\
**Post date:** [May 8, 2021, 2:16pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/13 "2021-05-08T14:16:36Z")

</div>

To be honest I’m just here to figure out how get output from my plugin. I copied the code exactly from the tutorial hoping that I could dissect each piece and learn more about it. I don’t know anything about this stuff yet really, any help is appreciated.

---

<div class="post-metadata">

**Author:** ![nicolasdanet](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nicolasdanet/32/56_2.png) [@nicolasdanet](https://forum.juce.com/u/nicolasdanet)\
**Post date:** [May 8, 2021, 2:25pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/14 "2021-05-08T14:25:50Z")

</div>

> [@tonygravell](#):
>
> To be honest I’m just here to figure out how get output from my plugin.

Which kind of output, MIDI or Audio/DSP? 🤔

---

<div class="post-metadata">

**Author:** ![tonygravell](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tonygravell](https://forum.juce.com/u/tonygravell)\
**Post date:** [May 8, 2021, 2:29pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/15 "2021-05-08T14:29:55Z")

</div>

Good question, audio. I think I’m starting to understand. I’m dealing with midi out right now, not audio. Since this is a gain plugin for an audio or midi source, I still want to be dealing with audio/DSP, not midi. Is that what you’re saying?

And so basically the tutorial is correct, I was just expecting a gain plug-in for audio, whereas this is for midi velocities. It doesn’t matter wether the input is midi or audio, for a gain plugin you need to work with the audio signal.

---

<div class="post-metadata">

**Author:** ![nicolasdanet](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nicolasdanet/32/56_2.png) [@nicolasdanet](https://forum.juce.com/u/nicolasdanet)\
**Post date:** [May 8, 2021, 2:49pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/16 "2021-05-08T14:49:04Z")

</div>

> I’m dealing with midi out right now, not audio.

Yes.

> I was just expecting a gain plug-in for audio, whereas this is for midi velocities.

Yes.

> for a gain plugin you need to work with the audio signal.

Yes.

.  
.  
.

There’s a noise gate plugin in tutorials you could use/analyse.

[https://docs.juce.com/master/tutorial\_plugin\_examples.html](https://docs.juce.com/master/tutorial_plugin_examples.html)

But IMHO, you should read ALL the tutorials first (IIRC there’s a glitch-free gain example inside).

---

<div class="post-metadata">

**Author:** ![tonygravell](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tonygravell](https://forum.juce.com/u/tonygravell)\
**Post date:** [May 8, 2021, 2:50pm UTC](https://forum.juce.com/t/no-output-or-input-following-juce-tutorial/45899/17 "2021-05-08T14:50:55Z")

</div>

Okay great, thanks for sharing the link and for answering my questions.
