I have tried do change the volume of a synth in p5.sound.js, it hasnt worked


I have a synth that goes like this:

var attackLevel4 = 1.0;
var releaseLevel4 = 0;

var attackTime4 = 0.1;
var decayTime4 = 0.2;
var susPercent4 = 0.01;
var releaseTime4 = 0.5;

var env4, sinOsc4;

env4 = new p5.Env();
  env4.setADSR(attackTime4, decayTime4, susPercent4, releaseTime4);
  env3.setRange(attackLevel3, releaseLevel3);

  sinOsc4 = new p5.Oscillator('sine');

function playEnv4(){

The function setVolume() did not work, it sends an error in the console. So based on https://github.com/processing/p5.js-sound/issues/182 , I tried to modify the p5.sound.js file in line 1065, but It really doesn't make a difference. Because I beleive the next thing shouldn't sound at all:

function playEnv4(){
  env4.play(0, 0, 0);

But it sounds with the same volume. And the same thing happens if I move the "volume" to 0.5, 0.001, 0.8, etc

How could I change the volume of my synth in an efficient way?



Sign In or Register to comment.