Amp in Sound library not working

/**

  • This is a simple sound file player. Use the mouse position to control playback
  • speed, amplitude and stereo panning.
    */
    // Map mouseY from 0.2 to 1.0 for amplitude
    float amplitude = map(mouseY, 0, width, 0.2, 1.0);
    soundfile.amp(amplitude);

The file.amp(desired_volume) doesn’t seem to be working at all. We tried in both macOS and Windows setups. Not even the code example within the library, called “SimplePlayback” works. It simply doesn’t affect the amplitude of the sound being played.

It used to work until recently. Any clues as to what to do next? Is there other way to handle the volume or something else to try out?

Hello @todocono,

Initially it did not seem to work for me as well.
Too much going and a cacophony of sound and I slimmed it down to volume only!

There was an error as well in mapping.

I then went in to the various Windows sound settings and looked around and then it seemed to work! I did not change anything and initially did not see “Simple Playback” in there initially.

Try this modified version:

/**
 * This is a simple sound file player. Use the mouse position to control playback
 * speed, amplitude and stereo panning.
 */

// GLV modified code below for amplitude only:

import processing.sound.*;

SoundFile soundfile;

void setup() {
  size(120, 360);
  background(255);

  // Load a soundfile
  soundfile = new SoundFile(this, "vibraphon.aiff");

  // Play the file in a loop
  soundfile.loop();
  
  mouseY = height/2; // Set initial value before using mouse in sketch window
}      

void draw() {
  background(255);
  
  // Map mouseY from 0.0 to 1.0 for amplitude
  //float amplitude = map(mouseY, 0, width, 0.0, 1.0);
  float amplitude = map(mouseY, 0, height, 0.0, 1.0); //< Corrected to height!
  
  println(mouseY, amplitude);
  
  circle(width/2, mouseY, 20);
  
  soundfile.amp(amplitude);
}

My Volume mixer:

The GitHub source:

:)