pschatzmann / arduino-audio-tools

Arduino Audio Tools (a powerful Audio library not only for Arduino)
GNU General Public License v3.0
1.51k stars 233 forks source link

ESP32 A1S How Control Microphone Gain #1594

Closed aviporje closed 4 months ago

aviporje commented 4 months ago

Problem Description

Respected Sir Thanks for Audio Tool Library, Its Perfect i using VBAN Protocol to transmeet Audio, its working Perfect but i having small issues with microphone its noise like 4 stroke engine, so i think i have to control microphone gain but dont know how? I using ESP32 A1S AC101 and VBAN Audio Kit please help me to set microphone gain level Thanks

Device Description

ESP32 A1S AC101

Sketch

/**
 * @file streams-i2s-vban.ino
 * @author Phil Schatzmann
 * @brief sends signal from i2s (using an AudioKit) to VBAN Receptor App 
 */

#include "AudioTools.h"
#include "AudioLibs/VBANStream.h"
#include "AudioLibs/AudioBoardStream.h" // comment out when not using AudioKit

AudioInfo info(24000, 2, 16);
AudioBoardStream in(AudioKitAC101);  // Audio source e.g. replace with I2SStream
VBANStream out;
StreamCopy copier(out, in, 2048);     // copies sound into i2s

// Arduino Setup
void setup(void) {  
  // Open Serial 
  Serial.begin(115200);
  while(!Serial);
  AudioLogger::instance().begin(Serial, AudioLogger::Info);

  // setup output
  auto cfg = out.defaultConfig(TX_MODE);
  cfg.copyFrom(info);
  cfg.ssid = "RS1";
  cfg.password = "9421279061";
  cfg.stream_name = "Stream1";
  cfg.target_ip = IPAddress{192,168,1,1}; // comment out to broadcast
  cfg.throttle_active = false; // generator is much too fast, we need to stall
  if (!out.begin(cfg)) stop();

  // Setup input from mic 
  // setup input
  auto cfg_in = in.defaultConfig(RX_MODE);
  cfg_in.sd_active = false;
  cfg_in.buffer_size = 256;
  cfg_in.buffer_count = 4;
  cfg_in.copyFrom(info);
  cfg_in.input_device = ADC_INPUT_LINE1; // microphone
  in.begin(cfg_in);
}

// Arduino loop - copy sound to out 
void loop() {
  copier.copy();
}

Other Steps to Reproduce

No response

What is your development environment

No response

I have checked existing issues, discussions and online documentation

pschatzmann commented 4 months ago

This is not a bug: Please Read the documentation!