# Audio playback is sluggish when Mic (input device) is unplugged from the system

**URL:** <https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510>\
**Category:** MacOSX and iOS\
**Created:** [December 9, 2017, 11:18pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510 "2017-12-09T23:18:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gludhani](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@gludhani](https://forum.juce.com/u/gludhani)\
**Post date:** [December 9, 2017, 11:18pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/1 "2017-12-09T23:18:20Z")

</div>

I have observed a weird behaviour in our application (on Mac OS) which I was able to reproduce in JUCE Demo as well. If we select an audio input device for which appropriate hardware is not connected and then play audio, the playback becomes very sluggish and has noisy artefacts.  
These are the steps to reproduce to this issue.

1. Create Aggregate Device with Built-In Microphone through Audio MIDI Setup
2. Plug headphone with Mic in your system
3. Select Aggregate Device as input in Settings of JUCE Demo. You should be able to use headphone and Mic as output and input device respectively.
4. Unplug headphone from the system
5. Test audio playback by clicking on “Test” button in Settings.

JUCE Version: 5.2.0  
Mac OS: 10.13.2  
Headphone Used: Standard earphones available with iPhone

---

<div class="post-metadata">

**Author:** ![IanB](https://avatars.discourse-cdn.com/v4/letter/i/ee7513/32.png) [@IanB](https://forum.juce.com/u/IanB)\
**Post date:** [December 10, 2017, 8:30pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/2 "2017-12-10T20:30:21Z")

</div>

I’m not an expert but could it be a Sample Rate issue?

---

<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:** [December 11, 2017, 3:10pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/3 "2017-12-11T15:10:10Z")

</div>

Are you using the latest version of juce (i.e. the develop brach)?

There was some work recently on CoreAudio devices that might make a difference.

---

<div class="post-metadata">

**Author:** ![gludhani](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@gludhani](https://forum.juce.com/u/gludhani)\
**Post date:** [December 11, 2017, 4:11pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/4 "2017-12-11T16:11:26Z")

</div>

Hi Ian,

Thanks for taking time to respond. I investigated this issue and found that it has nothing to do with sample rate.

-Gautam

---

<div class="post-metadata">

**Author:** ![gludhani](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@gludhani](https://forum.juce.com/u/gludhani)\
**Post date:** [December 11, 2017, 4:19pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/5 "2017-12-11T16:19:19Z")

</div>

Hi Jules,

Thanks for taking time to respond to this issue!

We are using develop branch. I tried Time Profiler instrument (on Debug config) to find the root cause. It seems that there is some issue in `AudioIODeviceCombiner::DeviceWrapper::audioDeviceIOCallback` function. There is a `sleep` of 1 ms when this situation occurs, which does not happen in normal playback.

This is the last commit that we are using.

> <https://github.com/WeAreROLI/JUCE/commit/7dd8fa993e5f1cdf1761d18bdf6f2376569baafa>

-Gautam

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [December 12, 2017, 12:07pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/6 "2017-12-12T12:07:24Z")

</div>

I can reproduce this - we’re looking at it now.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [December 13, 2017, 5:28pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/7 "2017-12-13T17:28:08Z")

</div>

Fixed:

> <https://github.com/WeAreROLI/JUCE/commit/f24045053dfbcf6b55f554c072d96fef45f26dab>

---

<div class="post-metadata">

**Author:** ![gludhani](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@gludhani](https://forum.juce.com/u/gludhani)\
**Post date:** [December 13, 2017, 10:27pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/8 "2017-12-13T22:27:31Z")

</div>

I will fetch these changes from develop branch and test the issue.

Thanks,  
Gautam

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [December 14, 2017, 10:13am UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/9 "2017-12-14T10:13:48Z")

</div>

Wait a little while - I’ve uncovered some additional problems. Should have them sorted today.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [December 14, 2017, 12:22pm UTC](https://forum.juce.com/t/audio-playback-is-sluggish-when-mic-input-device-is-unplugged-from-the-system/25510/10 "2017-12-14T12:22:32Z")

</div>

Use this commit:

> <https://github.com/WeAreROLI/JUCE/commit/438ab2b0f752f2eb20b1f770d72fc57ad47523a7>
