# How to modify with AudioBlock only a channel of AudioBuffer?

**URL:** <https://forum.juce.com/t/how-to-modify-with-audioblock-only-a-channel-of-audiobuffer/62305>\
**Category:** General JUCE discussion\
**Created:** [July 27, 2024, 2:29pm UTC](https://forum.juce.com/t/how-to-modify-with-audioblock-only-a-channel-of-audiobuffer/62305 "2024-07-27T14:29:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ayra](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ayra/32/5775_2.png) [@Ayra](https://forum.juce.com/u/Ayra)\
**Post date:** [July 27, 2024, 2:29pm UTC](https://forum.juce.com/t/how-to-modify-with-audioblock-only-a-channel-of-audiobuffer/62305/1 "2024-07-27T14:29:42Z")

</div>

Hi, I was trying to get only a channel of an AudioBuffer, then copy it to an AudioBlock with only one channel, applying to this AudioBlock a dsp::DelayLine and finally replace the original AudioBuffer channel with this new AudioBlock processed… how to do it?

```auto
dsp::AudioBlock<Type> audioBlock { src->audioBuffer };
dsp::AudioBlock<Type> audioBlockToDelay { audioBlock.getSingleChannelBlock(conn.source.channelIndex) };

delayDsp.delayDsp.process(dsp::ProcessContextReplacing<Type>(audioBlockToDelay));
                        
audioBlockToDelay.copyTo(src->audioBuffer);

```

doe this make sense? there’s is a better way to do it?

---

<div class="post-metadata">

**Author:** ![zsliu98](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/zsliu98/32/22502_2.png) [@zsliu98](https://forum.juce.com/u/zsliu98)\
**Post date:** [July 27, 2024, 3:28pm UTC](https://forum.juce.com/t/how-to-modify-with-audioblock-only-a-channel-of-audiobuffer/62305/2 "2024-07-27T15:28:19Z")

</div>

If you want the delay effect on only one channel, you don’t need the last line of code. Cause (in general) `AudioBlock` does not own data, it directly refers to the original source.

---

<div class="post-metadata">

**Author:** ![Ayra](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ayra/32/5775_2.png) [@Ayra](https://forum.juce.com/u/Ayra)\
**Post date:** [July 27, 2024, 3:57pm UTC](https://forum.juce.com/t/how-to-modify-with-audioblock-only-a-channel-of-audiobuffer/62305/3 "2024-07-27T15:57:39Z")

</div>

Really thank you! 🙏
