Skip to content

How to increase the microphone volume when using streams-i2s-webserver_wav #312

@TheAxial

Description

@TheAxial

Hello. please tell me how to increase the output volume of the i2s microphone?
I tried using
ConverterScaler<int16_t> volume(1.0, 0, 32767);
And
volume.setFactor(100.0); (substituted values from 0.5 to 100.0)
Here is the full code:
`/**

  • @file streams-i2s-webserver_wav.ino
  • This sketch reads sound data from I2S. The result is provided as WAV stream which can be listened to in a Web Browser
  • @author Phil Schatzmann
  • @copyright GPLv3
    */

#include "AudioTools.h"
using namespace audio_tools;

AudioWAVServer server("ssid","pass"); // the same a above

I2SStream i2sStream; // Access I2S as stream
ConverterFillLeftAndRight<int16_t> filler(LeftIsEmpty); // fill both channels - or change to RightIsEmpty
ConverterScaler<int16_t> volume(1.0, 0, 32767);

void setup(){
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Info);
volume.setFactor(100.0);
Serial.println("starting I2S...");
auto config = i2sStream.defaultConfig(RX_MODE); //I2S_STD_FORMAT, I2S_MSB_FORMAT, I2S_PHILIPS_FORMAT
config.i2s_format = I2S_PCM_SHORT; // if quality is bad change to I2S_LSB_FORMAT #23
config.sample_rate = 22050;
config.channels = 1;
config.bits_per_sample = 32;
i2sStream.begin(config);
Serial.println("I2S started");

// start data sink
server.begin(i2sStream, config, &filler);
}

// Arduino loop
void loop() {
// Handle new connections
server.doLoop();
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions