{"action":"created","issue":{"url":"https://api.github.com/repos/modlfo/vult/issues/20","repository_url":"https://api.github.com/repos/modlfo/vult","labels_url":"https://api.github.com/repos/modlfo/vult/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/modlfo/vult/issues/20/comments","events_url":"https://api.github.com/repos/modlfo/vult/issues/20/events","html_url":"https://github.com/modlfo/vult/issues/20","id":235062097,"number":20,"title":"Range of output samples, [-1, 1] or [0, 1]","user":{"login":"cristiano-belloni","id":315834,"avatar_url":"https://avatars1.githubusercontent.com/u/315834?v=3","gravatar_id":"","url":"https://api.github.com/users/cristiano-belloni","html_url":"https://github.com/cristiano-belloni","followers_url":"https://api.github.com/users/cristiano-belloni/followers","following_url":"https://api.github.com/users/cristiano-belloni/following{/other_user}","gists_url":"https://api.github.com/users/cristiano-belloni/gists{/gist_id}","starred_url":"https://api.github.com/users/cristiano-belloni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristiano-belloni/subscriptions","organizations_url":"https://api.github.com/users/cristiano-belloni/orgs","repos_url":"https://api.github.com/users/cristiano-belloni/repos","events_url":"https://api.github.com/users/cristiano-belloni/events{/privacy}","received_events_url":"https://api.github.com/users/cristiano-belloni/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-06-11T12:22:57Z","updated_at":"2017-06-11T15:34:10Z","closed_at":"2017-06-11T15:34:10Z","body":"Sorry, this is silly, but I didn't find the answer anywhere in the docs.\r\nI'm trying to write a simple waveshaper, like in [here](https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperNode/curve) - I adapted the code to not use a waveshaping table (creating a 44k samples table kills the vult compiler, LMK if you want me to open an issue about that): \r\n\r\n```\r\nfun distortMdn(x: real) {\r\n    val k = 20.;\r\n    val n_samples = 44100.;\r\n    val deg = 3.14159265358979323846 / 180.0;\r\n    val out = ( 3. + k ) * x * 20. * deg / (3.14159265358979323846 + k * abs(x));\r\n    return out;\r\n}\r\n```\r\n\r\nIt does almost nothing to my output, no matter how high the `k` is. The transfer function is [like this](https://www.wolframalpha.com/input/?i=y+%3D+(+3+%2B+20)+*+x+*+20+*+(3.14159265358979323846+%2F+180)+%2F+(3.14159265358979323846+%2B+20+*+abs(x))).\r\n\r\nI'm wondering if this could be due to the range of samples in vult being from 0 to 1 instead of -1 to 1? I couldn't find any reference to what the output range is."},"comment":{"url":"https://api.github.com/repos/modlfo/vult/issues/comments/307637041","html_url":"https://github.com/modlfo/vult/issues/20#issuecomment-307637041","issue_url":"https://api.github.com/repos/modlfo/vult/issues/20","id":307637041,"user":{"login":"cristiano-belloni","id":315834,"avatar_url":"https://avatars1.githubusercontent.com/u/315834?v=3","gravatar_id":"","url":"https://api.github.com/users/cristiano-belloni","html_url":"https://github.com/cristiano-belloni","followers_url":"https://api.github.com/users/cristiano-belloni/followers","following_url":"https://api.github.com/users/cristiano-belloni/following{/other_user}","gists_url":"https://api.github.com/users/cristiano-belloni/gists{/gist_id}","starred_url":"https://api.github.com/users/cristiano-belloni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristiano-belloni/subscriptions","organizations_url":"https://api.github.com/users/cristiano-belloni/orgs","repos_url":"https://api.github.com/users/cristiano-belloni/repos","events_url":"https://api.github.com/users/cristiano-belloni/events{/privacy}","received_events_url":"https://api.github.com/users/cristiano-belloni/received_events","type":"User","site_admin":false},"created_at":"2017-06-11T15:34:10Z","updated_at":"2017-06-11T15:34:10Z","body":"Yep, `saturate` was what triggered https://github.com/modlfo/vult/issues/18 :)\r\nClipping with gain helps a bit, but the sound is still different and underwhelming. I will investigate. Thanks! "}}
{"actor":{"display_login":"cristiano-belloni"}}