# Strange DSP behavior

**URL:** <https://forum.juce.com/t/strange-dsp-behavior/11820>\
**Category:** Audio Plugins\
**Created:** [November 8, 2013, 4:22pm UTC](https://forum.juce.com/t/strange-dsp-behavior/11820 "2013-11-08T16:22:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![faldbrzus](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@faldbrzus](https://forum.juce.com/u/faldbrzus)\
**Post date:** [November 8, 2013, 4:22pm UTC](https://forum.juce.com/t/strange-dsp-behavior/11820/1 "2013-11-08T16:22:27Z")

</div>

I made Hello World plugin with IntroJucer.

The only change I made in code was this line (in ProcessReplacing):

(\*channelData) \*= 0.;

&nbsp;

```
void FocustestAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)

{

    // This is the place where you'd normally do the guts of your plugin's

    // audio processing...

    for (int channel = 0; channel < getNumInputChannels(); ++channel)

    {

        float* channelData = buffer.getSampleData (channel);

        int remain = buffer.getNumSamples();

        

    

        for(int i = 0; i < remain;i++)

        {

            

        (*channelData) *= 0.;

        

        }

        

        // ..do something to the data...

    }

    // In case we have more outputs than inputs, we'll clear any output

    // channels that didn't contain input data, (because these aren't

    // guaranteed to be empty - they may contain garbage).

    for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)

    {

        buffer.clear (i, 0, buffer.getNumSamples());

    }

}
```

&nbsp;

&nbsp;

And very funny stuff happend in Wavelab... I don't understand why my plugin is producing spikes and noise. I thought this code should produce silence, but it doesn't.

The same stuff happens in Reaper.

Here is what Juce produces:  
[![](http://vlep.pl/d4o8t2.png)](http://vlep.pl/d4o8t2.png)

&nbsp;

And here is bypass (source file):

[![](http://vlep.pl/qwy2m7.png)](http://vlep.pl/qwy2m7.png)

&nbsp;

And when I make a change in the code - a simple attenuator:

(\*channelData) \*= 0.5;

&nbsp;

I get this:

[![](http://vlep.pl/opce19.png)](http://vlep.pl/opce19.png)

&nbsp;

Am I doing anything wrong?? I thought that dsp in Juce is as clear as in vst? Just getting samples and doin' stuff to them.

---

<div class="post-metadata">

**Author:** ![faldbrzus](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@faldbrzus](https://forum.juce.com/u/faldbrzus)\
**Post date:** [November 8, 2013, 5:48pm UTC](https://forum.juce.com/t/strange-dsp-behavior/11820/2 "2013-11-08T17:48:53Z")

</div>

Sorry... such a bug I made... not moving pointer.  
Too tired to develop. Sorry for making trash on forum

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [November 8, 2013, 5:54pm UTC](https://forum.juce.com/t/strange-dsp-behavior/11820/3 "2013-11-08T17:54:39Z")

</div>

Maybe try modifying _all_ the samples in the buffer, rather than just the first one..
