# Minim gain not increasing past 6.026dB

**URL:** <https://discourse.processing.org/t/minim-gain-not-increasing-past-6-026db/39698>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [November 14, 2022, 3:25am UTC](https://discourse.processing.org/t/minim-gain-not-increasing-past-6-026db/39698 "2022-11-14T03:25:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rigo](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@rigo](https://discourse.processing.org/u/rigo)\
**Post date:** [November 14, 2022, 3:25am UTC](https://discourse.processing.org/t/minim-gain-not-increasing-past-6-026db/39698/1 "2022-11-14T03:25:21Z")

</div>

> please format code with \</\> button \* [homework policy](https://discourse.processing.org/faq/#homework) \* [asking questions](https://discourse.processing.org/t/2147)

I’m trying to get audio output from processing after receiving input from an arduino. I was just trying to test the processing code without the Arduino and found the gain does not increase part 6.026dB for any mp3 I tried. The setVolume method doesn’t work at all for me. I haven’t tried it on windows just MacOS.

Is there a way around the decibel cap or a better way to set volume?

```auto
import ddf.minim.*;
import ddf.minim.AudioPlayer;

import processing.serial.*;

Minim minim;
AudioPlayer middleCNote;

boolean start_audio = true;
boolean playing = true;
boolean stop_audio = false;

void setup () {
  size(480, 360);

  myPort = new Serial(this, Serial.list()[0], 38400); // also make sure baud rate matches Arduino
  bg = loadImage("keyboard.jpg");
  minim = new Minim(this);
  middleCNote = minim.loadFile("do-80236.mp3");
}

void draw() {
  background(bg);

  if (start_audio) {
    middleCNote.setGain(12);
    middleCNote.play();
    //middleCNote.setVolume(volume);
    println(middleCNote.getGain());
  } else if (stop_audio) {
    middleCNote.pause();
    middleCNote.rewind();
  }
  if (playing == true) {
    fill(200, 0, 0);
    ellipse(30, 260, 20, 20);
  }
}

void serialEvent (Serial myPort) {
  if ( myPort.available() > 0) {
    String arduinoASCII = myPort.readStringUntil('\n');
    String[] asci_list = split(arduinoASCII, ' '); //expecting two arguments so split by ' ' delimiter
    print("out: ");
    print(arduinoASCII);

    if (!playing && float(asci_list[0]) == 1) {
      playing = true;
      start_audio = true;
    } else if (float(asci_list[0])==0) {
      playing = false;
    }
    if (asci_list[0].equals("NaN") == false) {
      volume =float(asci_list[1]);
    }
  }
}

```
