{"action":"created","issue":{"url":"https://api.github.com/repos/Tonejs/Tone.js/issues/300","repository_url":"https://api.github.com/repos/Tonejs/Tone.js","labels_url":"https://api.github.com/repos/Tonejs/Tone.js/issues/300/labels{/name}","comments_url":"https://api.github.com/repos/Tonejs/Tone.js/issues/300/comments","events_url":"https://api.github.com/repos/Tonejs/Tone.js/issues/300/events","html_url":"https://github.com/Tonejs/Tone.js/issues/300","id":294800553,"number":300,"title":"set not working as expected when passing args programatically ","user":{"login":"KonVas","id":6897992,"avatar_url":"https://avatars1.githubusercontent.com/u/6897992?v=4","gravatar_id":"","url":"https://api.github.com/users/KonVas","html_url":"https://github.com/KonVas","followers_url":"https://api.github.com/users/KonVas/followers","following_url":"https://api.github.com/users/KonVas/following{/other_user}","gists_url":"https://api.github.com/users/KonVas/gists{/gist_id}","starred_url":"https://api.github.com/users/KonVas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KonVas/subscriptions","organizations_url":"https://api.github.com/users/KonVas/orgs","repos_url":"https://api.github.com/users/KonVas/repos","events_url":"https://api.github.com/users/KonVas/events{/privacy}","received_events_url":"https://api.github.com/users/KonVas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-06T15:27:36Z","updated_at":"2018-02-06T15:54:27Z","closed_at":null,"author_association":"NONE","body":"Trying to pass par (string) won't work, but when I change par with \"attack\" it will work. However, when checking with typeof par it returns string. Trying to control other parameters will work only with detune. Par is coming from a table-matrix with headers as exact label for each parameter. \r\n![screen shot 2018-02-06 at 18 33 25](https://user-images.githubusercontent.com/6897992/35867965-44bd1244-0b6c-11e8-8613-4e78e0a10b73.png)\r\n\r\n```\r\n'click #matrix-input': function(event, template){\r\n            var selected = template.findAll(\"input[type=checkbox]:checked\");\r\n            var par = $(event.target).attr('class');\r\n            var fieldValue = event.target.value;\r\n            if(par !== \"\"){\r\n                polySynth.set({ //control of envelope properties.\r\n                    \"envelope\" : {\r\n\t\t                    par : specs[par](fieldValue)\r\n\t                  }\r\n                });\r\n                polySynth.set(par, specs[par](Number(fieldValue))); //control other parameters of the synth.\r\n                //console.log(par, fieldValue);\r\n            }\r\n        }\r\n```"},"comment":{"url":"https://api.github.com/repos/Tonejs/Tone.js/issues/comments/363466632","html_url":"https://github.com/Tonejs/Tone.js/issues/300#issuecomment-363466632","issue_url":"https://api.github.com/repos/Tonejs/Tone.js/issues/300","id":363466632,"user":{"login":"Idicious","id":7814026,"avatar_url":"https://avatars2.githubusercontent.com/u/7814026?v=4","gravatar_id":"","url":"https://api.github.com/users/Idicious","html_url":"https://github.com/Idicious","followers_url":"https://api.github.com/users/Idicious/followers","following_url":"https://api.github.com/users/Idicious/following{/other_user}","gists_url":"https://api.github.com/users/Idicious/gists{/gist_id}","starred_url":"https://api.github.com/users/Idicious/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Idicious/subscriptions","organizations_url":"https://api.github.com/users/Idicious/orgs","repos_url":"https://api.github.com/users/Idicious/repos","events_url":"https://api.github.com/users/Idicious/events{/privacy}","received_events_url":"https://api.github.com/users/Idicious/received_events","type":"User","site_admin":false},"created_at":"2018-02-06T15:54:27Z","updated_at":"2018-02-06T15:54:27Z","author_association":"CONTRIBUTOR","body":"```\r\npolySynth.set({ //control of envelope properties.\r\n                    \"envelope\" : {\r\n\t\t                    par : specs[par](fieldValue)\r\n\t                  }\r\n                });\r\n```\r\n\r\nThis will not set the key of the object to the value in par, the key will be 'par'. This is because of how javascript works btw, it's not a Tone.js specific thing. In order to use the value of par as key you have to do the following:\r\n\r\n```\r\nfunction(event, template){\r\n    var selected = template.findAll(\"input[type=checkbox]:checked\");\r\n    var par = $(event.target).attr('class');\r\n    var fieldValue = event.target.value;\r\n    if(par !== \"\") {\r\n        var envelope = {};\r\n        envelope[par] = specs[par](fieldValue);\r\n        polySynth.set({ //control of envelope properties.\r\n            \"envelope\": envelope\r\n        });\r\n        polySynth.set(par, specs[par](Number(fieldValue))); //control other parameters of the synth.\r\n        //console.log(par, fieldValue);\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"Idicious"}}