Argument 3 of AudioParam.setTargetAtTime is not a finite floating-point value


#1

I know this is not entirely a Meteor related issue, but given I am using Meteor for this interface I thought asking for some help, assuming I fix this I can have a first beta of my project, so I am a bit desperate.

Problem: everytime I click play on my interface I get this error mentioned in the subject of this email following by distorted sound. I have this below trying to make multiple instances of synth and control them with a table which provides a JSON to control the synth instances:

"Muon-0": {…}
attack: -0.0801801801801802
decay: -1.0956666666666666
detune: 2.3065872083945247
frequency: -587.1723636363636
release: 4.321931034482758
sustain: 1.6925388888888888
__proto__: Object { … }
"Muon-1": {…}
attack: 0.1
decay: 0.2584238888888889
detune: 2.621053502702646
frequency: -562.0251818181819
release: -0.260546551724138
sustain: -1.0062055555555556

My event code is here:

'click .play': function(event, instance) {
            //something to start the synth here...
            // synthA.triggerAttackRelease(Session.get('freq'), 0.75);
            // triggerSynth();

            // clean up from last time
            for (var synth in instance.synthArray) {
              synth.dispose();
            }

            instance.synthArray = [];

            for (var element in instance.synthParameters) {
              var params = instance.synthParameters[element];
              console.log(`params4synth `, params);
              var synth = new Tone.Synth({
                    oscillator : {
                        type : 'fmsquare',
                      modulationType : 'sawtooth',
                      modulationIndex : 3,
                      harmonicity: 3.4
                  },
                  "envelope" : {
                    attack  : params["attack"] ,
                    decay  : params["decay"] ,
                    sustain  : params["sustain"] ,
                    release  : params["release"]
                  },
                  frequency: params["frequency"]
              }).toMaster();
                instance.synthArray.push(synth);
            }

            for (var s in instance.synthArray) {
              var synth = instance.synthArray[s];
                synth.triggerAttackRelease("4n", 1 / instance.synthArray.length);
            }
        },

        'click .stop': function(event, instance) {
          for (var s in instance.synthArray) {
            var synth = instance.synthArray[s];
            synth.triggerRelease();
          }
        }

This issue prevents me from having a first beta so I would be extremely grateful if I had some help on this.

Best,
K.


#2

synth.triggerAttackRelease("4n", 1 / instance.synthArray.length);

You are referencing an object (instance.synthArray), which does not have a length property, so your expression 1 / instance.synthArray.length is undefined.

You could try using 1 / Object.keys(instance.synthArray).length, which may be what you want.


#3

Hi thanks for the reply, I am still getting the same.