# Juce\_AudioAppComponent clarification question

**URL:** <https://forum.juce.com/t/juce-audioappcomponent-clarification-question/25749>\
**Category:** General JUCE discussion\
**Created:** [December 27, 2017, 8:18pm UTC](https://forum.juce.com/t/juce-audioappcomponent-clarification-question/25749 "2017-12-27T20:18:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ewhipp](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ewhipp/32/2362_2.png) [@ewhipp](https://forum.juce.com/u/ewhipp)\
**Post date:** [December 27, 2017, 8:18pm UTC](https://forum.juce.com/t/juce-audioappcomponent-clarification-question/25749/1 "2017-12-27T20:18:54Z")

</div>

Hey all,

I’m aware this is probably a noob question to ask. However, I’m working on an audio app that takes in audio from a sound file given by the user and then processes it based on parameters set by the user etc.

_The Problem_  
My code follows pretty closely to the “Build an audio player” tutorial in regards to the application component that handles the audio. However, when I have setAudioChannels(2, 2) I get the assert error in the juce\_AudioAppComponent

```
void AudioAppComponent::setAudioChannels (int numInputChannels, int numOutputChannels, const XmlElement* const xml)
{
    String audioError = deviceManager.initialise (numInputChannels, numOutputChannels, xml, true);
    jassert (audioError.isEmpty());
}

```

I get the idea from the code that when the app is initialized, there is no audio present and then the assert error is thrown.

I’m sure this is incompetence on my end, but some help would be really appreciated.

The program works fine minus playing audio when I have setAudioChannels(0, 2). So that is where my guess is coming from. I’m not sure if I should automatically be playing something upon initialization etc.

---

<div class="post-metadata">

**Author:** ![xenakios](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/xenakios/32/4047_2.png) [@xenakios](https://forum.juce.com/u/xenakios)\
**Post date:** [December 27, 2017, 8:23pm UTC](https://forum.juce.com/t/juce-audioappcomponent-clarification-question/25749/2 "2017-12-27T20:23:58Z")

</div>

> [@ewhipp](#):
>
> The program works fine minus playing audio when I have setAudioChannels(0, 2).

I guess your audio hardware doesn’t support any input channels, at least with the defaults Juce’s AudioDeviceManager uses.

---

<div class="post-metadata">

**Author:** ![ewhipp](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ewhipp/32/2362_2.png) [@ewhipp](https://forum.juce.com/u/ewhipp)\
**Post date:** [December 27, 2017, 8:27pm UTC](https://forum.juce.com/t/juce-audioappcomponent-clarification-question/25749/3 "2017-12-27T20:27:15Z")

</div>

Thanks, I appreciate the help. I’ll look into that.

---

<div class="post-metadata">

**Author:** ![xenakios](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/xenakios/32/4047_2.png) [@xenakios](https://forum.juce.com/u/xenakios)\
**Post date:** [December 27, 2017, 8:28pm UTC](https://forum.juce.com/t/juce-audioappcomponent-clarification-question/25749/4 "2017-12-27T20:28:08Z")

</div>

Have you looked in the debugger what is the error text from AudioDeviceManager when the assert is hit?

---

<div class="post-metadata">

**Author:** ![ewhipp](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ewhipp/32/2362_2.png) [@ewhipp](https://forum.juce.com/u/ewhipp)\
**Post date:** [December 27, 2017, 11:07pm UTC](https://forum.juce.com/t/juce-audioappcomponent-clarification-question/25749/5 "2017-12-27T23:07:10Z")

</div>

It states the input/output devices don’t share the same sample rate. I’m trying to figure out where I set those parameters. I thought they default to 44.1k.

---

<div class="post-metadata">

**Author:** ![ewhipp](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ewhipp/32/2362_2.png) [@ewhipp](https://forum.juce.com/u/ewhipp)\
**Post date:** [December 27, 2017, 11:09pm UTC](https://forum.juce.com/t/juce-audioappcomponent-clarification-question/25749/6 "2017-12-27T23:09:19Z")

</div>

I appreciate you pointing that out. My speakers were set to 48k and my microphone was set to 44.1k. Its taking in the audio now but it isn’t reproducing well – so back to work!

---

<div class="post-metadata">

**Author:** ![matkatmusic](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@matkatmusic](https://forum.juce.com/u/matkatmusic)\
**Post date:** [December 28, 2017, 3:47am UTC](https://forum.juce.com/t/juce-audioappcomponent-clarification-question/25749/7 "2017-12-28T03:47:41Z")

</div>

You might investigate which audio device is being opened. be it some built-in device or some 3rd party device. For example, your system might be set to use an RME or MOTU device as the audio input, but you might be using the built-in speakers as the output instead of the RME or MOTU interface. so, JUCE is gonna use those devices as the ‘default’ device. If that’s the situation, then you’ll have separate clocks controlling the sample rate for each device. However, if you have 1 device being used for input and output, that won’t be the case.

Take a look at the JUCE demo project, particularly the Audio Settings demo and how you can choose which input/output device is selected, how it’s sample rate is changed, etc…
