# Independent audio recording

**URL:** <https://forum.juce.com/t/independent-audio-recording/50106>\
**Category:** Tracktion Engine\
**Created:** [February 9, 2022, 4:40pm UTC](https://forum.juce.com/t/independent-audio-recording/50106 "2022-02-09T16:40:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToxVox](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@ToxVox](https://forum.juce.com/u/ToxVox)\
**Post date:** [February 9, 2022, 4:40pm UTC](https://forum.juce.com/t/independent-audio-recording/50106/1 "2022-02-09T16:40:39Z")

</div>

I’m thinking about the possibility to record an audio file independently from Clip / Takes etc. My use case is to record an audio file direct to a sampler plugin and play it instantly. Where could be the point to grab the incoming audio input? Maybe with through deviceManager from te::engine?

Suggestions are welcome!

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [February 9, 2022, 5:04pm UTC](https://forum.juce.com/t/independent-audio-recording/50106/2 "2022-02-09T17:04:08Z")

</div>

My suggestion is that you let the host / DAW manage the inputs. You could create an instrument that listens to the main input and an additional side chain input.

---

<div class="post-metadata">

**Author:** ![ToxVox](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@ToxVox](https://forum.juce.com/u/ToxVox)\
**Post date:** [February 9, 2022, 6:28pm UTC](https://forum.juce.com/t/independent-audio-recording/50106/3 "2022-02-09T18:28:41Z")

</div>

Sounds good to let the DAW (in my case the tracktion\_engine) manage the inputs. I would create a tracktion plugin and listen to the buffer. For better understanding I choose the tracktion plugin “equaliser”. In this plugin I can grab the buffer in the function applyToBuffer.

[te::Equaliser::applyToBuffer](https://github.com/Tracktion/tracktion_engine/blob/a52de2e05f1b831582c7c615371f82fb0f9b64e6/modules/tracktion_engine/plugins/effects/tracktion_Equaliser.cpp#L270)

I would take the variable `fc.destBuffer` and write it in a file. For example with `juce::AudioFormatWriter::ThreadedWriter`

Does it make sense?

---

<div class="post-metadata">

**Author:** ![RolandMR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rolandmr/32/641_2.png) [@RolandMR](https://forum.juce.com/u/RolandMR)\
**Post date:** [February 9, 2022, 8:13pm UTC](https://forum.juce.com/t/independent-audio-recording/50106/4 "2022-02-09T20:13:25Z")

</div>

You can grab the `AudioDeviceManager` from the `Engine` and then add `addAudioCallback` and get the raw audio coming in. The downside to doing this is the audio won’t be associated with one of the Inputs that the engine creates. This may or may not be an issue for you. Maybe not if you only support stereo in, maybe in your support 10 input channels and you need to figure out which one is which.

It’s not really designed for it, but each input has a `RetrospectiveRecordBuffer` which holds the last 30 seconds or so of incoming audio, you might be able to grab it from there if you just need a bit of audio.

---

<div class="post-metadata">

**Author:** ![ToxVox](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@ToxVox](https://forum.juce.com/u/ToxVox)\
**Post date:** [February 10, 2022, 4:53pm UTC](https://forum.juce.com/t/independent-audio-recording/50106/5 "2022-02-10T16:53:23Z")

</div>

Works for me! I can record audio direct from default audio input. I access to `juce::AudioDeviceManager` though the `engine`.

`engine.getDeviceManager().deviceManager.addAudioCallback( &audioRecorderCallback );`
