diff --git a/404.html b/404.html index dedb94d..36d7bf3 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@ Page Not Found | Mercury - + diff --git a/assets/js/89be51a8.6e2b4c60.js b/assets/js/89be51a8.6e2b4c60.js new file mode 100644 index 0000000..8e3a48e --- /dev/null +++ b/assets/js/89be51a8.6e2b4c60.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkmercury_docs=self.webpackChunkmercury_docs||[]).push([[716],{659:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>l,default:()=>h,frontMatter:()=>t,metadata:()=>o,toc:()=>d});var i=s(4848),r=s(8453);const t={sidebar_position:1},l="Actions",o={id:"reference/actions",title:"Actions",description:"The action keywords are used to start a line of Mercury code with. Only lines starting with these keywords are valid. The keywords are: new, list, set, print and silence.",source:"@site/docs/reference/actions.md",sourceDirName:"reference",slug:"/reference/actions",permalink:"/mercury-docs/docs/reference/actions",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Syntax Overview",permalink:"/mercury-docs/docs/reference/syntax"},next:{title:"Global Settings",permalink:"/mercury-docs/docs/reference/global"}},c={},d=[{value:"new",id:"new",level:2},{value:"list",id:"list",level:2},{value:"set",id:"set",level:2},{value:"print",id:"print",level:2},{value:"silence",id:"silence",level:2}];function a(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"actions",children:"Actions"}),"\n",(0,i.jsxs)(n.p,{children:["The action keywords are used to start a line of Mercury code with. Only lines starting with these keywords are valid. The keywords are: ",(0,i.jsx)(n.code,{children:"new"}),", ",(0,i.jsx)(n.code,{children:"list"}),", ",(0,i.jsx)(n.code,{children:"set"}),", ",(0,i.jsx)(n.code,{children:"print"})," and ",(0,i.jsx)(n.code,{children:"silence"}),"."]}),"\n",(0,i.jsx)(n.h2,{id:"new",children:"new"}),"\n",(0,i.jsxs)(n.p,{children:["Create a new instance of an instrument object. For example this can be a ",(0,i.jsx)(n.code,{children:"sample"}),", ",(0,i.jsx)(n.code,{children:"synth"}),", ",(0,i.jsx)(n.code,{children:"loop"}),", ",(0,i.jsx)(n.code,{children:"polySynth"})," or ",(0,i.jsx)(n.code,{children:"midi"})," object, followed by the name of the sample, the name of the waveshape to use for the synth, the or the midi device name (See ",(0,i.jsx)(n.a,{href:"instruments",children:"Instrument Functions"})," for more details). Use instrument methods to set parameters for that object on the same line."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Instrument"})," -> the instrument type (eg. sample, synth, loop, polySynth, midi, modulator)","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Source"})," -> selected sample or synth source (based on loaded files)","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Functions+"})," -> instrument functions seperated by spaces (optional)"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'new synth saw shape(20 500)\n\nnew sample kick_909 time(1/8)\n\nnew midi "AU DLS Synth 1" note(3 1)\n'})}),"\n",(0,i.jsx)(n.p,{children:"By default Mercury has a small library of samples included in the environment. It is possible to include your own sounds as well:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/mercury-docs/docs/usage/mercury4max-overview#sounds",children:"Load sounds in Mercury4Max"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/mercury-docs/docs/usage/playground-overview#add-sounds",children:"Load sounds in MercuryPlayground"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/mercury-docs/docs/usage/sounds",children:"Full list of all the included sounds"})}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"list",children:"list"}),"\n",(0,i.jsxs)(n.p,{children:["Create a list, which is sometimes called a ",(0,i.jsx)(n.code,{children:"circular array"})," or ",(0,i.jsx)(n.code,{children:"ring"}),". This list can contain many types of items such as whole numbers (integers), decimal numbers (floats), names, strings, fractions and other rings (2-dimensional). Use these to change parameters over time for instruments. The ",(0,i.jsx)(n.code,{children:"list"})," must be declared with a ",(0,i.jsx)(n.code,{children:"name"})," before it can be used as a variable in an instrument function. Read more about all the algorithmic functions available for generating and transforming lists under ",(0,i.jsx)(n.a,{href:"list-functions",children:"List Functions"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> list ",(0,i.jsx)(n.code,{children:"name"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Values"})," -> one or more values between brackets ",(0,i.jsx)(n.code,{children:"[ ]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Function"})," -> a ",(0,i.jsx)(n.code,{children:"list-function"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list someValues [ 0 1.618 21 3.14 ]\n\nlist someSounds [ kick_909 hat_909 snare_909 hat_909 ]\n\nlist fromFunction random(20 0 100)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["Use clear descriptive variable names for lists to keep your code readable for yourself and for anyone you share it with. For example a list with a rhythm for a hihat can be called ",(0,i.jsx)(n.code,{children:"hatBeat"}),", and a list with a melodic phrase for a verse could be named ",(0,i.jsx)(n.code,{children:"verseNotes"}),". Using names that are also functions is not advised (eg. ",(0,i.jsx)(n.code,{children:"gain"}),", ",(0,i.jsx)(n.code,{children:"shape"}),", ",(0,i.jsx)(n.code,{children:"random"})," etc.)"]})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["Some variable names are not allowed because they are part of the reserved names for datastructures. These are: ",(0,i.jsx)(n.code,{children:"bang, int, float, mode, zlclear, zlmaxsize, new, list, set, print"}),"."]})}),"\n",(0,i.jsxs)(n.admonition,{type:"note",children:[(0,i.jsxs)(n.mdxAdmonitionTitle,{children:["Deprecated: ",(0,i.jsx)(n.code,{children:"ring"})]}),(0,i.jsxs)(n.p,{children:["In earlier versions this was called a ",(0,i.jsx)(n.code,{children:"ring"})," because it refers to a ",(0,i.jsx)(n.em,{children:"circular array"}),", however ",(0,i.jsx)(n.code,{children:"list"})," is more accessible when learning programming."]})]}),"\n",(0,i.jsx)(n.h2,{id:"set",children:"set"}),"\n",(0,i.jsxs)(n.p,{children:["Use the set action to change global settings in the environment or append instrument-functions for an instance of an instrument via ",(0,i.jsx)(n.code,{children:"name"}),", ",(0,i.jsx)(n.code,{children:"group-name"})," or ",(0,i.jsx)(n.code,{children:"all"}),". The instrument must be declared with a ",(0,i.jsx)(n.code,{children:"name()"})," or ",(0,i.jsx)(n.code,{children:"group()"})," before ",(0,i.jsx)(n.code,{children:"set"})," is called."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> parameter or instrument name to set with value or function","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Value"})," -> value to apply to the setting"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Function"})," -> instrument-function to apply"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set tempo 125\n\nnew synth saw name(bass)\n set bass time(1/16)\n\nnew sample kick_909 group(drums)\nnew sample snare_909 group(drums)\n set drums fx(drive)\n\n set all fx(reverb)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["The 4-spaces indent with ",(0,i.jsx)(n.code,{children:"tab"})," in the example above is not mandatory but can help to keep your code readable"]})}),"\n",(0,i.jsx)(n.h2,{id:"print",children:"print"}),"\n",(0,i.jsxs)(n.p,{children:["Use the print action to view the content of a ",(0,i.jsx)(n.code,{children:"list"})," or the result of a ",(0,i.jsx)(n.code,{children:"list-function"}),". The result is printed in the console window."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list rnd random(12)\nlist sin spread(10 0 100)\n\nprint rnd\nprint sin\n"})}),"\n",(0,i.jsx)(n.h2,{id:"silence",children:"silence"}),"\n",(0,i.jsxs)(n.p,{children:["Use silence to disable all sounds. Alternatively you can hit the ",(0,i.jsx)(n.code,{children:"Alt/Ctrl + ."})," shortkey to disable everything."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"silence\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["In a performance situation this code is usually not desirable to use. Instead use ",(0,i.jsx)(n.code,{children:"gain(0)"})," to (temporarily) pause instruments or use ",(0,i.jsx)(n.code,{children:"//"})," to comment instruments and disable them."]})}),"\n",(0,i.jsxs)(n.admonition,{type:"note",children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"Deprecated:"})," ",(0,i.jsx)(n.code,{children:"killAll"})]}),(0,i.jsxs)(n.p,{children:["In earlier versions this was named ",(0,i.jsx)(n.code,{children:"killAll"}),", but: ",(0,i.jsx)(n.strong,{children:"make love, not war \u270c\ufe0f\u262e\ufe0f\u270c\ufe0f"})]})]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>l,x:()=>o});var i=s(6540);const r={},t=i.createContext(r);function l(e){const n=i.useContext(t);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),i.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/89be51a8.856e73aa.js b/assets/js/89be51a8.856e73aa.js deleted file mode 100644 index 8e265a0..0000000 --- a/assets/js/89be51a8.856e73aa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkmercury_docs=self.webpackChunkmercury_docs||[]).push([[716],{659:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>l,default:()=>h,frontMatter:()=>t,metadata:()=>o,toc:()=>d});var i=s(4848),r=s(8453);const t={sidebar_position:1},l="Actions",o={id:"reference/actions",title:"Actions",description:"The action keywords are used to start a line of Mercury code with. Only lines starting with these keywords are valid. The keywords are: new, list, set, print and silence.",source:"@site/docs/reference/actions.md",sourceDirName:"reference",slug:"/reference/actions",permalink:"/mercury-docs/docs/reference/actions",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"Syntax Overview",permalink:"/mercury-docs/docs/reference/syntax"},next:{title:"Global Settings",permalink:"/mercury-docs/docs/reference/global"}},c={},d=[{value:"new",id:"new",level:2},{value:"list",id:"list",level:2},{value:"set",id:"set",level:2},{value:"print",id:"print",level:2},{value:"silence",id:"silence",level:2}];function a(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"actions",children:"Actions"}),"\n",(0,i.jsxs)(n.p,{children:["The action keywords are used to start a line of Mercury code with. Only lines starting with these keywords are valid. The keywords are: ",(0,i.jsx)(n.code,{children:"new"}),", ",(0,i.jsx)(n.code,{children:"list"}),", ",(0,i.jsx)(n.code,{children:"set"}),", ",(0,i.jsx)(n.code,{children:"print"})," and ",(0,i.jsx)(n.code,{children:"silence"}),"."]}),"\n",(0,i.jsx)(n.h2,{id:"new",children:"new"}),"\n",(0,i.jsxs)(n.p,{children:["Create a new instance of an instrument object. For example this can be a ",(0,i.jsx)(n.code,{children:"sample"}),", ",(0,i.jsx)(n.code,{children:"synth"}),", ",(0,i.jsx)(n.code,{children:"loop"}),", ",(0,i.jsx)(n.code,{children:"polySynth"})," or ",(0,i.jsx)(n.code,{children:"midi"})," object, followed by the name of the sample, the name of the waveshape to use for the synth, the or the midi device name (See ",(0,i.jsx)(n.a,{href:"instruments",children:"Instrument Functions"})," for more details). Use instrument methods to set parameters for that object on the same line."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Instrument"})," -> the instrument type (eg. sample, synth, loop, polySynth, midi, modulator)","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Source"})," -> selected sample or synth source (based on loaded files)","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Functions+"})," -> instrument functions seperated by spaces (optional)"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'new synth saw shape(20 500)\n\nnew sample kick_909 time(1/8)\n\nnew midi "AU DLS Synth 1" note(3 1)\n'})}),"\n",(0,i.jsx)(n.p,{children:"By default Mercury has a small library of samples included in the environment. It is possible to include your own sounds as well:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/mercury-docs/docs/usage/mercury4max-overview#sounds",children:"Load sounds in Mercury4Max"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/mercury-docs/docs/usage/playground-overview#add-sounds",children:"Load sounds in MercuryPlayground"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/mercury-docs/docs/usage/sounds",children:"Full list of all the included sounds"})}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"list",children:"list"}),"\n",(0,i.jsxs)(n.p,{children:["Create a list, which is sometimes called a ",(0,i.jsx)(n.code,{children:"circular array"})," or ",(0,i.jsx)(n.code,{children:"ring"}),". This list can contain many types of items such as whole numbers (integers), decimal numbers (floats), names, strings, fractions and other rings (2-dimensional). Use these to change parameters over time for instruments. The ",(0,i.jsx)(n.code,{children:"list"})," must be declared with a ",(0,i.jsx)(n.code,{children:"name"})," before it can be used as a variable in an instrument function. Read more about all the algorithmic functions available for generating and transforming lists under ",(0,i.jsx)(n.a,{href:"list-functions",children:"List Functions"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> list ",(0,i.jsx)(n.code,{children:"name"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Values"})," -> one or more values between brackets ",(0,i.jsx)(n.code,{children:"[ ]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Function"})," -> a ",(0,i.jsx)(n.code,{children:"list-function"})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list someValues [ 0 1.618 21 3.14 ]\n\nlist someSounds [ kick_909 hat_909 snare_909 hat_909 ]\n\nlist fromFunction random(20 0 100)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["Use clear descriptive variable names for lists to keep your code readable for yourself and for anyone you share it with. For example a list with a rhythm for a hihat can be called ",(0,i.jsx)(n.code,{children:"hatBeat"}),", and a list with a melodic phrase for a verse could be named ",(0,i.jsx)(n.code,{children:"verseNotes"}),". Using names that are also functions is not advised (eg. ",(0,i.jsx)(n.code,{children:"gain"}),", ",(0,i.jsx)(n.code,{children:"shape"}),", ",(0,i.jsx)(n.code,{children:"random"})," etc.)"]})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["Some variable names are not allowed because they are part of the reserved names for datastructures. These are: ",(0,i.jsx)(n.code,{children:"bang, int, float, mode, zlclear, zlmaxsize, new, list, set, print"}),"."]})}),"\n",(0,i.jsxs)(n.admonition,{type:"note",children:[(0,i.jsxs)(n.mdxAdmonitionTitle,{children:["Deprecated: ",(0,i.jsx)(n.code,{children:"ring"})]}),(0,i.jsxs)(n.p,{children:["In earlier versions this was called a ",(0,i.jsx)(n.code,{children:"ring"})," because it refers to a ",(0,i.jsx)(n.em,{children:"circular array"}),", however ",(0,i.jsx)(n.code,{children:"list"})," is more accessible when learning programming."]})]}),"\n",(0,i.jsx)(n.h2,{id:"set",children:"set"}),"\n",(0,i.jsxs)(n.p,{children:["Use the set action to change global settings in the environment or append instrument-functions for an instance of an instrument via ",(0,i.jsx)(n.code,{children:"name"}),", ",(0,i.jsx)(n.code,{children:"group-name"})," or ",(0,i.jsx)(n.code,{children:"all"}),". The instrument must be declared with a ",(0,i.jsx)(n.code,{children:"name()"})," or ",(0,i.jsx)(n.code,{children:"group()"})," before ",(0,i.jsx)(n.code,{children:"set"})," is called."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> parameter or instrument name to set with value or function","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Value"})," -> value to apply to the setting"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Function"})," -> instrument-function to apply"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set tempo 125\n\nnew synth saw name(bass)\n set bass time(1/16)\n\nnew sample kick_909 group(drums)\nnew sample snare_909 group(drums)\n set drums fx(drive)\n\n set all fx(reverb)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["The 4-spaces indent with ",(0,i.jsx)(n.code,{children:"tab"})," in the example above is not mandatory but can help to keep your code readable"]})}),"\n",(0,i.jsx)(n.h2,{id:"print",children:"print"}),"\n",(0,i.jsxs)(n.p,{children:["Use the print action to view the content of a ",(0,i.jsx)(n.code,{children:"list"})," or the result of a ",(0,i.jsx)(n.code,{children:"list-function"}),". The result is printed in the console window."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list rnd random(12)\nlist sin spread(10 0 100)\n\nprint rnd\nprint sin\n"})}),"\n",(0,i.jsx)(n.h2,{id:"silence",children:"silence"}),"\n",(0,i.jsxs)(n.p,{children:["Use silence to disable all sounds. Alternatively you can hit the ",(0,i.jsx)(n.code,{children:"Alt/Ctrl + ."})," shortkey to disable everything."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"silence\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"tip",children:(0,i.jsxs)(n.p,{children:["In a performance situation this code is usually not desirable to use. Instead use ",(0,i.jsx)(n.code,{children:"gain(0)"})," to (temporarily) pause instruments or use ",(0,i.jsx)(n.code,{children:"//"})," to comment instruments and disable them."]})}),"\n",(0,i.jsxs)(n.admonition,{type:"note",children:[(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"Deprecated:"})," ",(0,i.jsx)(n.code,{children:"killAll"})]}),(0,i.jsxs)(n.p,{children:["In earlier versions this was named ",(0,i.jsx)(n.code,{children:"killAll"}),", but: ",(0,i.jsx)(n.strong,{children:"make love, not war \u270c\ufe0f\u262e\ufe0f\u270c\ufe0f"})]})]})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>l,x:()=>o});var i=s(6540);const r={},t=i.createContext(r);function l(e){const n=i.useContext(t);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),i.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/bbca2b71.54380d68.js b/assets/js/bbca2b71.bfbc1ab2.js similarity index 50% rename from assets/js/bbca2b71.54380d68.js rename to assets/js/bbca2b71.bfbc1ab2.js index 91246cf..2fa2f9d 100644 --- a/assets/js/bbca2b71.54380d68.js +++ b/assets/js/bbca2b71.bfbc1ab2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmercury_docs=self.webpackChunkmercury_docs||[]).push([[664],{9030:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>a,contentTitle:()=>l,default:()=>h,frontMatter:()=>r,metadata:()=>d,toc:()=>o});var i=s(4848),t=s(8453);const r={sidebar_position:3},l="Instrument Functions",d={id:"reference/instruments",title:"Instrument Functions",description:"An instrument is the main sound or sequencing source in Mercury. Instruments can produce sounds natively in Mercury by means of synthesis or sampling, but can also send out MIDI or OSC-messages to trigger external devices or plugins, and are able to take input from for example your microphone. The following functions apply to all the types of instruments such as synth, sample, loop, polySynth, polySample, midi and input.",source:"@site/docs/reference/instruments.md",sourceDirName:"reference",slug:"/reference/instruments",permalink:"/mercury-docs/docs/reference/instruments",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Global Settings",permalink:"/mercury-docs/docs/reference/global"},next:{title:"Instrument Effects",permalink:"/mercury-docs/docs/reference/effects"}},a={},o=[{value:"All Instruments",id:"all-instruments",level:2},{value:"name",id:"name",level:3},{value:"group",id:"group",level:3},{value:"time",id:"time",level:3},{value:"once",id:"once",level:3},{value:"play",id:"play",level:3},{value:"shape",id:"shape",level:3},{value:"gain",id:"gain",level:3},{value:"pan",id:"pan",level:3},{value:"effect",id:"effect",level:3},{value:"ratchet",id:"ratchet",level:3},{value:"timediv",id:"timediv",level:3},{value:"warp",id:"warp",level:3},{value:"wait",id:"wait",level:3},{value:"synth",id:"synth",level:2},{value:"note",id:"note",level:3},{value:"slide",id:"slide",level:3},{value:"super",id:"super",level:3},{value:"wave2",id:"wave2",level:3},{value:"sub",id:"sub",level:3},{value:"noise",id:"noise",level:3},{value:"sample",id:"sample",level:2},{value:"speed",id:"speed",level:3},{value:"start",id:"start",level:3},{value:"note",id:"note-1",level:3},{value:"tune",id:"tune",level:3},{value:"stretch",id:"stretch",level:3},{value:"loop",id:"loop",level:2},{value:"polySynth",id:"polysynth",level:2},{value:"steal",id:"steal",level:3},{value:"spread",id:"spread",level:3},{value:"voices",id:"voices",level:3},{value:"polySample",id:"polysample",level:2},{value:"midi",id:"midi",level:2},{value:"note",id:"note-2",level:3},{value:"length",id:"length",level:3},{value:"channel",id:"channel",level:3},{value:"chord",id:"chord",level:3},{value:"program",id:"program",level:3},{value:"change",id:"change",level:3},{value:"sync",id:"sync",level:3},{value:"input",id:"input",level:2},{value:"osc",id:"osc",level:2},{value:"modulator",id:"modulator",level:2},{value:"name",id:"name-1",level:3},{value:"time",id:"time-1",level:3},{value:"range",id:"range",level:3},{value:"out",id:"out",level:3},{value:"trigger",id:"trigger",level:3},{value:"hold",id:"hold",level:3},{value:"emitter",id:"emitter",level:2},{value:"osc",id:"osc-1",level:3},{value:"name",id:"name-2",level:3},{value:"address",id:"address",level:3},{value:"sendOSC",id:"sendosc",level:3},{value:"receiving",id:"receiving",level:3}];function c(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"instrument-functions",children:"Instrument Functions"}),"\n",(0,i.jsxs)(n.p,{children:["An instrument is the main sound or sequencing source in Mercury. Instruments can produce sounds natively in Mercury by means of synthesis or sampling, but can also send out MIDI or OSC-messages to trigger external devices or plugins, and are able to take input from for example your microphone. The following functions apply to all the types of instruments such as ",(0,i.jsx)(n.code,{children:"synth"}),", ",(0,i.jsx)(n.code,{children:"sample"}),", ",(0,i.jsx)(n.code,{children:"loop"}),", ",(0,i.jsx)(n.code,{children:"polySynth"}),", ",(0,i.jsx)(n.code,{children:"polySample"}),", ",(0,i.jsx)(n.code,{children:"midi"})," and ",(0,i.jsx)(n.code,{children:"input"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["For detailed explanation of the syntax see: ",(0,i.jsx)(n.a,{href:"syntax",children:"Syntax"})," and ",(0,i.jsx)(n.a,{href:"actions#list",children:(0,i.jsx)(n.code,{children:"list"})})," under ",(0,i.jsx)(n.a,{href:"actions",children:"Actions"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Available instruments:"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#synth",children:(0,i.jsx)(n.code,{children:"synth"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#sample",children:(0,i.jsx)(n.code,{children:"sample"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#loop",children:(0,i.jsx)(n.code,{children:"loop"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#polysynth",children:(0,i.jsx)(n.code,{children:"polySynth"})})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"#polysample",children:(0,i.jsx)(n.code,{children:"polySample"})})," ",(0,i.jsx)(n.em,{children:"MercuryPlayground only"})]}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#input",children:(0,i.jsx)(n.code,{children:"input"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#midi",children:(0,i.jsx)(n.code,{children:"midi"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#osc",children:(0,i.jsx)(n.code,{children:"osc"})})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"#modulator",children:(0,i.jsx)(n.code,{children:"modulator"})})," ",(0,i.jsx)(n.em,{children:"Mercury4Max only"})]}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#emitter",children:(0,i.jsx)(n.code,{children:"emitter"})})}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"all-instruments",children:"All Instruments"}),"\n",(0,i.jsx)(n.p,{children:"The following functions apply to all instruments."}),"\n",(0,i.jsx)(n.h3,{id:"name",children:"name"}),"\n",(0,i.jsxs)(n.p,{children:["Set the ",(0,i.jsx)(n.code,{children:"name"})," for this instrument. This can be any string of 3 or more characters. The ",(0,i.jsx)(n.code,{children:"name"})," is used as a reference to the instrument when the ",(0,i.jsx)(n.code,{children:"set"})," action is used to call functions for a specific instrument. The name is also used to generate an OSC-message that is send out from Mercury to trigger external things in sync with the instrument."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> an instrument name (default=random character string)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw name(bob)\n set bob gain(0.8) time(1/16)\n\nnew sample kick_909 name(alice)\n set alice gain(1.2) time(1/4)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="expected osc messages:"',children:"/bob 1\n/alice 1\n"})}),"\n",(0,i.jsx)(n.h3,{id:"group",children:"group"}),"\n",(0,i.jsx)(n.admonition,{title:"Currently (and hopefully temporarily) not working",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Set one or more ",(0,i.jsx)(n.code,{children:"group-name"}),"(s) for this instrument. This can be any string of 3 or more characters. With the ",(0,i.jsx)(n.code,{children:"group"})," you can apply a line of code to multiple instruments at the same time. The ",(0,i.jsx)(n.code,{children:"group"})," is ",(0,i.jsx)(n.strong,{children:"not"})," like a mixing bus, so using for example ",(0,i.jsx)(n.code,{children:"gain()"})," will overwrite the ",(0,i.jsx)(n.code,{children:"gain()"})," function on the line of the instrument. If you use the ",(0,i.jsx)(n.code,{children:"name()"})," function you have to make sure the name is set before the group is applied otherwise the reference won't work correctly."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> a group name used for multiple instruments (default=none)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// the hihat is not included in the group so will \n// not get the gain(0.8) and fx(reverb 0.9 11)\nnew sample hat_909 time(1/8)\n\nnew sample kick_909 group(drums) time(1/4)\nnew sample snare_909 group(drums) time(1/2 1/4)\n set drums gain(0.8) fx(reverb 0.9 11)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"time",children:"time"}),"\n",(0,i.jsxs)(n.p,{children:["Set the time interval at which the internal clock for an instrument runs and the synth or sample is triggered. This can be an ",(0,i.jsx)(n.code,{children:"integer"}),", ",(0,i.jsx)(n.code,{children:"float"})," or ",(0,i.jsx)(n.code,{children:"fraction"}),". ",(0,i.jsx)(n.code,{children:"1"})," = 1measure, ",(0,i.jsx)(n.code,{children:"1/4"})," = quarter-note, ",(0,i.jsx)(n.code,{children:"1/12"})," = 8th triplet, ",(0,i.jsx)(n.code,{children:"3/16"})," = 3-16th notes, etc. Similarly you can set an offset in the timing. The ",(0,i.jsx)(n.code,{children:"time()"})," will start an internal counter for this instrument, incremented every time it is triggerd (based on the ",(0,i.jsx)(n.code,{children:"play()"})," function). The counter is used as an index to lookup values from other ",(0,i.jsx)(n.code,{children:"list"})," provided as argument in functions for this instrument."]}),"\n",(0,i.jsxs)(n.p,{children:["Setting the first argument to ",(0,i.jsx)(n.code,{children:"free"})," allows the use of external triggering via OSC-messages. The trigger reacts when a value greater than ",(0,i.jsx)(n.code,{children:"0"})," is received. When another instrument in the code has a ",(0,i.jsx)(n.code,{children:"name()"}),", that name can be used as OSC-message trigger for another instrument to synchronize them."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number/Fraction"})," -> the timing fraction or ",(0,i.jsx)(n.code,{children:"free"})," (default=1/4)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number/Fraction"})," -> timing offset or osc-message when ",(0,i.jsx)(n.code,{children:"free"})," (optional, default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set tempo 130\n\nnew sample kick_909 time(1/4)\nnew synth saw time(1/2 3/16)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="external trigger"',children:"new sample snare_dnb time(free '/snareOSC/amplitude')\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="triggering from other instrument"',children:"new sample kick_909 time(3/16) name(kick)\nnew synth saw time(free '/kick')\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.mdxAdmonitionTitle,{children:["You can not (yet) use ",(0,i.jsx)(n.code,{children:"list"}),"s to modulate the ",(0,i.jsx)(n.code,{children:"time()"})," parameters"]})}),"\n",(0,i.jsx)(n.h3,{id:"once",children:"once"}),"\n",(0,i.jsxs)(n.p,{children:["With once you can disable the looping mode of an instrument being triggered for every ",(0,i.jsx)(n.code,{children:"time()"})," interval. When the code is evaluated the instrument will only trigger ",(0,i.jsx)(n.code,{children:"1"})," time and stop after that. It will always trigger once every time the code is evaluated, so if you like the instrument to not play anymore after that you can either set ",(0,i.jsx)(n.code,{children:"gain(0)"})," or comment ",(0,i.jsx)(n.code,{children:"//"})," it."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> enable triggering the instrument once (default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample gong_lo time(2/1) once(on)\n// a sample for reference in time\nnew sample tabla_hi time(1/4)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="trigger once on a bar multiple of 2 with offset of 7/8"',children:"new sample harp_down once(on) time(2/1 7/8)\n// a sample for reference in time\nnew sample hat_808 time(1/4)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"play",children:"play"}),"\n",(0,i.jsxs)(n.p,{children:["Provide the play function with a ",(0,i.jsx)(n.code,{children:"list"})," containing 1's and 0's. For every time interval defined by the ",(0,i.jsx)(n.code,{children:"time()"})," function, the next value in the list is checked. A one results in a trigger of the instrument and an increment of the internal counter. A zero results in no trigger. An optional second argument resets the internal instrument index after a certain amount of time in ",(0,i.jsx)(n.code,{children:"fraction"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> a rhythmic pattern of ones and zeroes to play (default=1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number/Fraction"})," -> reset internal time() counter after specified time (optional, default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list hatBeat [1 0 0 1 0 1 1 0 0]\n\nnew sample hat_909 time(1/16) play(hatBeat)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alternatively you can use floating-point values in a list which result in a probability that the instrument will play. Here 0 means 0% chance, 1=100% and 0.5 is 50%. Inspired by Nick Collins paper on ",(0,i.jsx)(n.a,{href:"https://www.dmu.ac.uk/documents/technology-documents/research/mtirc/nowalls/mww-collins.pdf",children:"Algorithmic Composition Methods for Breakbeat Science"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="using probabilities"',children:"list hatBeat [1 0.5 0.2 0.8 0.5]\n\nnew sample hat_909 time(1/16) play(hatBeat 2)\nnew sample kick_909 time(1/4)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"beat()"})]}),"\n",(0,i.jsx)(n.h3,{id:"shape",children:"shape"}),"\n",(0,i.jsxs)(n.p,{children:["Set the shape generator of a sound (in synthesis also called envelope). The shape is the trajectory of volume over time on the sound (eg. fade-in, fade-out). Various modes are possible depending on the amount of arguments. The attack time is the fade-in for the sound, the release is the fade-out for the sound, both in milliseconds or ",(0,i.jsx)(n.code,{children:"fraction"}),". The sustain time holds the sound at a static volume for a while. If the sound is triggered before the end of the envelope, the envelope is canceled, faded to 0 in 1ms and retriggered (in the case of monophonic instruments). You can specify the times in absolute values using integer/floating points (in ms) or in relative values using beat fractions."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)/Fraction(List)"})," -> Attack time in ms or fraction (optional, default=2)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)/Fraction(List)"})," -> Decay time in ms or fraction (optional, default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)/Fraction(List)"})," -> Release time in ms or fraction"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw shape(1500)\n// default attack of 2 ms, sustain of 0 ms and a release of 1500 ms\n\nnew synth saw shape(1000 250)\n// attack of 1000 ms, default sustain of 0 ms and a release of 250 ms\n\nnew synth saw shape(10 500 50)\n// attack of 10 ms, sustain of 500 ms and a release of 50 ms\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="shape with fractions"',children:"set tempo 100\n\nnew synth saw shape(1/2)\n// default release of 1/2 (about 250 ms at 120 bpm)\n\nnew synth saw shape(1/4 1/32)\n\nnew synth saw shape(1/64 1/8 1/16)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="modulate duration with a list"',children:"list durs [50 200 500]\nnew synth saw shape(durs)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"length()"}),", ",(0,i.jsx)(n.code,{children:"envelope()"})]}),"\n",(0,i.jsx)(n.h3,{id:"gain",children:"gain"}),"\n",(0,i.jsxs)(n.p,{children:["Set the volume for the instrument in floating-point amplitude. Where ",(0,i.jsx)(n.code,{children:"1"})," is the default amplitude of the sample or synth, ",(0,i.jsx)(n.code,{children:"0.5"})," is the half louder (-6 dB) and ",(0,i.jsx)(n.code,{children:"2"})," is twice as loud (+ 6dB). An optional second argument sets the sliding time to go to the next gain value in milliseconds or ",(0,i.jsx)(n.code,{children:"fraction"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> the (start) volume of the instrument (default=1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)"})," -> the sliding time in fraction or ms (optional, default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> mute the instrument but still use named sends (default=0) ",(0,i.jsx)(n.em,{children:"Mercury4Max only"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample snare_909 gain(0.8)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="modulate gain with a list"',children:"list gains [0 0.5 0.2 0.9]\nnew synth saw gain(gains 500) time(1/1)\n// ramps between gain values over 500ms every trigger 1/1\n"})}),"\n",(0,i.jsx)(n.admonition,{title:"Important for midi",type:"info",children:(0,i.jsxs)(n.p,{children:["When using the ",(0,i.jsx)(n.code,{children:"midi"})," instrument the gain will be multiplied by ",(0,i.jsx)(n.code,{children:"127"})," to create a velocity message. ",(0,i.jsx)(n.code,{children:"gain(0.5)"})," therefore maps to ",(0,i.jsx)(n.code,{children:"63"})," and ",(0,i.jsx)(n.code,{children:"gain(1)"})," to ",(0,i.jsx)(n.code,{children:"127"})]})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"amp()"}),", ",(0,i.jsx)(n.code,{children:"volume()"}),", ",(0,i.jsx)(n.code,{children:"velocity()"})]}),"\n",(0,i.jsx)(n.h3,{id:"pan",children:"pan"}),"\n",(0,i.jsxs)(n.p,{children:["Set the panning position in floating-point for the sound in the stereo-image. ",(0,i.jsx)(n.code,{children:"-1"})," is 100% left channel, ",(0,i.jsx)(n.code,{children:"0"})," is center (both speakers), ",(0,i.jsx)(n.code,{children:"1"})," is 100% right channel. Higher or lower values wrap between ",(0,i.jsx)(n.code,{children:"-1"})," and ",(0,i.jsx)(n.code,{children:"1"}),". Provide pan with the ",(0,i.jsx)(n.code,{children:"random"})," argument to get a new random panning value every trigger of the instrument."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float"})," -> the panning position between -1 and 1 (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw pan(-1)\nnew synth square pan(1)\n// two synths hard-panned left and right\n\nnew sample clap_909 pan(random) time(1/8)\n// random panning every trigger\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="modulate panning with a list',children:"list positions [-1 0 1 0 1 -1 -1]\nnew sample hat_808 time(1/16) pan(positions)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"panning()"})]}),"\n",(0,i.jsx)(n.admonition,{title:"Multi-speaker output is not (yet) supported",type:"note"}),"\n",(0,i.jsx)(n.h3,{id:"effect",children:"effect"}),"\n",(0,i.jsxs)(n.p,{children:["Add an effect to the sound of the instrument to manipulate the sounds timbre in different ways. The first argument is always the ",(0,i.jsx)(n.code,{children:"effect-name"}),". The arguments that follow depend on the selected effect. ",(0,i.jsx)(n.code,{children:"fx()"})," can be used as an alias to reduce some typing. See ",(0,i.jsx)(n.a,{href:"/mercury-docs/docs/reference/effects",children:"Effects"})," for more details and an up-to-date list of all the available effects for both ",(0,i.jsx)(n.em,{children:"Mercury4Max"})," and the ",(0,i.jsx)(n.em,{children:"MercuryPlayground"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> the effect name"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Value+/List+"})," -> values or lists depending on effectname arguments order (optional)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth square effect(distort) effect(reverb)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"fx()"}),", "]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"static vs. dynamic effect-chains"})}),"\n",(0,i.jsxs)(n.p,{children:["The Mercury4Max version has a static effects-chain. This means the order in the effects under the hood is fixed. The order is documented under ",(0,i.jsx)(n.a,{href:"/mercury-docs/docs/reference/effects",children:"Effects"}),". Because of this there is:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"No option to change the order of effects with the code"}),"\n",(0,i.jsx)(n.li,{children:"No option to use effects multiple times in one instrument"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="static fx-chain"',children:"new synth saw fx(reverb) fx(filter low 2000) fx(distort) fx(filter low 300)\n// filter and distortion are fixed before reverb in the chain, the order of \n// the code doesn't matter. There is only one filter in the chain, the first \n// filter is therefore overwritten by the other\n"})}),"\n",(0,i.jsx)(n.p,{children:"The MercuryPlayground version has a dynamic effects-chain. This means the order in the effects is determined by how you type the code. Because of this there is:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Decide the order of effects by the order of the code you type"}),"\n",(0,i.jsx)(n.li,{children:"Use effects multiple times on one instrument"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="dynamic fx-chain"',children:"new synth saw fx(reverb) fx(filter low 2000) fx(distort) fx(filter low 300)\n// the reverb will be filtered, then distorted and then filtered again\n// the resulting sound is filtered twice\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:["There are differences in sound between the ",(0,i.jsx)(n.em,{children:"Mercury4Max"})," and ",(0,i.jsx)(n.em,{children:"MercuryPlayground"})," versions. Parameters may need some tweaking when you port from one environment to the other."]})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["Not all effects from ",(0,i.jsx)(n.em,{children:"Mercury4Max"})," are available in the ",(0,i.jsx)(n.em,{children:"MercuryPlayground"})," because some are in the process of being ported, and some are sadly not as easy to implement with Web Audio."]})}),"\n",(0,i.jsx)(n.h3,{id:"ratchet",children:"ratchet"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsx)(n.p,{children:"Add a ratcheting effect (doubling/tripling/quadrupling of hits) with a probability. A technique that introduces some variety in rhythm that originated with electronic music from groups such as Tangerine Dream. The first argument sets the probability a note will be repeated. The second argument sets the amount of repetitions within the time, effectively doubling, tripling or more."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+"})," -> probability of ratchet happening (default=0.1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+/IntList+"})," -> amount of repetitions (default=2)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample hat_909 time(1/8) ratchet(0.3 2)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="using a ratchet list"',children:"list rtc [2 3 2 4 8]\nnew sample hat_909 time(1/4) ratchet(1 rtc)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"timediv",children:"timediv"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercuryplayground only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Add subdivisions to ",(0,i.jsx)(n.code,{children:"time()"}),". Documentation to do..."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list div [1 2 3 4]\nnew sample hat_808 time(1/4) timediv(div)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"warp",children:"warp"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Warp ",(0,i.jsx)(n.code,{children:"time()"})," in a more complex way. Documentation to do..."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list warp [1 2 3 4]\nnew sample hat_808 time(1/1) warp(warp)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"wait",children:"wait"}),"\n",(0,i.jsx)(n.admonition,{title:"MercuryPlayground only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["This function is similar to the offset parameter in the ",(0,i.jsx)(n.code,{children:"time()"})," function except that it allows you to set an additional waiting time (or delay) for an instrument in milliseconds. This function is useful to align/synchronize instruments with external peripherals such as sending MIDI notes or OSC messages."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+/Fraction"})," -> specify the waiting time in milliseconds or fraction (default=null)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample kick_909 time(1/4)\n// the hihat plays 100ms later than the kick\nnew sample hat_909 time(1/4) wait(100)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"synth",children:"synth"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"synth"})," and ",(0,i.jsx)(n.code,{children:"polySynth"})," instruments allow you to play synthesized sounds using a single cycle waveform. These waveforms are loaded in memory and can be accessed by their filename (without the extension). The default waveforms are ",(0,i.jsx)(n.code,{children:"sine"}),", ",(0,i.jsx)(n.code,{children:"triangle"}),", ",(0,i.jsx)(n.code,{children:"square"})," and ",(0,i.jsx)(n.code,{children:"saw"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth \n"})}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsxs)(n.p,{children:["The waveforms in MercuryPlayground are currently not created with single-cycle soundfiles but via WebAudio's ",(0,i.jsx)(n.code,{children:"PeriodicWave"}),", constructing a waveform from a Fourier Series."]})}),"\n",(0,i.jsx)(n.h3,{id:"note",children:"note"}),"\n",(0,i.jsx)(n.p,{children:"Set the pitch for the instrument to play a note in a melody or chord. The note is specified as a 2-dimensional coordinate system, where the first argument is the semitone offset (positive or negative) and the second argument is the octave offset (positive or negative)."}),"\n",(0,i.jsxs)(n.p,{children:["The origin of the system, ",(0,i.jsx)(n.code,{children:"note(0 0)"}),", corresponds by default with midi-pitch ",(0,i.jsx)(n.code,{children:"36"})," or ",(0,i.jsx)(n.code,{children:"C2"}),". Depending on the ",(0,i.jsx)(n.code,{children:"set scale"})," the coordinate system will shift and result in a different pitch for the origin. A ",(0,i.jsx)(n.code,{children:"note()"})," should therefore not be taken as an absolute value, but rather a relative direction where the melody is going to in relation to the scale and root."]}),"\n",(0,i.jsxs)(n.p,{children:["Detuning/pitchbending can be done by providing a ",(0,i.jsx)(n.code,{children:"float"})," note number. The value behind the decimal point is the amount of detuning from one semitone to the next. For example ",(0,i.jsx)(n.code,{children:"7.5"})," results in ",(0,i.jsx)(n.code,{children:"7"})," semitones (and mapped to ",(0,i.jsx)(n.code,{children:"scale"})," if used) and then a ",(0,i.jsx)(n.code,{children:"0.5"})," semitone is added (= 50 cents). Detuning is applied after mapping the integer semitone to a scale."]}),"\n",(0,i.jsxs)(n.p,{children:["The mapping of the notes is as follows with ",(0,i.jsx)(n.code,{children:"set scale chromatic c"})," (default)"]}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"note(x y)"})}),(0,i.jsx)(n.th,{children:"..."}),(0,i.jsx)(n.th,{children:"-1"}),(0,i.jsx)(n.th,{children:"0"}),(0,i.jsx)(n.th,{children:"1"}),(0,i.jsx)(n.th,{children:"2"}),(0,i.jsx)(n.th,{children:"3"}),(0,i.jsx)(n.th,{children:"4"}),(0,i.jsx)(n.th,{children:"..."}),(0,i.jsx)(n.th,{children:"9"}),(0,i.jsx)(n.th,{children:"10"}),(0,i.jsx)(n.th,{children:"11"}),(0,i.jsx)(n.th,{children:"12"}),(0,i.jsx)(n.th,{children:"13"}),(0,i.jsx)(n.th,{children:"..."})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"3"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"72"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"84"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"2"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"60"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"72"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"1"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"48"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"60"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"0"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"36"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"48"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"-1"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"24"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"36"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]})]})]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number(List)"})," -> positive or negative semitone note value or list, x-coordinate (default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number(List)"})," -> positive or negative octave value or list, y-coordinate (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set scale major d\nnew synth sine note(2 2)\n//=> results in midi-note 64 > F4\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="play a melody with lists"',children:"set scale minor A\n\nlist mel [0 5 7 3 2 -2 0]\nlist oct [0 1 2]\nnew synth sine note(mel oct) time(1/16)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"slide",children:"slide"}),"\n",(0,i.jsxs)(n.p,{children:["A portamento/sliding/gliding effect. This will make the synthesizers' oscillator slowly slide from the current frequency to the new played one over a defined period of ",(0,i.jsx)(n.code,{children:"number"})," in milliseconds or ",(0,i.jsx)(n.code,{children:"fraction"}),". The sliding is logarithmically (meaning it will slide from midi-note to midi-note linearly, but after conversion to frequency slides logarithmically. This sounds slightly different from sliding linearly between frequencies)."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+/Fraction(List)"})," -> sliding time in milliseconds or fraction (default=50)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes [0 7 3]\nnew synth saw note(notes 1) time(1/2) slide(1/8)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"glide()"}),", ",(0,i.jsx)(n.code,{children:"portamento()"})]}),"\n",(0,i.jsx)(n.h3,{id:"super",children:"super"}),"\n",(0,i.jsxs)(n.p,{children:["Add multiple oscillators in unison with a detuning factor to create a ",(0,i.jsx)(n.em,{children:"SuperSaw"})," effect. One oscillator will always be the base frequency of the ",(0,i.jsx)(n.code,{children:"note()"}),", the others are tuned above and below in incremental steps based on the detuning factor. The first argument sets the amount of oscillators (minum of 1, default=1), the second argument sets the detuning factor in semi-tones, the third optional argument sets the oscillator type for the odd numbered oscillators."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+(List)"})," -> number of oscillators (default=1, maximum=64)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> detuning factor in semi-tone, 12=octave"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> the name of the odd numbered oscillators (optional, default=main oscillator) ",(0,i.jsx)(n.em,{children:"Mercury4Max only"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw super(5 0.031415)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw super(11 0.0618 square) \n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="modulate detuning with a list"',children:"list voices [3 5 9 21]\nlist detune [0.1 0.5 0.9 12.01 0.3]\n\nnew synth saw time(1/4) shape(-1) super(voices detune)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"unison()"})]}),"\n",(0,i.jsx)(n.h3,{id:"wave2",children:"wave2"}),"\n",(0,i.jsx)(n.admonition,{title:"REMOVED",type:"warning",children:(0,i.jsxs)(n.p,{children:["use ",(0,i.jsx)(n.a,{href:"#super",children:"super()"})," instead"]})}),"\n",(0,i.jsx)(n.h3,{id:"sub",children:"sub"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Add a second sinewave oscillator to the synth. The oscillator is tuned one octave lower than the ",(0,i.jsx)(n.code,{children:"note()"})," played to create a sub frequency."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> amplitude for the sub oscillator (default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth sine note(5 1) sub(0.8)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"noise",children:"noise"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Add a noise oscillator to the synth sound. The first argument is the ",(0,i.jsx)(n.em,{children:"amplitude"})," (gain), the second argument is the ",(0,i.jsx)(n.em,{children:'"color"'})," of the noise between 0 and 1 (1 = white noise, lower values give a more darker/downsampled noise sound). When the modulation mode is turned on (with 1) the noise is modulated by the source of the oscillator (or oscillators if ",(0,i.jsx)(n.code,{children:"super()"})," and ",(0,i.jsx)(n.code,{children:"sub()"})," are used)."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> amplitude of the noise (default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> color of the noise 0-1 (default=0.8)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool(List)"})," -> modulation mode (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw note(0 1) noise(0.3 0.8 1)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"sample",children:"sample"}),"\n",(0,i.jsx)(n.p,{children:'The sample instrument allows you to play sound-recordings and loops. These so called "samples" are loaded in memory and can be accessed by their filename (without the extension).'}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample \n"})}),"\n",(0,i.jsx)(n.h3,{id:"speed",children:"speed"}),"\n",(0,i.jsxs)(n.p,{children:["Set the playback speed for the sample, where 1 = original speed, 0.5 = half the speed and 2 = twice as fast. Adjusting the playback speed will change the pitch of the sample. A negative value will play the sample backwards starting at the end (or at the ",(0,i.jsx)(n.code,{children:"start()"})," position)"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float(List)"})," -> playback speed (default=1)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample choir time(5) speed(0.5)\nnew sample choir time(5) speed(-0.3)\n\nset all fx(reverb 2 17)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"rate()"})]}),"\n",(0,i.jsx)(n.admonition,{title:"Reversed speed is not supported (yet) in the MercuryPlayground",type:"warning"}),"\n",(0,i.jsx)(n.h3,{id:"start",children:"start"}),"\n",(0,i.jsxs)(n.p,{children:["Set the start position (the offset position of the playback) of the sample. 0 = start at the beginning, 0.5 = start midway in the sample. With long decaying samples the offset is very useful if playing the sounds backwards when using for example ",(0,i.jsx)(n.code,{children:"speed(-1)"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> the playback position between 0 and 1 (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list positions randomFloat(8 0 0.5)\n\nnew sample choir time(1/16) start(positions)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"offset()"})]}),"\n",(0,i.jsx)(n.h3,{id:"note-1",children:"note"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"note"})," function allows you to tune the sample to a specific pitch. This is easier than trying to set the playback speed with the ",(0,i.jsx)(n.code,{children:"speed()"})," function if you need to pitch the sample for melodic content. The function works the same as the ",(0,i.jsx)(n.code,{children:"note"})," function explained under the ",(0,i.jsx)(n.code,{children:"synth"}),". Please see ",(0,i.jsx)(n.a,{href:"#note",children:(0,i.jsx)(n.code,{children:"note()"})})," for further information."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes [0 7 5 3]\nnew sample xylo_c4 time(1/8) note(notes 1)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"tune",children:"tune"}),"\n",(0,i.jsxs)(n.p,{children:["Set the base note midi value for the sample to determine how the ",(0,i.jsx)(n.code,{children:"note()"})," function changes the playback speed in relation to this note. For example if your sample was recorded as an ",(0,i.jsx)(n.code,{children:"a4"})," then you will set tune to ",(0,i.jsx)(n.code,{children:"69"})," (midi value of ",(0,i.jsx)(n.code,{children:"a4"}),"). ",(0,i.jsx)(n.code,{children:"note(0 2)"})," is the same as the ",(0,i.jsx)(n.code,{children:"tune()"})," value in the case of a scale set to have ",(0,i.jsx)(n.code,{children:"c"})," as the root."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+"})," -> midi pitch as base for tuning (optional, default=60)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set scale minor c\n\nlist notes [0 7 5 3]\n// tune the kalimba to a3\nnew sample kalimba_a time(1/4) note(notes 2) tune(57)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"stretch",children:"stretch"}),"\n",(0,i.jsxs)(n.p,{children:["Stretch the entire sample to the length of a full bar. Useful for when working with beats that have to be looped. Stretching is the default when working with the ",(0,i.jsx)(n.code,{children:"loop"})," instrument. This is the same as a ",(0,i.jsx)(n.code,{children:"new sample stretch(1)"}),". Optionally you can turn timestretching on with a second argument to preserve the original pitch of the sample. A third optional argument changes the mode of the stretching, choose from: basic, monophonic, rhythmic, general, extremestretch, efficient. The default is set to ",(0,i.jsx)(n.code,{children:"efficient"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> turn stretch to full bar on/off (default=0 for sample default=1 for loop)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> turn timestretching on when stretching to full bar, preservering the original pitch (default = 0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> adjust the stretching mode (default=efficient)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample chimes stretch(1 1 general) speed(-1)\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.p,{children:["If your ",(0,i.jsx)(n.code,{children:"loop"})," is longer than ",(0,i.jsx)(n.code,{children:"1"})," bar use ",(0,i.jsx)(n.code,{children:"speed()"})," to decrease the playback speed by ",(0,i.jsx)(n.code,{children:"1 / n-bars"}),". Set ",(0,i.jsx)(n.code,{children:"time()"})," to the bar amounts."]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new loop loopOfFourBars time(4/1) speed(0.25)\n"})})]}),"\n",(0,i.jsx)(n.admonition,{title:"Timestretching is only supported in Mercury4Max",type:"warning"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Stretching modes explained"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"basic"})," : best option for real-time performance"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"monophonic"})," : best option for any monophonic source without ambience"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"rhythmic"})," : best option for drums and percussion when transient preservation is critical"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"general"})," : balances spectral integrity with transient preservaton"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"extremestretch"})," : optimized for stretching (slowing down) material, limited to a stretch factor between 0.5 and 4"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"effcient"})," : best option when CPU efficiency is critical"]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"loop",children:"loop"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"loop"})," instrument is basically the ",(0,i.jsx)(n.code,{children:"sample"})," instrument but with ",(0,i.jsx)(n.code,{children:"stretch(1)"})," enabled by default, making all the loaded samples stretch to 1 full bar. For all available ",(0,i.jsx)(n.code,{children:"instrument-functions"})," of ",(0,i.jsx)(n.code,{children:"loop"})," see ",(0,i.jsx)(n.a,{href:"#sample",children:(0,i.jsx)(n.code,{children:"sample"})})," above."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new loop \n"})}),"\n",(0,i.jsx)(n.h2,{id:"polysynth",children:"polySynth"}),"\n",(0,i.jsxs)(n.p,{children:["The polySynth functions the same as the ",(0,i.jsx)(n.code,{children:"synth"})," instrument in the sense that you choose a waveform, apply a ",(0,i.jsx)(n.code,{children:"note()"}),", add a ",(0,i.jsx)(n.code,{children:"shape()"}),", etc. For explanation of those functions see ",(0,i.jsx)(n.a,{href:"#synth",children:(0,i.jsx)(n.code,{children:"synth"})}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The extra feature of the polySynth is that it allows for overlapping notes to generate chords. Notes provided to the ",(0,i.jsx)(n.code,{children:"note()"})," function as a 2-dimensional list will be played on the same time as a chord. By default there are 8 voices available at the same time. Voice stealing is ",(0,i.jsx)(n.code,{children:"on"}),' by default meaning that if a new note is played while all voices are busy the "oldest" triggered note will be removed.']}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new polySynth note([ [chord1] [chord2] ... [chord-n] ])\n"})}),"\n",(0,i.jsx)(n.p,{children:"You can think of a 2D list like so:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list chords [ [ 0 3 7 ] [ 2 5 9 ] [ 3 6 10 13 ] ]\n\nlist chords [ 0 2 3 ]\n 3 5 6 \n 7 9 10\n 13 \n"})}),"\n",(0,i.jsxs)(n.p,{children:["So the list ",(0,i.jsx)(n.code,{children:"chords"})," has ",(0,i.jsx)(n.code,{children:"3"}),' "items", and those ',(0,i.jsx)(n.code,{children:"3"})," items again contain a ",(0,i.jsx)(n.code,{children:"list"})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list chords [ [ 0 3 7 ] [ 2 5 9 ] [ 3 6 10 13 ] ]\n\nnew polySynth sine note(chord 2) time(1/2) shape(1 1/4) \n"})}),"\n",(0,i.jsx)(n.h3,{id:"steal",children:"steal"}),"\n",(0,i.jsxs)(n.p,{children:["With steal you can choose the behaviour of what happens when new notes are triggered while all voices are in use. When steal is ",(0,i.jsx)(n.code,{children:"on"})," (the default) every new note will be triggered and old notes will be overwritten by the new ones. If steal is ",(0,i.jsx)(n.code,{children:"off"})," new notes are not triggered while all voices are busy. You'll have to wait till some voice is done playing, based on the ",(0,i.jsx)(n.code,{children:"shape()"})," before a note can be triggered again."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool/Name"})," -> turn voice stealing ",(0,i.jsx)(n.code,{children:"on"})," or ",(0,i.jsx)(n.code,{children:"off"})," (optional, default=on)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes spread(16 0 36)\n\nnew polySynth sine note(notes 2) time(1/16) shape(1 1/1) steal(off)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["If you use ",(0,i.jsx)(n.code,{children:"steal(off)"})," but also set ",(0,i.jsx)(n.code,{children:"shape(off)"})," you won't be able to trigger any new notes after all voices are filled because there is no shape to stop any voice from sounding."]})}),"\n",(0,i.jsx)(n.h3,{id:"spread",children:"spread"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsx)(n.p,{children:"Use the spread function to add little delays with optional randomness between every note in a chord, resulting in the chord to sound broken up in time (spread out)."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+/Fraction(List)"})," -> the delaytime between note triggers in ms or fraction (default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+/Fraction(List)"})," -> random delaytime offset added to the delaytime in ms or fraction (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes [ [0 3 7 11 12] ]\n\nnew polySynth sine note(notes 2) shape(1 1/1) time(1/1) spread(150 50)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"voices",children:"voices"}),"\n",(0,i.jsx)(n.admonition,{title:"not (yet) supported",type:"warning"}),"\n",(0,i.jsx)(n.h2,{id:"polysample",children:"polySample"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury Playground only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["The polySample functions the same as the ",(0,i.jsx)(n.code,{children:"sample"})," in the sense that you choose a sample file, set a ",(0,i.jsx)(n.code,{children:"speed()"}),", add a ",(0,i.jsx)(n.code,{children:"shape()"}),", etc. For explanation of those functions see ",(0,i.jsx)(n.a,{href:"#sample",children:(0,i.jsx)(n.code,{children:"sample"})}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The extra feature of the polySample is that it allows for overlapping sounds. For example useful when generating chords. Notes provided to the ",(0,i.jsx)(n.code,{children:"note()"})," function as a 2-dimensional list will be played at the same time as a chord. By default there are 8 voices available at the same time."]}),"\n",(0,i.jsxs)(n.p,{children:["For explanation of using ",(0,i.jsx)(n.code,{children:"2D-list"}),"'s in ",(0,i.jsx)(n.code,{children:"note()"})," for polyphony see ",(0,i.jsx)(n.a,{href:"#polysynth",children:(0,i.jsx)(n.code,{children:"polySynth"})})," voice-stealing see ",(0,i.jsx)(n.a,{href:"#steal",children:(0,i.jsx)(n.code,{children:"steal"})})," under ",(0,i.jsx)(n.code,{children:"polySynth"}),". For setting voice-amount see ",(0,i.jsx)(n.a,{href:"#voices",children:(0,i.jsx)(n.code,{children:"voices"})}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set tempo 100\nset scale dorian eb\n\nlist notes shuffle(spread(24))\nnew polySample piano_e time(1/16) note(notes 1) shape(1 1/2) steal(off) tune(64)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"midi",children:"midi"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"midi"})," instrument allows you to send MIDI messages (notes, pitchbend, controlchange, programchange) to other external devices or virtual devices in your computer. The ",(0,i.jsx)(n.code,{children:""})," is the literal name as a ",(0,i.jsx)(n.code,{children:"string"})," of the device as it shows up when connected to the computer. For example this can be something like ",(0,i.jsx)(n.code,{children:'"My MIDI Device"'}),". You can also choose ",(0,i.jsx)(n.code,{children:"default"})," to set the instrument to the first midi device in the list. The name is written as a ",(0,i.jsx)(n.code,{children:"string"})," between ",(0,i.jsx)(n.code,{children:'" "'})," and is sensitive to upper and lower cases. To setup a basic midi instrument use:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new midi \n"})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> ",(0,i.jsx)(n.code,{children:"default"})," or MIDI Device name as a ",(0,i.jsx)(n.code,{children:"string"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Functions ",(0,i.jsx)(n.code,{children:"note()"}),", ",(0,i.jsx)(n.code,{children:"time()"}),", ",(0,i.jsx)(n.code,{children:"name()"}),", ",(0,i.jsx)(n.code,{children:"group()"}),", ",(0,i.jsx)(n.code,{children:"once()"}),", ",(0,i.jsx)(n.code,{children:"play()"}),", ",(0,i.jsx)(n.code,{children:"ratchet()"}),", ",(0,i.jsx)(n.code,{children:"timediv()"}),", ",(0,i.jsx)(n.code,{children:"warp()"}),", ",(0,i.jsx)(n.code,{children:"wait()"})," all work the same for the ",(0,i.jsx)(n.code,{children:"midi"})," instrument. There are some differences when using the ",(0,i.jsx)(n.code,{children:"shape()"})," and ",(0,i.jsx)(n.code,{children:"gain()"})," functions."]}),"\n",(0,i.jsx)(n.h3,{id:"note-2",children:"note"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"note"})," function allows you to play a midinote. The function works the same as the ",(0,i.jsx)(n.code,{children:"note"})," function explained under the ",(0,i.jsx)(n.code,{children:"synth"}),". Please see ",(0,i.jsx)(n.a,{href:"#note",children:(0,i.jsx)(n.code,{children:"note()"})})," for further information."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set scale major D\n\nlist notes [0 7 5 3]\n\nnew midi default note(notes 2)\n// plays the midi notes 62 69 67 64\n"})}),"\n",(0,i.jsx)(n.h3,{id:"length",children:"length"}),"\n",(0,i.jsxs)(n.p,{children:["Replaces the ",(0,i.jsx)(n.code,{children:"shape()"})," function of ",(0,i.jsx)(n.code,{children:"synth"})," and ",(0,i.jsx)(n.code,{children:"sample"}),". Set the duration of the midi-note. This means it will send a ",(0,i.jsx)(n.code,{children:"note-off"})," message after a ",(0,i.jsx)(n.code,{children:"number"})," of milliseconds or ",(0,i.jsx)(n.code,{children:"fraction"}),". If the instrument is triggered before the end of the duration, the note-off is canceled and a new note-off is scheduled."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number/Fraction(List)"})," -> Duration time in ms or fraction"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new midi default length(1500) time(1)\n"})}),"\n",(0,i.jsx)(n.p,{children:"with fraction:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new midi default length(1/2) time(1)\n//=> duration of 1/2 (1200 ms at 100 bpm)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"duration()"}),", ",(0,i.jsx)(n.code,{children:"shape()"})]}),"\n",(0,i.jsx)(n.h3,{id:"channel",children:"channel"}),"\n",(0,i.jsxs)(n.p,{children:["Set the midi-channel output for the midi-note to be send to. ",(0,i.jsx)(n.code,{children:"out()"})," can be used as an alias to reduce some typing."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)"})," -> Channel to send the midi-note to"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new midi default note(7 2) channel(1)\nnew midi default note(0 0) channel(2)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"out()"})]}),"\n",(0,i.jsx)(n.h3,{id:"chord",children:"chord"}),"\n",(0,i.jsxs)(n.p,{children:["By default the ",(0,i.jsx)(n.code,{children:"midi"})," instrument's output is monophonic. You can turn the chord output (polyphony) on for a midi instrument with this function. This allows you to use ",(0,i.jsx)(n.code,{children:"2D-list"}),"s where the 2nd dimension is used to generate chords. Read more about chords under ",(0,i.jsx)(n.a,{href:"#polySynth",children:(0,i.jsx)(n.code,{children:"polySynth"})}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> Turn chord output on/off"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list chords [[0 4 7] [2 5 9] [5 9 0]]\n\nnew midi default note(chords 1) chord(on)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"program",children:"program"}),"\n",(0,i.jsxs)(n.p,{children:["Send program change messages to the specified midi-channel of the instrument. The channel number is based on the ",(0,i.jsx)(n.code,{children:"out()"})," function (see ",(0,i.jsx)(n.a,{href:"#channel",children:(0,i.jsx)(n.code,{children:"channel"})}),"). The default channel ",(0,i.jsx)(n.code,{children:"1"})," is used if no channel is selected. The program change value is zero-based, an integer from ",(0,i.jsx)(n.code,{children:"0"})," - ",(0,i.jsx)(n.code,{children:"127"})," and can be sequenced as a list. If no value is provided there is no program change send. The value is ",(0,i.jsx)(n.strong,{children:"only"})," send when it changes based on the previous value. This is done because some midi devices react every time a program change is received (for example cutting of notes), even if the value stays the same."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+(List)"})," -> Program change value 0-127 (default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes spread(5 0 12)\nlist changes [0 10 20]\n\nnew midi default note(notes 1) out(1) program(changes)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"pgm()"})]}),"\n",(0,i.jsx)(n.h3,{id:"change",children:"change"}),"\n",(0,i.jsxs)(n.p,{children:["Send control change (CC) messages to the midi device. This function replaces the ",(0,i.jsx)(n.code,{children:"effect()"})," function of an instrument and can have multiple calls in the same instrument, every call can be a different control number. The first argument is the ",(0,i.jsx)(n.code,{children:"number"})," for the control, the second argument is the ",(0,i.jsx)(n.code,{children:"number"})," for the controller value or a list of controller values. You can use ",(0,i.jsx)(n.code,{children:"cc()"})," as an alias to reduce typing."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+"})," -> controller number between 0-127"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+(List)"})," -> controller value between 0-127"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list ccValues [10 20 30 40 50]\n\nnew midi default time(1/8) change(13 100) change(21 ccValues)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"cc()"})]}),"\n",(0,i.jsx)(n.h3,{id:"sync",children:"sync"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsx)(n.p,{children:"Turn the midiclock syncing on/off for an individual instrument and send it to the selected port/device from that instrument."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> Turn syncing on/off"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'new midi "My Midi Device" sync(on)\nnew midi "Another Device" sync(off)\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"clock()"})]}),"\n",(0,i.jsx)(n.h2,{id:"input",children:"input"}),"\n",(0,i.jsxs)(n.p,{children:["Use the input from the soundcard (ADC, Analog Digital Converter) as the source for an instrument. The sound can be modified by all the various ",(0,i.jsx)(n.code,{children:"fx()"}),"'s. The volume can be adjusted with ",(0,i.jsx)(n.code,{children:"gain()"}),". An envelope can be applied on the sound with ",(0,i.jsx)(n.code,{children:"shape()"})," and this envelope can be triggered with ",(0,i.jsx)(n.code,{children:"time()"})," just as with the regular instruments ",(0,i.jsx)(n.code,{children:"sample"}),", ",(0,i.jsx)(n.code,{children:"synth"}),", etc. Use the words ",(0,i.jsx)(n.code,{children:"in1"}),", ",(0,i.jsx)(n.code,{children:"in2"}),", ..., ",(0,i.jsx)(n.code,{children:"inx"})," to choose the input source. Use ",(0,i.jsx)(n.code,{children:"default"})," to pick the first input in the list."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new input \n"})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> ",(0,i.jsx)(n.code,{children:"default"})," or the input channel number as a string ",(0,i.jsx)(n.code,{children:"inX"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// use the default input, in most cases channel 1\nnew input default gain(1)\n\n// use a specific channel\nnew input in3 gain(0.9) \n\n// add functions like shape, time and fx\nnew input in4 gain(0.9) time(1/16) shape(1 100) fx(reverb) fx(distort)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsx)(n.p,{children:"In the browser you will need to give permission to use the microphone. Afterwards you might need to refresh the page."})}),"\n",(0,i.jsx)(n.h2,{id:"osc",children:"osc"}),"\n",(0,i.jsx)(n.admonition,{title:"MercuryPlayground only (currently)",type:"warning",children:(0,i.jsxs)(n.p,{children:["For sending osc from Mercury4Max use ",(0,i.jsx)(n.a,{href:"#emitter",children:(0,i.jsx)(n.code,{children:"emitter"})})]})}),"\n",(0,i.jsxs)(n.p,{children:["Create an instrument that sends OSC-messages. The ",(0,i.jsx)(n.code,{children:""})," is used to set the opening address of the message to ",(0,i.jsx)(n.code,{children:"/"}),". Any arbitrary function name is used to set as second address in the osc-string. If no name is provided it will default to a unique number for every instrument instance. By adding other functions with any arbitrary name you can send a message with the address in the form of ",(0,i.jsx)(n.code,{children:"// "})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new osc \n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'list params [0.25 0.5 0.75]\nlist values [3 1]\n\nnew osc "myOSC" time(1/4) someParam(params) anotherParam(values)\n\n// sends => /myOSC/someParams 0.25\n// /myOSC/anotherParam 3\n// /myOSC/someParams 0.5\n// /myOSC/anotherParam 1\n// etc...\n'})}),"\n",(0,i.jsxs)(n.p,{children:["The messages also support multiple arguments up to a length of 256. Multiple arguments can be provided as ",(0,i.jsx)(n.code,{children:"list"}),"s, ",(0,i.jsx)(n.code,{children:"string"}),"s, ",(0,i.jsx)(n.code,{children:"float"}),"s or ",(0,i.jsx)(n.code,{children:"int"}),"s."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list val1 [0.25 0.5 0.75]\nlist val2 [3 1]\n\nnew osc myOSC time(1/4) aMessage(0.1 val1 val2 100)\n\n// emits => /myOSC/aMessage 0.1 0.25 3 100\n// /myOSC/aMessage 0.1 0.5 1 100\n// /myOSC/aMessage 0.1 0.75 3 100\n// etc...\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.p,{children:["If you want multiple ",(0,i.jsx)(n.code,{children:"osc"})," to send to the same address, you can use the same ",(0,i.jsx)(n.code,{children:""})," but use different ",(0,i.jsx)(n.code,{children:"name()"}),"s for reference in the code. Useful if you want to send messages to the same address, but with different timing-intervals."]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list params [0.25 0.5 0.75]\nlist values [3 1 4]\n\nnew osc myOSC name(osc1) time(1/4) \n set osc1 someParam(params)\n\nnew osc myOSC name(osc2) time(1/2)\n set osc2 anotherParam(values)\n"})})]}),"\n",(0,i.jsx)(n.h2,{id:"modulator",children:"modulator"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["The modulator allows you to send a modulation signal as an argument to parameters in ",(0,i.jsx)(n.code,{children:"instrument-function"}),"s of other instruments. These parameters are continuously modulated at a specific rate with a specific waveform. The modulation rate is independent from the instruments ",(0,i.jsx)(n.code,{children:"time()"})," (in comparison when using a list as an argument). It is also possible to send the modulation signal directly out to the connected soundcard on a specific DAC channel (Digital Analog Converter). This can for example be used for CV-modulations."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> modulator waveform type: ",(0,i.jsx)(n.code,{children:"sine"}),"/",(0,i.jsx)(n.code,{children:"sin"}),", ",(0,i.jsx)(n.code,{children:"sawUp"}),"/",(0,i.jsx)(n.code,{children:"phasor"}),", ",(0,i.jsx)(n.code,{children:"sawDown"}),"/",(0,i.jsx)(n.code,{children:"saw"}),", ",(0,i.jsx)(n.code,{children:"square"}),"/",(0,i.jsx)(n.code,{children:"rect"}),", ",(0,i.jsx)(n.code,{children:"triangle"}),"/",(0,i.jsx)(n.code,{children:"tri"}),", ",(0,i.jsx)(n.code,{children:"random"}),"/",(0,i.jsx)(n.code,{children:"rand"}),", ",(0,i.jsx)(n.code,{children:"randomLine"}),"/",(0,i.jsx)(n.code,{children:"randL"}),", ",(0,i.jsx)(n.code,{children:"trigger"}),"/",(0,i.jsx)(n.code,{children:"gate"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new modulator name() range( ) time() out()\n"})}),"\n",(0,i.jsx)(n.h3,{id:"name-1",children:"name"}),"\n",(0,i.jsxs)(n.p,{children:["Replaces the ",(0,i.jsx)(n.code,{children:"name()"})," function. Set the name for the modulator, this name can be used as argument in the functions of an instrument like ",(0,i.jsx)(n.code,{children:"synth"})," and ",(0,i.jsx)(n.code,{children:"sample"})]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> the modulator ",(0,i.jsx)(n.code,{children:"name"})," for reference in other functions"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// set the name to myModulator\nnew modulator sine name(myModulator)\n\n// the synth uses the modulator in the gain function\nnew synth saw gain(myModulator)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"time-1",children:"time"}),"\n",(0,i.jsxs)(n.p,{children:["Replaces the ",(0,i.jsx)(n.code,{children:"time()"})," function. Set the modulation speed as a ",(0,i.jsx)(n.code,{children:"fraction"})," or ",(0,i.jsx)(n.code,{children:"float+"}),". The default is ",(0,i.jsx)(n.code,{children:"1/1"})," (one period per bar)."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Fraction/Float+"})," -> The time interval for one period of the modulation waveform (optional, default=1/1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Fraction/Float+"})," -> The time offset for the modulation (optional, default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// modulate a sinewave at a period of one per 4 bars\nnew modulator sine time(4/1)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"range",children:"range"}),"\n",(0,i.jsxs)(n.p,{children:["Set the modulation range between a lower and upper value with an optional exponential value. The default range is ",(0,i.jsx)(n.code,{children:"0"})," to ",(0,i.jsx)(n.code,{children:"1"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number"})," -> The low output range (optional, default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number"})," -> The high output range (optional, default=1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number"})," -> The scaling exponent (optional, default=1)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// set the range from 200 to 5000, for example to modulate a filter cutoff in Hz\nnew modulator sine range(200 5000)\n\n// include the third argument to set the exponential in the scaling\nnew modulator sine range(200 5000 3)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"out",children:"out"}),"\n",(0,i.jsxs)(n.p,{children:["Set the output channel from your connected soundcard to send the modulation signal directly to. The default is 0 (no output to DAC). Currently the maximum number of channels that can be used is 16. If the modulation signal is only used for direct output it is not necessary to also ",(0,i.jsx)(n.code,{children:"name()"})," the modulator."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+"})," -> The channel number from 1 till number of outputs available, maximum of 16 (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// send a sinewave modulator signal to DAC channel 3\nnew modulator sine range(-1 1) out(3)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsx)(n.p,{children:"Be careful when sending DC signals with large ranges to your DAC, this could damage your speakers if you choose the wrong output!"})}),"\n",(0,i.jsx)(n.h3,{id:"trigger",children:"trigger"}),"\n",(0,i.jsxs)(n.p,{children:["When using the mode ",(0,i.jsx)(n.code,{children:"trigger"}),"/",(0,i.jsx)(n.code,{children:"gate"})," the modulator functions like the sequencer in the other instruments. Meaning that you can include the ",(0,i.jsx)(n.code,{children:"play()"})," function to add a rhythm list, use ",(0,i.jsx)(n.code,{children:"ratchet()"})," to add a list of timing subdivisions with probability and use ",(0,i.jsx)(n.code,{children:"warp()"})," to add a list of time warpings."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> ",(0,i.jsx)(n.code,{children:"trigger"}),"/",(0,i.jsx)(n.code,{children:"gate"})," sets the intrument to use the stepsequencer (default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// generate a euclidean rhythm and use it in the trigger\nlist rtm euclid(16 11)\nnew modulator trigger time(1/8) play(rtm) ratchet(0.1 2)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"hold",children:"hold"}),"\n",(0,i.jsxs)(n.p,{children:["The hold function transforms the ",(0,i.jsx)(n.code,{children:"trigger"})," into a gate that goes open and closes after a certain amount of time. The time value can be either ",(0,i.jsx)(n.code,{children:"ms"})," or a ",(0,i.jsx)(n.code,{children:"fraction"}),". If the hold time is longer than the time interval between triggers the gate stays open. A hold of ",(0,i.jsx)(n.code,{children:"0"})," results in the click from the default trigger."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+"})," -> hold time in ms or fraction (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// trigger every 8th note, and leave the gate open for the length of 50ms\nnew modulator trigger time(1/8) hold(50)\n\n// trigger every 8th note, and leave the gate open for the length of a 16th\nnew modulator trigger time(1/8) hold(1/16)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"emitter",children:"emitter"}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["Soon to be deprecated in Mercury4Max, then use ",(0,i.jsx)(n.a,{href:"#osc",children:(0,i.jsx)(n.code,{children:"osc"})})," instead (similar as in MercuryPlayground now)"]})}),"\n",(0,i.jsxs)(n.p,{children:["Create an emitter object. Use this object to send messages to other platforms. The emitter object works similarly to the Instruments in the sense that it also has the ",(0,i.jsx)(n.code,{children:"time"}),", ",(0,i.jsx)(n.code,{children:"beat"})," and ",(0,i.jsx)(n.code,{children:"name"})," functions by default. The ",(0,i.jsx)(n.code,{children:"time"})," determines the time-interval at which messages are send. The ",(0,i.jsx)(n.code,{children:"beat"})," can turn send moments on or off."]}),"\n",(0,i.jsx)(n.h3,{id:"osc-1",children:"osc"}),"\n",(0,i.jsxs)(n.p,{children:["Create an emitter object of type ",(0,i.jsx)(n.code,{children:"osc"}),". The ",(0,i.jsx)(n.code,{children:"name()"})," method is used to set the opening address of the message to ",(0,i.jsx)(n.code,{children:"/"}),". Any arbitrary function name is used to set as second address in the osc-string. If no name is provided it will default to a unique number for every instrument instance. By adding other functions with any arbitrary name you can send a message with the address in the form of ",(0,i.jsx)(n.code,{children:"// "})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new emitter osc name() time()\n"})}),"\n",(0,i.jsx)(n.p,{children:"example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list params [0.25 0.5 0.75]\nlist values [3 1]\n\nnew emitter osc name(myOSC) time(1/4) \n set myOSC someParam(params) anotherParam(values)\n\n// emits => /myOSC/someParams 0.25\n// /myOSC/anotherParam 3\n// /myOSC/someParams 0.5\n// /myOSC/anotherParam 1\n// /myOSC/someParams 0.75\n// /myOSC/anotherParam 3\n// /myOSC/someParams 0.25\n// etc...\n"})}),"\n",(0,i.jsx)(n.p,{children:"The messages also support multiple arguments up to a length of 256. Multiple arguments can be provided as rings, symbols, floats or integers."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list val1 [0.25 0.5 0.75]\nlist val2 [3 1]\n\nnew emitter osc name(myOSC) time(1/4)\n set myOSC aMessage(0.1 val1 val2 100)\n\n// emits => /myOSC/aMessage 0.1 0.25 3 100\n// /myOSC/aMessage 0.1 0.5 1 100\n// /myOSC/aMessage 0.1 0.75 3 100\n// /myOSC/aMessage 0.1 0.25 1 100\n// etc...\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"Note:"})," Some variable names are not allowed because they are part of the built-in names for datastructures. These are: ",(0,i.jsx)(n.code,{children:"bang, int, float, list, mode, zlclear, zlmaxsize"})]}),"\n",(0,i.jsx)(n.h3,{id:"name-2",children:"name"}),"\n",(0,i.jsxs)(n.p,{children:["Set the name for the OSC emitter. This can be any string of 2 or more characters. The ",(0,i.jsx)(n.code,{children:"name"})," is used as reference to the instrument when the ",(0,i.jsx)(n.code,{children:"set"})," method is used to call methods for a specific object. The ",(0,i.jsx)(n.code,{children:"name"})," is also prepended as first address in the osc-message of the format ",(0,i.jsx)(n.code,{children:"// argument"}),"."]}),"\n",(0,i.jsx)(n.h3,{id:"address",children:"address"}),"\n",(0,i.jsxs)(n.p,{children:["Alternatively, if you want multiple emitters to send to the same address, you can use the ",(0,i.jsx)(n.code,{children:"address()"})," method. The ",(0,i.jsx)(n.code,{children:"address"})," is prepended as first address in the osc-message in the format: ",(0,i.jsx)(n.code,{children:"/
/ argument"}),". Useful if you want to send messages to the same address, but with different timing-intervals."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list params [0.25 0.5 0.75]\nlist values [3 1 4]\n\nnew emitter osc name(osc1) address(myOSC) time(1/4) \n set osc1 someParam(params)\n\nnew emitter osc name(osc2) address(myOSC) time(1/2)\n set osc2 anotherParam(values)\n\n// emits => /myOSC/someParams 0.25\n// /myOSC/someParams 0.5\n// /myOSC/anotherParam 3\n// /myOSC/someParams 0.75\n// /myOSC/someParams 0.25\n// /myOSC/anotherParam 1\n// etc...\n"})}),"\n",(0,i.jsx)(n.h3,{id:"sendosc",children:"sendOSC"}),"\n",(0,i.jsx)(n.p,{children:"You can enable/disable sending messages with the sendOSC function"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new emitter osc name(osc3) sendOSC(0)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"receiving",children:"receiving"}),"\n",(0,i.jsxs)(n.p,{children:["You can use osc adresses as arguments for other functions by putting the address as argument in the form: ",(0,i.jsx)(n.code,{children:"/
//"}),". For example to control the ",(0,i.jsx)(n.code,{children:"gain()"})," of a ",(0,i.jsx)(n.code,{children:"sample"})," and the ",(0,i.jsx)(n.code,{children:"note()"})," value of a ",(0,i.jsx)(n.code,{children:"synth"})," enter the following:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample kick_909 time(1/4) gain(/myOSC/sliderValue1)\nnew synth saw note(/myOSC/sliderValue2) shape(1 100) time(1/8)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["It is possible to scale the incoming osc value to a different range by using ",(0,i.jsx)(n.code,{children:"{}"})," after the address inputting a low and high output range separated by a colon ",(0,i.jsx)(n.code,{children:":"}),". The scaling function considers an incoming range of ",(0,i.jsx)(n.code,{children:"0 - 1"})," floatingpoint values. For example to control the ",(0,i.jsx)(n.code,{children:"note()"})," and ",(0,i.jsx)(n.code,{children:"shape()"})," ranges in a ",(0,i.jsx)(n.code,{children:"synth"})," enter the following:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw note(/myOsc/sliderValue3{2:19} 0) shape(1 /myOsc/sliderValue4{50:500}) \n// => converts incoming slider values from 0-1 to 2-19 for note and 0-1 to 50-500 for note length\n"})})]})}function h(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>l,x:()=>d});var i=s(6540);const t={},r=i.createContext(t);function l(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:l(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkmercury_docs=self.webpackChunkmercury_docs||[]).push([[664],{9030:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>o,contentTitle:()=>l,default:()=>h,frontMatter:()=>r,metadata:()=>d,toc:()=>a});var i=s(4848),t=s(8453);const r={sidebar_position:3},l="Instrument Functions",d={id:"reference/instruments",title:"Instrument Functions",description:"An instrument is the main sound or sequencing source in Mercury. Instruments can produce sounds natively in Mercury by means of synthesis or sampling, but can also send out MIDI or OSC-messages to trigger external devices or plugins, and are able to take input from for example your microphone. The following functions apply to all the types of instruments such as synth, sample, loop, polySynth, polySample, midi and input.",source:"@site/docs/reference/instruments.md",sourceDirName:"reference",slug:"/reference/instruments",permalink:"/mercury-docs/docs/reference/instruments",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"tutorialSidebar",previous:{title:"Global Settings",permalink:"/mercury-docs/docs/reference/global"},next:{title:"Instrument Effects",permalink:"/mercury-docs/docs/reference/effects"}},o={},a=[{value:"All Instruments",id:"all-instruments",level:2},{value:"name",id:"name",level:3},{value:"group",id:"group",level:3},{value:"time",id:"time",level:3},{value:"once",id:"once",level:3},{value:"play",id:"play",level:3},{value:"shape",id:"shape",level:3},{value:"gain",id:"gain",level:3},{value:"pan",id:"pan",level:3},{value:"effect",id:"effect",level:3},{value:"ratchet",id:"ratchet",level:3},{value:"timediv",id:"timediv",level:3},{value:"warp",id:"warp",level:3},{value:"wait",id:"wait",level:3},{value:"synth",id:"synth",level:2},{value:"note",id:"note",level:3},{value:"slide",id:"slide",level:3},{value:"super",id:"super",level:3},{value:"wave2",id:"wave2",level:3},{value:"sub",id:"sub",level:3},{value:"noise",id:"noise",level:3},{value:"sample",id:"sample",level:2},{value:"speed",id:"speed",level:3},{value:"start",id:"start",level:3},{value:"note",id:"note-1",level:3},{value:"tune",id:"tune",level:3},{value:"stretch",id:"stretch",level:3},{value:"loop",id:"loop",level:2},{value:"polySynth",id:"polysynth",level:2},{value:"steal",id:"steal",level:3},{value:"spread",id:"spread",level:3},{value:"voices",id:"voices",level:3},{value:"polySample",id:"polysample",level:2},{value:"midi",id:"midi",level:2},{value:"note",id:"note-2",level:3},{value:"length",id:"length",level:3},{value:"channel",id:"channel",level:3},{value:"chord",id:"chord",level:3},{value:"program",id:"program",level:3},{value:"change",id:"change",level:3},{value:"sync",id:"sync",level:3},{value:"input",id:"input",level:2},{value:"osc",id:"osc",level:2},{value:"modulator",id:"modulator",level:2},{value:"name",id:"name-1",level:3},{value:"time",id:"time-1",level:3},{value:"range",id:"range",level:3},{value:"out",id:"out",level:3},{value:"trigger",id:"trigger",level:3},{value:"hold",id:"hold",level:3},{value:"emitter",id:"emitter",level:2},{value:"osc",id:"osc-1",level:3},{value:"name",id:"name-2",level:3},{value:"address",id:"address",level:3},{value:"sendOSC",id:"sendosc",level:3},{value:"receiving",id:"receiving",level:3}];function c(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"instrument-functions",children:"Instrument Functions"}),"\n",(0,i.jsxs)(n.p,{children:["An instrument is the main sound or sequencing source in Mercury. Instruments can produce sounds natively in Mercury by means of synthesis or sampling, but can also send out MIDI or OSC-messages to trigger external devices or plugins, and are able to take input from for example your microphone. The following functions apply to all the types of instruments such as ",(0,i.jsx)(n.code,{children:"synth"}),", ",(0,i.jsx)(n.code,{children:"sample"}),", ",(0,i.jsx)(n.code,{children:"loop"}),", ",(0,i.jsx)(n.code,{children:"polySynth"}),", ",(0,i.jsx)(n.code,{children:"polySample"}),", ",(0,i.jsx)(n.code,{children:"midi"})," and ",(0,i.jsx)(n.code,{children:"input"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["For detailed explanation of the syntax see: ",(0,i.jsx)(n.a,{href:"syntax",children:"Syntax"})," and ",(0,i.jsx)(n.a,{href:"actions#list",children:(0,i.jsx)(n.code,{children:"list"})})," under ",(0,i.jsx)(n.a,{href:"actions",children:"Actions"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Available instruments:"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#synth",children:(0,i.jsx)(n.code,{children:"synth"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#sample",children:(0,i.jsx)(n.code,{children:"sample"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#loop",children:(0,i.jsx)(n.code,{children:"loop"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#polysynth",children:(0,i.jsx)(n.code,{children:"polySynth"})})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"#polysample",children:(0,i.jsx)(n.code,{children:"polySample"})})," ",(0,i.jsx)(n.em,{children:"MercuryPlayground only"})]}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#input",children:(0,i.jsx)(n.code,{children:"input"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#midi",children:(0,i.jsx)(n.code,{children:"midi"})})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#osc",children:(0,i.jsx)(n.code,{children:"osc"})})}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"#modulator",children:(0,i.jsx)(n.code,{children:"modulator"})})," ",(0,i.jsx)(n.em,{children:"Mercury4Max only"})]}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"#emitter",children:(0,i.jsx)(n.code,{children:"emitter"})})}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"all-instruments",children:"All Instruments"}),"\n",(0,i.jsx)(n.p,{children:"The following functions apply to all instruments."}),"\n",(0,i.jsx)(n.h3,{id:"name",children:"name"}),"\n",(0,i.jsxs)(n.p,{children:["Set the ",(0,i.jsx)(n.code,{children:"name"})," for this instrument. This can be any string of 3 or more characters. The ",(0,i.jsx)(n.code,{children:"name"})," is used as a reference to the instrument when the ",(0,i.jsx)(n.code,{children:"set"})," action is used to call functions for a specific instrument. The name is also used to generate an OSC-message that is send out from Mercury to trigger external things in sync with the instrument."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> an instrument name (default=random character string)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw name(bob)\n set bob gain(0.8) time(1/16)\n\nnew sample kick_909 name(alice)\n set alice gain(1.2) time(1/4)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="expected osc messages:"',children:"/bob 1\n/alice 1\n"})}),"\n",(0,i.jsx)(n.h3,{id:"group",children:"group"}),"\n",(0,i.jsx)(n.admonition,{title:"Currently (and hopefully temporarily) not working",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Set one or more ",(0,i.jsx)(n.code,{children:"group-name"}),"(s) for this instrument. This can be any string of 3 or more characters. With the ",(0,i.jsx)(n.code,{children:"group"})," you can apply a line of code to multiple instruments at the same time. The ",(0,i.jsx)(n.code,{children:"group"})," is ",(0,i.jsx)(n.strong,{children:"not"})," like a mixing bus, so using for example ",(0,i.jsx)(n.code,{children:"gain()"})," will overwrite the ",(0,i.jsx)(n.code,{children:"gain()"})," function on the line of the instrument. If you use the ",(0,i.jsx)(n.code,{children:"name()"})," function you have to make sure the name is set before the group is applied otherwise the reference won't work correctly."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> a group name used for multiple instruments (default=none)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// the hihat is not included in the group so will \n// not get the gain(0.8) and fx(reverb 0.9 11)\nnew sample hat_909 time(1/8)\n\nnew sample kick_909 group(drums) time(1/4)\nnew sample snare_909 group(drums) time(1/2 1/4)\n set drums gain(0.8) fx(reverb 0.9 11)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"time",children:"time"}),"\n",(0,i.jsxs)(n.p,{children:["Set the time interval at which the internal clock for an instrument runs and the synth or sample is triggered. This can be an ",(0,i.jsx)(n.code,{children:"integer"}),", ",(0,i.jsx)(n.code,{children:"float"})," or ",(0,i.jsx)(n.code,{children:"fraction"}),". ",(0,i.jsx)(n.code,{children:"1"})," = 1measure, ",(0,i.jsx)(n.code,{children:"1/4"})," = quarter-note, ",(0,i.jsx)(n.code,{children:"1/12"})," = 8th triplet, ",(0,i.jsx)(n.code,{children:"3/16"})," = 3-16th notes, etc. Similarly you can set an offset in the timing. The ",(0,i.jsx)(n.code,{children:"time()"})," will start an internal counter for this instrument, incremented every time it is triggerd (based on the ",(0,i.jsx)(n.code,{children:"play()"})," function). The counter is used as an index to lookup values from other ",(0,i.jsx)(n.code,{children:"list"})," provided as argument in functions for this instrument."]}),"\n",(0,i.jsxs)(n.p,{children:["Setting the first argument to ",(0,i.jsx)(n.code,{children:"free"})," allows the use of external triggering via OSC-messages. The trigger reacts when a value greater than ",(0,i.jsx)(n.code,{children:"0"})," is received. When another instrument in the code has a ",(0,i.jsx)(n.code,{children:"name()"}),", that name can be used as OSC-message trigger for another instrument to synchronize them."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number/Fraction"})," -> the timing fraction or ",(0,i.jsx)(n.code,{children:"free"})," (default=1/4)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number/Fraction"})," -> timing offset or osc-message when ",(0,i.jsx)(n.code,{children:"free"})," (optional, default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set tempo 130\n\nnew sample kick_909 time(1/4)\nnew synth saw time(1/2 3/16)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="external trigger"',children:"new sample snare_dnb time(free '/snareOSC/amplitude')\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="triggering from other instrument"',children:"new sample kick_909 time(3/16) name(kick)\nnew synth saw time(free '/kick')\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.mdxAdmonitionTitle,{children:["You can not (yet) use ",(0,i.jsx)(n.code,{children:"list"}),"s to modulate the ",(0,i.jsx)(n.code,{children:"time()"})," parameters"]})}),"\n",(0,i.jsx)(n.h3,{id:"once",children:"once"}),"\n",(0,i.jsxs)(n.p,{children:["With once you can disable the looping mode of an instrument being triggered for every ",(0,i.jsx)(n.code,{children:"time()"})," interval. When the code is evaluated the instrument will only trigger ",(0,i.jsx)(n.code,{children:"1"})," time and stop after that. It will always trigger once every time the code is evaluated, so if you like the instrument to not play anymore after that you can either set ",(0,i.jsx)(n.code,{children:"gain(0)"})," or comment ",(0,i.jsx)(n.code,{children:"//"})," it."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> enable triggering the instrument once (default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample gong_lo time(2/1) once(on)\n// a sample for reference in time\nnew sample tabla_hi time(1/4)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="trigger once on a bar multiple of 2 with offset of 7/8"',children:"new sample harp_down once(on) time(2/1 7/8)\n// a sample for reference in time\nnew sample hat_808 time(1/4)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"play",children:"play"}),"\n",(0,i.jsxs)(n.p,{children:["Provide the play function with a ",(0,i.jsx)(n.code,{children:"list"})," containing 1's and 0's. For every time interval defined by the ",(0,i.jsx)(n.code,{children:"time()"})," function, the next value in the list is checked. A one results in a trigger of the instrument and an increment of the internal counter. A zero results in no trigger. An optional second argument resets the internal instrument index after a certain amount of time in ",(0,i.jsx)(n.code,{children:"fraction"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> a rhythmic pattern of ones and zeroes to play (default=1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number/Fraction"})," -> reset internal time() counter after specified time (optional, default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list hatBeat [1 0 0 1 0 1 1 0 0]\n\nnew sample hat_909 time(1/16) play(hatBeat)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alternatively you can use floating-point values in a list which result in a probability that the instrument will play. Here 0 means 0% chance, 1=100% and 0.5 is 50%. Inspired by Nick Collins paper on ",(0,i.jsx)(n.a,{href:"https://www.dmu.ac.uk/documents/technology-documents/research/mtirc/nowalls/mww-collins.pdf",children:"Algorithmic Composition Methods for Breakbeat Science"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="using probabilities"',children:"list hatBeat [1 0.5 0.2 0.8 0.5]\n\nnew sample hat_909 time(1/16) play(hatBeat 2)\nnew sample kick_909 time(1/4)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"beat()"})]}),"\n",(0,i.jsx)(n.h3,{id:"shape",children:"shape"}),"\n",(0,i.jsxs)(n.p,{children:["Set the shape generator of a sound (in synthesis also called envelope). The shape is the trajectory of volume over time on the sound (eg. fade-in, fade-out). Various modes are possible depending on the amount of arguments. The attack time is the fade-in for the sound, the release is the fade-out for the sound, both in milliseconds or ",(0,i.jsx)(n.code,{children:"fraction"}),". The sustain time holds the sound at a static volume for a while. If the sound is triggered before the end of the envelope, the envelope is canceled, faded to 0 in 1ms and retriggered (in the case of monophonic instruments). You can specify the times in absolute values using integer/floating points (in ms) or in relative values using beat fractions."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)/Fraction(List)"})," -> Attack time in ms or fraction (optional, default=2)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)/Fraction(List)"})," -> Decay time in ms or fraction (optional, default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)/Fraction(List)"})," -> Release time in ms or fraction"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw shape(1500)\n// default attack of 2 ms, sustain of 0 ms and a release of 1500 ms\n\nnew synth saw shape(1000 250)\n// attack of 1000 ms, default sustain of 0 ms and a release of 250 ms\n\nnew synth saw shape(10 500 50)\n// attack of 10 ms, sustain of 500 ms and a release of 50 ms\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="shape with fractions"',children:"set tempo 100\n\nnew synth saw shape(1/2)\n// default release of 1/2 (about 250 ms at 120 bpm)\n\nnew synth saw shape(1/4 1/32)\n\nnew synth saw shape(1/64 1/8 1/16)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="modulate duration with a list"',children:"list durs [50 200 500]\nnew synth saw shape(durs)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"length()"}),", ",(0,i.jsx)(n.code,{children:"envelope()"})]}),"\n",(0,i.jsx)(n.h3,{id:"gain",children:"gain"}),"\n",(0,i.jsxs)(n.p,{children:["Set the volume for the instrument in floating-point amplitude. Where ",(0,i.jsx)(n.code,{children:"1"})," is the default amplitude of the sample or synth, ",(0,i.jsx)(n.code,{children:"0.5"})," is the half louder (-6 dB) and ",(0,i.jsx)(n.code,{children:"2"})," is twice as loud (+ 6dB). An optional second argument sets the sliding time to go to the next gain value in milliseconds or ",(0,i.jsx)(n.code,{children:"fraction"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> the (start) volume of the instrument (default=1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)"})," -> the sliding time in fraction or ms (optional, default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> mute the instrument but still use named sends (default=0) ",(0,i.jsx)(n.em,{children:"Mercury4Max only"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample snare_909 gain(0.8)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="modulate gain with a list"',children:"list gains [0 0.5 0.2 0.9]\nnew synth saw gain(gains 500) time(1/1)\n// ramps between gain values over 500ms every trigger 1/1\n"})}),"\n",(0,i.jsx)(n.admonition,{title:"Important for midi",type:"info",children:(0,i.jsxs)(n.p,{children:["When using the ",(0,i.jsx)(n.code,{children:"midi"})," instrument the gain will be multiplied by ",(0,i.jsx)(n.code,{children:"127"})," to create a velocity message. ",(0,i.jsx)(n.code,{children:"gain(0.5)"})," therefore maps to ",(0,i.jsx)(n.code,{children:"63"})," and ",(0,i.jsx)(n.code,{children:"gain(1)"})," to ",(0,i.jsx)(n.code,{children:"127"})]})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"amp()"}),", ",(0,i.jsx)(n.code,{children:"volume()"}),", ",(0,i.jsx)(n.code,{children:"velocity()"})]}),"\n",(0,i.jsx)(n.h3,{id:"pan",children:"pan"}),"\n",(0,i.jsxs)(n.p,{children:["Set the panning position in floating-point for the sound in the stereo-image. ",(0,i.jsx)(n.code,{children:"-1"})," is 100% left channel, ",(0,i.jsx)(n.code,{children:"0"})," is center (both speakers), ",(0,i.jsx)(n.code,{children:"1"})," is 100% right channel. Higher or lower values wrap between ",(0,i.jsx)(n.code,{children:"-1"})," and ",(0,i.jsx)(n.code,{children:"1"}),". Provide pan with the ",(0,i.jsx)(n.code,{children:"random"})," argument to get a new random panning value every trigger of the instrument."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float"})," -> the panning position between -1 and 1 (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw pan(-1)\nnew synth square pan(1)\n// two synths hard-panned left and right\n\nnew sample clap_909 pan(random) time(1/8)\n// random panning every trigger\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="modulate panning with a list',children:"list positions [-1 0 1 0 1 -1 -1]\nnew sample hat_808 time(1/16) pan(positions)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"panning()"})]}),"\n",(0,i.jsx)(n.admonition,{title:"Multi-speaker output is not (yet) supported",type:"note"}),"\n",(0,i.jsx)(n.h3,{id:"effect",children:"effect"}),"\n",(0,i.jsxs)(n.p,{children:["Add an effect to the sound of the instrument to manipulate the sounds timbre in different ways. The first argument is always the ",(0,i.jsx)(n.code,{children:"effect-name"}),". The arguments that follow depend on the selected effect. ",(0,i.jsx)(n.code,{children:"fx()"})," can be used as an alias to reduce some typing. See ",(0,i.jsx)(n.a,{href:"/mercury-docs/docs/reference/effects",children:"Effects"})," for more details and an up-to-date list of all the available effects for both ",(0,i.jsx)(n.em,{children:"Mercury4Max"})," and the ",(0,i.jsx)(n.em,{children:"MercuryPlayground"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> the effect name"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Value+/List+"})," -> values or lists depending on effectname arguments order (optional)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth square effect(distort) effect(reverb)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"fx()"}),", "]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"static vs. dynamic effect-chains"})}),"\n",(0,i.jsxs)(n.p,{children:["The Mercury4Max version has a static effects-chain. This means the order in the effects under the hood is fixed. The order is documented under ",(0,i.jsx)(n.a,{href:"/mercury-docs/docs/reference/effects",children:"Effects"}),". Because of this there is:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"No option to change the order of effects with the code"}),"\n",(0,i.jsx)(n.li,{children:"No option to use effects multiple times in one instrument"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="static fx-chain"',children:"new synth saw fx(reverb) fx(filter low 2000) fx(distort) fx(filter low 300)\n// filter and distortion are fixed before reverb in the chain, the order of \n// the code doesn't matter. There is only one filter in the chain, the first \n// filter is therefore overwritten by the other\n"})}),"\n",(0,i.jsx)(n.p,{children:"The MercuryPlayground version has a dynamic effects-chain. This means the order in the effects is determined by how you type the code. Because of this there is:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Decide the order of effects by the order of the code you type"}),"\n",(0,i.jsx)(n.li,{children:"Use effects multiple times on one instrument"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="dynamic fx-chain"',children:"new synth saw fx(reverb) fx(filter low 2000) fx(distort) fx(filter low 300)\n// the reverb will be filtered, then distorted and then filtered again\n// the resulting sound is filtered twice\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:["There are differences in sound between the ",(0,i.jsx)(n.em,{children:"Mercury4Max"})," and ",(0,i.jsx)(n.em,{children:"MercuryPlayground"})," versions. Parameters may need some tweaking when you port from one environment to the other."]})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["Not all effects from ",(0,i.jsx)(n.em,{children:"Mercury4Max"})," are available in the ",(0,i.jsx)(n.em,{children:"MercuryPlayground"})," because some are in the process of being ported, and some are sadly not as easy to implement with Web Audio."]})}),"\n",(0,i.jsx)(n.h3,{id:"ratchet",children:"ratchet"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsx)(n.p,{children:"Add a ratcheting effect (doubling/tripling/quadrupling of hits) with a probability. A technique that introduces some variety in rhythm that originated with electronic music from groups such as Tangerine Dream. The first argument sets the probability a note will be repeated. The second argument sets the amount of repetitions within the time, effectively doubling, tripling or more."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+"})," -> probability of ratchet happening (default=0.1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+/IntList+"})," -> amount of repetitions (default=2)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample hat_909 time(1/8) ratchet(0.3 2)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="using a ratchet list"',children:"list rtc [2 3 2 4 8]\nnew sample hat_909 time(1/4) ratchet(1 rtc)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"timediv",children:"timediv"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercuryplayground only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Add subdivisions to ",(0,i.jsx)(n.code,{children:"time()"}),". Documentation to do..."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list div [1 2 3 4]\nnew sample hat_808 time(1/4) timediv(div)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"warp",children:"warp"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Warp ",(0,i.jsx)(n.code,{children:"time()"})," in a more complex way. Documentation to do..."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list warp [1 2 3 4]\nnew sample hat_808 time(1/1) warp(warp)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"wait",children:"wait"}),"\n",(0,i.jsx)(n.admonition,{title:"MercuryPlayground only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["This function is similar to the offset parameter in the ",(0,i.jsx)(n.code,{children:"time()"})," function except that it allows you to set an additional waiting time (or delay) for an instrument in milliseconds. This function is useful to align/synchronize instruments with external peripherals such as sending MIDI notes or OSC messages."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+/Fraction"})," -> specify the waiting time in milliseconds or fraction (default=null)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample kick_909 time(1/4)\n// the hihat plays 100ms later than the kick\nnew sample hat_909 time(1/4) wait(100)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"synth",children:"synth"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"synth"})," and ",(0,i.jsx)(n.code,{children:"polySynth"})," instruments allow you to play synthesized sounds using a single cycle waveform. These waveforms are loaded in memory and can be accessed by their filename (without the extension). The default waveforms are ",(0,i.jsx)(n.code,{children:"sine"}),", ",(0,i.jsx)(n.code,{children:"triangle"}),", ",(0,i.jsx)(n.code,{children:"square"})," and ",(0,i.jsx)(n.code,{children:"saw"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth \n"})}),"\n",(0,i.jsx)(n.admonition,{type:"note",children:(0,i.jsxs)(n.p,{children:["The waveforms in MercuryPlayground are currently not created with single-cycle soundfiles but via WebAudio's ",(0,i.jsx)(n.code,{children:"PeriodicWave"}),", constructing a waveform from a Fourier Series."]})}),"\n",(0,i.jsx)(n.h3,{id:"note",children:"note"}),"\n",(0,i.jsx)(n.p,{children:"Set the pitch for the instrument to play a note in a melody or chord. The note is specified as a 2-dimensional coordinate system, where the first argument is the semitone offset (positive or negative) and the second argument is the octave offset (positive or negative)."}),"\n",(0,i.jsxs)(n.p,{children:["The origin of the system, ",(0,i.jsx)(n.code,{children:"note(0 0)"}),", corresponds by default with midi-pitch ",(0,i.jsx)(n.code,{children:"36"})," or ",(0,i.jsx)(n.code,{children:"C2"}),". Depending on the ",(0,i.jsx)(n.code,{children:"set scale"})," the coordinate system will shift and result in a different pitch for the origin. A ",(0,i.jsx)(n.code,{children:"note()"})," should therefore not be taken as an absolute value, but rather a relative direction where the melody is going to in relation to the scale and root."]}),"\n",(0,i.jsxs)(n.p,{children:["Detuning/pitchbending can be done by providing a ",(0,i.jsx)(n.code,{children:"float"})," note number. The value behind the decimal point is the amount of detuning from one semitone to the next. For example ",(0,i.jsx)(n.code,{children:"7.5"})," results in ",(0,i.jsx)(n.code,{children:"7"})," semitones (and mapped to ",(0,i.jsx)(n.code,{children:"scale"})," if used) and then a ",(0,i.jsx)(n.code,{children:"0.5"})," semitone is added (= 50 cents). Detuning is applied after mapping the integer semitone to a scale."]}),"\n",(0,i.jsxs)(n.p,{children:["The mapping of the notes is as follows with ",(0,i.jsx)(n.code,{children:"set scale chromatic c"})," (default)"]}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:(0,i.jsx)(n.code,{children:"note(x y)"})}),(0,i.jsx)(n.th,{children:"..."}),(0,i.jsx)(n.th,{children:"-1"}),(0,i.jsx)(n.th,{children:"0"}),(0,i.jsx)(n.th,{children:"1"}),(0,i.jsx)(n.th,{children:"2"}),(0,i.jsx)(n.th,{children:"3"}),(0,i.jsx)(n.th,{children:"4"}),(0,i.jsx)(n.th,{children:"..."}),(0,i.jsx)(n.th,{children:"9"}),(0,i.jsx)(n.th,{children:"10"}),(0,i.jsx)(n.th,{children:"11"}),(0,i.jsx)(n.th,{children:"12"}),(0,i.jsx)(n.th,{children:"13"}),(0,i.jsx)(n.th,{children:"..."})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"3"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"72"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"84"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"2"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"60"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"72"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"1"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"48"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"60"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"0"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"36"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"48"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"-1"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"B#"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"24"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"D"}),(0,i.jsx)(n.td,{children:"D#"}),(0,i.jsx)(n.td,{children:"E"}),(0,i.jsx)(n.td,{children:"..."}),(0,i.jsx)(n.td,{children:"A"}),(0,i.jsx)(n.td,{children:"A#"}),(0,i.jsx)(n.td,{children:"B"}),(0,i.jsxs)(n.td,{children:["C ",(0,i.jsx)(n.code,{children:"36"})]}),(0,i.jsx)(n.td,{children:"C#"}),(0,i.jsx)(n.td,{children:"..."})]})]})]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number(List)"})," -> positive or negative semitone note value or list, x-coordinate (default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number(List)"})," -> positive or negative octave value or list, y-coordinate (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set scale major d\nnew synth sine note(2 2)\n//=> results in midi-note 64 > F4\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="play a melody with lists"',children:"set scale minor A\n\nlist mel [0 5 7 3 2 -2 0]\nlist oct [0 1 2]\nnew synth sine note(mel oct) time(1/16)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"slide",children:"slide"}),"\n",(0,i.jsxs)(n.p,{children:["A portamento/sliding/gliding effect. This will make the synthesizers' oscillator slowly slide from the current frequency to the new played one over a defined period of ",(0,i.jsx)(n.code,{children:"number"})," in milliseconds or ",(0,i.jsx)(n.code,{children:"fraction"}),". The sliding is logarithmically (meaning it will slide from midi-note to midi-note linearly, but after conversion to frequency slides logarithmically. This sounds slightly different from sliding linearly between frequencies)."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+/Fraction(List)"})," -> sliding time in milliseconds or fraction (default=50)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes [0 7 3]\nnew synth saw note(notes 1) time(1/2) slide(1/8)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"glide()"}),", ",(0,i.jsx)(n.code,{children:"portamento()"})]}),"\n",(0,i.jsx)(n.h3,{id:"super",children:"super"}),"\n",(0,i.jsxs)(n.p,{children:["Add multiple oscillators in unison with a detuning factor to create a ",(0,i.jsx)(n.em,{children:"SuperSaw"})," effect. One oscillator will always be the base frequency of the ",(0,i.jsx)(n.code,{children:"note()"}),", the others are tuned above and below in incremental steps based on the detuning factor. The first argument sets the amount of oscillators (minum of 1, default=1), the second argument sets the detuning factor in semi-tones, the third optional argument sets the oscillator type for the odd numbered oscillators."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+(List)"})," -> number of oscillators (default=1, maximum=64)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> detuning factor in semi-tone, 12=octave"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> the name of the odd numbered oscillators (optional, default=main oscillator) ",(0,i.jsx)(n.em,{children:"Mercury4Max only"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw super(5 0.031415)\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw super(11 0.0618 square) \n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",metastring:'title="modulate detuning with a list"',children:"list voices [3 5 9 21]\nlist detune [0.1 0.5 0.9 12.01 0.3]\n\nnew synth saw time(1/4) shape(-1) super(voices detune)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"unison()"})]}),"\n",(0,i.jsx)(n.h3,{id:"wave2",children:"wave2"}),"\n",(0,i.jsx)(n.admonition,{title:"REMOVED",type:"warning",children:(0,i.jsxs)(n.p,{children:["use ",(0,i.jsx)(n.a,{href:"#super",children:"super()"})," instead"]})}),"\n",(0,i.jsx)(n.h3,{id:"sub",children:"sub"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Add a second sinewave oscillator to the synth. The oscillator is tuned one octave lower than the ",(0,i.jsx)(n.code,{children:"note()"})," played to create a sub frequency."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> amplitude for the sub oscillator (default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth sine note(5 1) sub(0.8)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"noise",children:"noise"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["Add a noise oscillator to the synth sound. The first argument is the ",(0,i.jsx)(n.em,{children:"amplitude"})," (gain), the second argument is the ",(0,i.jsx)(n.em,{children:'"color"'})," of the noise between 0 and 1 (1 = white noise, lower values give a more darker/downsampled noise sound). When the modulation mode is turned on (with 1) the noise is modulated by the source of the oscillator (or oscillators if ",(0,i.jsx)(n.code,{children:"super()"})," and ",(0,i.jsx)(n.code,{children:"sub()"})," are used)."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> amplitude of the noise (default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> color of the noise 0-1 (default=0.8)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool(List)"})," -> modulation mode (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw note(0 1) noise(0.3 0.8 1)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"sample",children:"sample"}),"\n",(0,i.jsx)(n.p,{children:'The sample instrument allows you to play sound-recordings and loops. These so called "samples" are loaded in memory and can be accessed by their filename (without the extension).'}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample \n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/mercury-docs/docs/usage/mercury4max-overview#sounds",children:"Load sounds in Mercury4Max"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/mercury-docs/docs/usage/playground-overview#add-sounds",children:"Load sounds in MercuryPlayground"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/mercury-docs/docs/usage/sounds",children:"Full list of all the included sounds"})}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"speed",children:"speed"}),"\n",(0,i.jsxs)(n.p,{children:["Set the playback speed for the sample, where 1 = original speed, 0.5 = half the speed and 2 = twice as fast. Adjusting the playback speed will change the pitch of the sample. A negative value will play the sample backwards starting at the end (or at the ",(0,i.jsx)(n.code,{children:"start()"})," position)"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float(List)"})," -> playback speed (default=1)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample choir time(5) speed(0.5)\nnew sample choir time(5) speed(-0.3)\n\nset all fx(reverb 2 17)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"rate()"})]}),"\n",(0,i.jsx)(n.admonition,{title:"Reversed speed is not supported (yet) in the MercuryPlayground",type:"warning"}),"\n",(0,i.jsx)(n.h3,{id:"start",children:"start"}),"\n",(0,i.jsxs)(n.p,{children:["Set the start position (the offset position of the playback) of the sample. 0 = start at the beginning, 0.5 = start midway in the sample. With long decaying samples the offset is very useful if playing the sounds backwards when using for example ",(0,i.jsx)(n.code,{children:"speed(-1)"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Float+(List)"})," -> the playback position between 0 and 1 (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list positions randomFloat(8 0 0.5)\n\nnew sample choir time(1/16) start(positions)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"offset()"})]}),"\n",(0,i.jsx)(n.h3,{id:"note-1",children:"note"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"note"})," function allows you to tune the sample to a specific pitch. This is easier than trying to set the playback speed with the ",(0,i.jsx)(n.code,{children:"speed()"})," function if you need to pitch the sample for melodic content. The function works the same as the ",(0,i.jsx)(n.code,{children:"note"})," function explained under the ",(0,i.jsx)(n.code,{children:"synth"}),". Please see ",(0,i.jsx)(n.a,{href:"#note",children:(0,i.jsx)(n.code,{children:"note()"})})," for further information."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes [0 7 5 3]\nnew sample xylo_c4 time(1/8) note(notes 1)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"tune",children:"tune"}),"\n",(0,i.jsxs)(n.p,{children:["Set the base note midi value for the sample to determine how the ",(0,i.jsx)(n.code,{children:"note()"})," function changes the playback speed in relation to this note. For example if your sample was recorded as an ",(0,i.jsx)(n.code,{children:"a4"})," then you will set tune to ",(0,i.jsx)(n.code,{children:"69"})," (midi value of ",(0,i.jsx)(n.code,{children:"a4"}),"). ",(0,i.jsx)(n.code,{children:"note(0 2)"})," is the same as the ",(0,i.jsx)(n.code,{children:"tune()"})," value in the case of a scale set to have ",(0,i.jsx)(n.code,{children:"c"})," as the root."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+"})," -> midi pitch as base for tuning (optional, default=60)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set scale minor c\n\nlist notes [0 7 5 3]\n// tune the kalimba to a3\nnew sample kalimba_a time(1/4) note(notes 2) tune(57)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"stretch",children:"stretch"}),"\n",(0,i.jsxs)(n.p,{children:["Stretch the entire sample to the length of a full bar. Useful for when working with beats that have to be looped. Stretching is the default when working with the ",(0,i.jsx)(n.code,{children:"loop"})," instrument. This is the same as a ",(0,i.jsx)(n.code,{children:"new sample stretch(1)"}),". Optionally you can turn timestretching on with a second argument to preserve the original pitch of the sample. A third optional argument changes the mode of the stretching, choose from: basic, monophonic, rhythmic, general, extremestretch, efficient. The default is set to ",(0,i.jsx)(n.code,{children:"efficient"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> turn stretch to full bar on/off (default=0 for sample default=1 for loop)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> turn timestretching on when stretching to full bar, preservering the original pitch (default = 0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> adjust the stretching mode (default=efficient)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample chimes stretch(1 1 general) speed(-1)\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.p,{children:["If your ",(0,i.jsx)(n.code,{children:"loop"})," is longer than ",(0,i.jsx)(n.code,{children:"1"})," bar use ",(0,i.jsx)(n.code,{children:"speed()"})," to decrease the playback speed by ",(0,i.jsx)(n.code,{children:"1 / n-bars"}),". Set ",(0,i.jsx)(n.code,{children:"time()"})," to the bar amounts."]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new loop loopOfFourBars time(4/1) speed(0.25)\n"})})]}),"\n",(0,i.jsx)(n.admonition,{title:"Timestretching is only supported in Mercury4Max",type:"warning"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Stretching modes explained"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"basic"})," : best option for real-time performance"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"monophonic"})," : best option for any monophonic source without ambience"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"rhythmic"})," : best option for drums and percussion when transient preservation is critical"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"general"})," : balances spectral integrity with transient preservaton"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"extremestretch"})," : optimized for stretching (slowing down) material, limited to a stretch factor between 0.5 and 4"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"effcient"})," : best option when CPU efficiency is critical"]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"loop",children:"loop"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"loop"})," instrument is basically the ",(0,i.jsx)(n.code,{children:"sample"})," instrument but with ",(0,i.jsx)(n.code,{children:"stretch(1)"})," enabled by default, making all the loaded samples stretch to 1 full bar. For all available ",(0,i.jsx)(n.code,{children:"instrument-functions"})," of ",(0,i.jsx)(n.code,{children:"loop"})," see ",(0,i.jsx)(n.a,{href:"#sample",children:(0,i.jsx)(n.code,{children:"sample"})})," above."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new loop \n"})}),"\n",(0,i.jsx)(n.h2,{id:"polysynth",children:"polySynth"}),"\n",(0,i.jsxs)(n.p,{children:["The polySynth functions the same as the ",(0,i.jsx)(n.code,{children:"synth"})," instrument in the sense that you choose a waveform, apply a ",(0,i.jsx)(n.code,{children:"note()"}),", add a ",(0,i.jsx)(n.code,{children:"shape()"}),", etc. For explanation of those functions see ",(0,i.jsx)(n.a,{href:"#synth",children:(0,i.jsx)(n.code,{children:"synth"})}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The extra feature of the polySynth is that it allows for overlapping notes to generate chords. Notes provided to the ",(0,i.jsx)(n.code,{children:"note()"})," function as a 2-dimensional list will be played on the same time as a chord. By default there are 8 voices available at the same time. Voice stealing is ",(0,i.jsx)(n.code,{children:"on"}),' by default meaning that if a new note is played while all voices are busy the "oldest" triggered note will be removed.']}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new polySynth note([ [chord1] [chord2] ... [chord-n] ])\n"})}),"\n",(0,i.jsx)(n.p,{children:"You can think of a 2D list like so:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list chords [ [ 0 3 7 ] [ 2 5 9 ] [ 3 6 10 13 ] ]\n\nlist chords [ 0 2 3 ]\n 3 5 6 \n 7 9 10\n 13 \n"})}),"\n",(0,i.jsxs)(n.p,{children:["So the list ",(0,i.jsx)(n.code,{children:"chords"})," has ",(0,i.jsx)(n.code,{children:"3"}),' "items", and those ',(0,i.jsx)(n.code,{children:"3"})," items again contain a ",(0,i.jsx)(n.code,{children:"list"})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list chords [ [ 0 3 7 ] [ 2 5 9 ] [ 3 6 10 13 ] ]\n\nnew polySynth sine note(chord 2) time(1/2) shape(1 1/4) \n"})}),"\n",(0,i.jsx)(n.h3,{id:"steal",children:"steal"}),"\n",(0,i.jsxs)(n.p,{children:["With steal you can choose the behaviour of what happens when new notes are triggered while all voices are in use. When steal is ",(0,i.jsx)(n.code,{children:"on"})," (the default) every new note will be triggered and old notes will be overwritten by the new ones. If steal is ",(0,i.jsx)(n.code,{children:"off"})," new notes are not triggered while all voices are busy. You'll have to wait till some voice is done playing, based on the ",(0,i.jsx)(n.code,{children:"shape()"})," before a note can be triggered again."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool/Name"})," -> turn voice stealing ",(0,i.jsx)(n.code,{children:"on"})," or ",(0,i.jsx)(n.code,{children:"off"})," (optional, default=on)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes spread(16 0 36)\n\nnew polySynth sine note(notes 2) time(1/16) shape(1 1/1) steal(off)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["If you use ",(0,i.jsx)(n.code,{children:"steal(off)"})," but also set ",(0,i.jsx)(n.code,{children:"shape(off)"})," you won't be able to trigger any new notes after all voices are filled because there is no shape to stop any voice from sounding."]})}),"\n",(0,i.jsx)(n.h3,{id:"spread",children:"spread"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsx)(n.p,{children:"Use the spread function to add little delays with optional randomness between every note in a chord, resulting in the chord to sound broken up in time (spread out)."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+/Fraction(List)"})," -> the delaytime between note triggers in ms or fraction (default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+/Fraction(List)"})," -> random delaytime offset added to the delaytime in ms or fraction (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes [ [0 3 7 11 12] ]\n\nnew polySynth sine note(notes 2) shape(1 1/1) time(1/1) spread(150 50)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"voices",children:"voices"}),"\n",(0,i.jsx)(n.admonition,{title:"not (yet) supported",type:"warning"}),"\n",(0,i.jsx)(n.h2,{id:"polysample",children:"polySample"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury Playground only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["The polySample functions the same as the ",(0,i.jsx)(n.code,{children:"sample"})," in the sense that you choose a sample file, set a ",(0,i.jsx)(n.code,{children:"speed()"}),", add a ",(0,i.jsx)(n.code,{children:"shape()"}),", etc. For explanation of those functions see ",(0,i.jsx)(n.a,{href:"#sample",children:(0,i.jsx)(n.code,{children:"sample"})}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The extra feature of the polySample is that it allows for overlapping sounds. For example useful when generating chords. Notes provided to the ",(0,i.jsx)(n.code,{children:"note()"})," function as a 2-dimensional list will be played at the same time as a chord. By default there are 8 voices available at the same time."]}),"\n",(0,i.jsxs)(n.p,{children:["For explanation of using ",(0,i.jsx)(n.code,{children:"2D-list"}),"'s in ",(0,i.jsx)(n.code,{children:"note()"})," for polyphony see ",(0,i.jsx)(n.a,{href:"#polysynth",children:(0,i.jsx)(n.code,{children:"polySynth"})})," voice-stealing see ",(0,i.jsx)(n.a,{href:"#steal",children:(0,i.jsx)(n.code,{children:"steal"})})," under ",(0,i.jsx)(n.code,{children:"polySynth"}),". For setting voice-amount see ",(0,i.jsx)(n.a,{href:"#voices",children:(0,i.jsx)(n.code,{children:"voices"})}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set tempo 100\nset scale dorian eb\n\nlist notes shuffle(spread(24))\nnew polySample piano_e time(1/16) note(notes 1) shape(1 1/2) steal(off) tune(64)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"midi",children:"midi"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"midi"})," instrument allows you to send MIDI messages (notes, pitchbend, controlchange, programchange) to other external devices or virtual devices in your computer. The ",(0,i.jsx)(n.code,{children:""})," is the literal name as a ",(0,i.jsx)(n.code,{children:"string"})," of the device as it shows up when connected to the computer. For example this can be something like ",(0,i.jsx)(n.code,{children:'"My MIDI Device"'}),". You can also choose ",(0,i.jsx)(n.code,{children:"default"})," to set the instrument to the first midi device in the list. The name is written as a ",(0,i.jsx)(n.code,{children:"string"})," between ",(0,i.jsx)(n.code,{children:'" "'})," and is sensitive to upper and lower cases. To setup a basic midi instrument use:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new midi \n"})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> ",(0,i.jsx)(n.code,{children:"default"})," or MIDI Device name as a ",(0,i.jsx)(n.code,{children:"string"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Functions ",(0,i.jsx)(n.code,{children:"note()"}),", ",(0,i.jsx)(n.code,{children:"time()"}),", ",(0,i.jsx)(n.code,{children:"name()"}),", ",(0,i.jsx)(n.code,{children:"group()"}),", ",(0,i.jsx)(n.code,{children:"once()"}),", ",(0,i.jsx)(n.code,{children:"play()"}),", ",(0,i.jsx)(n.code,{children:"ratchet()"}),", ",(0,i.jsx)(n.code,{children:"timediv()"}),", ",(0,i.jsx)(n.code,{children:"warp()"}),", ",(0,i.jsx)(n.code,{children:"wait()"})," all work the same for the ",(0,i.jsx)(n.code,{children:"midi"})," instrument. There are some differences when using the ",(0,i.jsx)(n.code,{children:"shape()"})," and ",(0,i.jsx)(n.code,{children:"gain()"})," functions."]}),"\n",(0,i.jsx)(n.h3,{id:"note-2",children:"note"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"note"})," function allows you to play a midinote. The function works the same as the ",(0,i.jsx)(n.code,{children:"note"})," function explained under the ",(0,i.jsx)(n.code,{children:"synth"}),". Please see ",(0,i.jsx)(n.a,{href:"#note",children:(0,i.jsx)(n.code,{children:"note()"})})," for further information."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"set scale major D\n\nlist notes [0 7 5 3]\n\nnew midi default note(notes 2)\n// plays the midi notes 62 69 67 64\n"})}),"\n",(0,i.jsx)(n.h3,{id:"length",children:"length"}),"\n",(0,i.jsxs)(n.p,{children:["Replaces the ",(0,i.jsx)(n.code,{children:"shape()"})," function of ",(0,i.jsx)(n.code,{children:"synth"})," and ",(0,i.jsx)(n.code,{children:"sample"}),". Set the duration of the midi-note. This means it will send a ",(0,i.jsx)(n.code,{children:"note-off"})," message after a ",(0,i.jsx)(n.code,{children:"number"})," of milliseconds or ",(0,i.jsx)(n.code,{children:"fraction"}),". If the instrument is triggered before the end of the duration, the note-off is canceled and a new note-off is scheduled."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number/Fraction(List)"})," -> Duration time in ms or fraction"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new midi default length(1500) time(1)\n"})}),"\n",(0,i.jsx)(n.p,{children:"with fraction:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new midi default length(1/2) time(1)\n//=> duration of 1/2 (1200 ms at 100 bpm)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"duration()"}),", ",(0,i.jsx)(n.code,{children:"shape()"})]}),"\n",(0,i.jsx)(n.h3,{id:"channel",children:"channel"}),"\n",(0,i.jsxs)(n.p,{children:["Set the midi-channel output for the midi-note to be send to. ",(0,i.jsx)(n.code,{children:"out()"})," can be used as an alias to reduce some typing."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+(List)"})," -> Channel to send the midi-note to"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new midi default note(7 2) channel(1)\nnew midi default note(0 0) channel(2)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"out()"})]}),"\n",(0,i.jsx)(n.h3,{id:"chord",children:"chord"}),"\n",(0,i.jsxs)(n.p,{children:["By default the ",(0,i.jsx)(n.code,{children:"midi"})," instrument's output is monophonic. You can turn the chord output (polyphony) on for a midi instrument with this function. This allows you to use ",(0,i.jsx)(n.code,{children:"2D-list"}),"s where the 2nd dimension is used to generate chords. Read more about chords under ",(0,i.jsx)(n.a,{href:"#polySynth",children:(0,i.jsx)(n.code,{children:"polySynth"})}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> Turn chord output on/off"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list chords [[0 4 7] [2 5 9] [5 9 0]]\n\nnew midi default note(chords 1) chord(on)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"program",children:"program"}),"\n",(0,i.jsxs)(n.p,{children:["Send program change messages to the specified midi-channel of the instrument. The channel number is based on the ",(0,i.jsx)(n.code,{children:"out()"})," function (see ",(0,i.jsx)(n.a,{href:"#channel",children:(0,i.jsx)(n.code,{children:"channel"})}),"). The default channel ",(0,i.jsx)(n.code,{children:"1"})," is used if no channel is selected. The program change value is zero-based, an integer from ",(0,i.jsx)(n.code,{children:"0"})," - ",(0,i.jsx)(n.code,{children:"127"})," and can be sequenced as a list. If no value is provided there is no program change send. The value is ",(0,i.jsx)(n.strong,{children:"only"})," send when it changes based on the previous value. This is done because some midi devices react every time a program change is received (for example cutting of notes), even if the value stays the same."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+(List)"})," -> Program change value 0-127 (default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list notes spread(5 0 12)\nlist changes [0 10 20]\n\nnew midi default note(notes 1) out(1) program(changes)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"pgm()"})]}),"\n",(0,i.jsx)(n.h3,{id:"change",children:"change"}),"\n",(0,i.jsxs)(n.p,{children:["Send control change (CC) messages to the midi device. This function replaces the ",(0,i.jsx)(n.code,{children:"effect()"})," function of an instrument and can have multiple calls in the same instrument, every call can be a different control number. The first argument is the ",(0,i.jsx)(n.code,{children:"number"})," for the control, the second argument is the ",(0,i.jsx)(n.code,{children:"number"})," for the controller value or a list of controller values. You can use ",(0,i.jsx)(n.code,{children:"cc()"})," as an alias to reduce typing."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+"})," -> controller number between 0-127"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Int+(List)"})," -> controller value between 0-127"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list ccValues [10 20 30 40 50]\n\nnew midi default time(1/8) change(13 100) change(21 ccValues)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"cc()"})]}),"\n",(0,i.jsx)(n.h3,{id:"sync",children:"sync"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsx)(n.p,{children:"Turn the midiclock syncing on/off for an individual instrument and send it to the selected port/device from that instrument."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Bool"})," -> Turn syncing on/off"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'new midi "My Midi Device" sync(on)\nnew midi "Another Device" sync(off)\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Alias: ",(0,i.jsx)(n.code,{children:"clock()"})]}),"\n",(0,i.jsx)(n.h2,{id:"input",children:"input"}),"\n",(0,i.jsxs)(n.p,{children:["Use the input from the soundcard (ADC, Analog Digital Converter) as the source for an instrument. The sound can be modified by all the various ",(0,i.jsx)(n.code,{children:"fx()"}),"'s. The volume can be adjusted with ",(0,i.jsx)(n.code,{children:"gain()"}),". An envelope can be applied on the sound with ",(0,i.jsx)(n.code,{children:"shape()"})," and this envelope can be triggered with ",(0,i.jsx)(n.code,{children:"time()"})," just as with the regular instruments ",(0,i.jsx)(n.code,{children:"sample"}),", ",(0,i.jsx)(n.code,{children:"synth"}),", etc. Use the words ",(0,i.jsx)(n.code,{children:"in1"}),", ",(0,i.jsx)(n.code,{children:"in2"}),", ..., ",(0,i.jsx)(n.code,{children:"inx"})," to choose the input source. Use ",(0,i.jsx)(n.code,{children:"default"})," to pick the first input in the list."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new input \n"})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> ",(0,i.jsx)(n.code,{children:"default"})," or the input channel number as a string ",(0,i.jsx)(n.code,{children:"inX"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// use the default input, in most cases channel 1\nnew input default gain(1)\n\n// use a specific channel\nnew input in3 gain(0.9) \n\n// add functions like shape, time and fx\nnew input in4 gain(0.9) time(1/16) shape(1 100) fx(reverb) fx(distort)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsx)(n.p,{children:"In the browser you will need to give permission to use the microphone. Afterwards you might need to refresh the page."})}),"\n",(0,i.jsx)(n.h2,{id:"osc",children:"osc"}),"\n",(0,i.jsx)(n.admonition,{title:"MercuryPlayground only (currently)",type:"warning",children:(0,i.jsxs)(n.p,{children:["For sending osc from Mercury4Max use ",(0,i.jsx)(n.a,{href:"#emitter",children:(0,i.jsx)(n.code,{children:"emitter"})})]})}),"\n",(0,i.jsxs)(n.p,{children:["Create an instrument that sends OSC-messages. The ",(0,i.jsx)(n.code,{children:""})," is used to set the opening address of the message to ",(0,i.jsx)(n.code,{children:"/"}),". Any arbitrary function name is used to set as second address in the osc-string. If no name is provided it will default to a unique number for every instrument instance. By adding other functions with any arbitrary name you can send a message with the address in the form of ",(0,i.jsx)(n.code,{children:"// "})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new osc \n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'list params [0.25 0.5 0.75]\nlist values [3 1]\n\nnew osc "myOSC" time(1/4) someParam(params) anotherParam(values)\n\n// sends => /myOSC/someParams 0.25\n// /myOSC/anotherParam 3\n// /myOSC/someParams 0.5\n// /myOSC/anotherParam 1\n// etc...\n'})}),"\n",(0,i.jsxs)(n.p,{children:["The messages also support multiple arguments up to a length of 256. Multiple arguments can be provided as ",(0,i.jsx)(n.code,{children:"list"}),"s, ",(0,i.jsx)(n.code,{children:"string"}),"s, ",(0,i.jsx)(n.code,{children:"float"}),"s or ",(0,i.jsx)(n.code,{children:"int"}),"s."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list val1 [0.25 0.5 0.75]\nlist val2 [3 1]\n\nnew osc myOSC time(1/4) aMessage(0.1 val1 val2 100)\n\n// emits => /myOSC/aMessage 0.1 0.25 3 100\n// /myOSC/aMessage 0.1 0.5 1 100\n// /myOSC/aMessage 0.1 0.75 3 100\n// etc...\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.p,{children:["If you want multiple ",(0,i.jsx)(n.code,{children:"osc"})," to send to the same address, you can use the same ",(0,i.jsx)(n.code,{children:""})," but use different ",(0,i.jsx)(n.code,{children:"name()"}),"s for reference in the code. Useful if you want to send messages to the same address, but with different timing-intervals."]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list params [0.25 0.5 0.75]\nlist values [3 1 4]\n\nnew osc myOSC name(osc1) time(1/4) \n set osc1 someParam(params)\n\nnew osc myOSC name(osc2) time(1/2)\n set osc2 anotherParam(values)\n"})})]}),"\n",(0,i.jsx)(n.h2,{id:"modulator",children:"modulator"}),"\n",(0,i.jsx)(n.admonition,{title:"Mercury4Max only",type:"warning"}),"\n",(0,i.jsxs)(n.p,{children:["The modulator allows you to send a modulation signal as an argument to parameters in ",(0,i.jsx)(n.code,{children:"instrument-function"}),"s of other instruments. These parameters are continuously modulated at a specific rate with a specific waveform. The modulation rate is independent from the instruments ",(0,i.jsx)(n.code,{children:"time()"})," (in comparison when using a list as an argument). It is also possible to send the modulation signal directly out to the connected soundcard on a specific DAC channel (Digital Analog Converter). This can for example be used for CV-modulations."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> modulator waveform type: ",(0,i.jsx)(n.code,{children:"sine"}),"/",(0,i.jsx)(n.code,{children:"sin"}),", ",(0,i.jsx)(n.code,{children:"sawUp"}),"/",(0,i.jsx)(n.code,{children:"phasor"}),", ",(0,i.jsx)(n.code,{children:"sawDown"}),"/",(0,i.jsx)(n.code,{children:"saw"}),", ",(0,i.jsx)(n.code,{children:"square"}),"/",(0,i.jsx)(n.code,{children:"rect"}),", ",(0,i.jsx)(n.code,{children:"triangle"}),"/",(0,i.jsx)(n.code,{children:"tri"}),", ",(0,i.jsx)(n.code,{children:"random"}),"/",(0,i.jsx)(n.code,{children:"rand"}),", ",(0,i.jsx)(n.code,{children:"randomLine"}),"/",(0,i.jsx)(n.code,{children:"randL"}),", ",(0,i.jsx)(n.code,{children:"trigger"}),"/",(0,i.jsx)(n.code,{children:"gate"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new modulator name() range( ) time() out()\n"})}),"\n",(0,i.jsx)(n.h3,{id:"name-1",children:"name"}),"\n",(0,i.jsxs)(n.p,{children:["Replaces the ",(0,i.jsx)(n.code,{children:"name()"})," function. Set the name for the modulator, this name can be used as argument in the functions of an instrument like ",(0,i.jsx)(n.code,{children:"synth"})," and ",(0,i.jsx)(n.code,{children:"sample"})]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> the modulator ",(0,i.jsx)(n.code,{children:"name"})," for reference in other functions"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// set the name to myModulator\nnew modulator sine name(myModulator)\n\n// the synth uses the modulator in the gain function\nnew synth saw gain(myModulator)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"time-1",children:"time"}),"\n",(0,i.jsxs)(n.p,{children:["Replaces the ",(0,i.jsx)(n.code,{children:"time()"})," function. Set the modulation speed as a ",(0,i.jsx)(n.code,{children:"fraction"})," or ",(0,i.jsx)(n.code,{children:"float+"}),". The default is ",(0,i.jsx)(n.code,{children:"1/1"})," (one period per bar)."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Fraction/Float+"})," -> The time interval for one period of the modulation waveform (optional, default=1/1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Fraction/Float+"})," -> The time offset for the modulation (optional, default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// modulate a sinewave at a period of one per 4 bars\nnew modulator sine time(4/1)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"range",children:"range"}),"\n",(0,i.jsxs)(n.p,{children:["Set the modulation range between a lower and upper value with an optional exponential value. The default range is ",(0,i.jsx)(n.code,{children:"0"})," to ",(0,i.jsx)(n.code,{children:"1"}),"."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number"})," -> The low output range (optional, default=0)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number"})," -> The high output range (optional, default=1)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number"})," -> The scaling exponent (optional, default=1)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// set the range from 200 to 5000, for example to modulate a filter cutoff in Hz\nnew modulator sine range(200 5000)\n\n// include the third argument to set the exponential in the scaling\nnew modulator sine range(200 5000 3)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"out",children:"out"}),"\n",(0,i.jsxs)(n.p,{children:["Set the output channel from your connected soundcard to send the modulation signal directly to. The default is 0 (no output to DAC). Currently the maximum number of channels that can be used is 16. If the modulation signal is only used for direct output it is not necessary to also ",(0,i.jsx)(n.code,{children:"name()"})," the modulator."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+"})," -> The channel number from 1 till number of outputs available, maximum of 16 (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// send a sinewave modulator signal to DAC channel 3\nnew modulator sine range(-1 1) out(3)\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsx)(n.p,{children:"Be careful when sending DC signals with large ranges to your DAC, this could damage your speakers if you choose the wrong output!"})}),"\n",(0,i.jsx)(n.h3,{id:"trigger",children:"trigger"}),"\n",(0,i.jsxs)(n.p,{children:["When using the mode ",(0,i.jsx)(n.code,{children:"trigger"}),"/",(0,i.jsx)(n.code,{children:"gate"})," the modulator functions like the sequencer in the other instruments. Meaning that you can include the ",(0,i.jsx)(n.code,{children:"play()"})," function to add a rhythm list, use ",(0,i.jsx)(n.code,{children:"ratchet()"})," to add a list of timing subdivisions with probability and use ",(0,i.jsx)(n.code,{children:"warp()"})," to add a list of time warpings."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Name"})," -> ",(0,i.jsx)(n.code,{children:"trigger"}),"/",(0,i.jsx)(n.code,{children:"gate"})," sets the intrument to use the stepsequencer (default=off)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// generate a euclidean rhythm and use it in the trigger\nlist rtm euclid(16 11)\nnew modulator trigger time(1/8) play(rtm) ratchet(0.1 2)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"hold",children:"hold"}),"\n",(0,i.jsxs)(n.p,{children:["The hold function transforms the ",(0,i.jsx)(n.code,{children:"trigger"})," into a gate that goes open and closes after a certain amount of time. The time value can be either ",(0,i.jsx)(n.code,{children:"ms"})," or a ",(0,i.jsx)(n.code,{children:"fraction"}),". If the hold time is longer than the time interval between triggers the gate stays open. A hold of ",(0,i.jsx)(n.code,{children:"0"})," results in the click from the default trigger."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"arguments"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Number+"})," -> hold time in ms or fraction (default=0)"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// trigger every 8th note, and leave the gate open for the length of 50ms\nnew modulator trigger time(1/8) hold(50)\n\n// trigger every 8th note, and leave the gate open for the length of a 16th\nnew modulator trigger time(1/8) hold(1/16)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"emitter",children:"emitter"}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["Soon to be deprecated in Mercury4Max, then use ",(0,i.jsx)(n.a,{href:"#osc",children:(0,i.jsx)(n.code,{children:"osc"})})," instead (similar as in MercuryPlayground now)"]})}),"\n",(0,i.jsxs)(n.p,{children:["Create an emitter object. Use this object to send messages to other platforms. The emitter object works similarly to the Instruments in the sense that it also has the ",(0,i.jsx)(n.code,{children:"time"}),", ",(0,i.jsx)(n.code,{children:"beat"})," and ",(0,i.jsx)(n.code,{children:"name"})," functions by default. The ",(0,i.jsx)(n.code,{children:"time"})," determines the time-interval at which messages are send. The ",(0,i.jsx)(n.code,{children:"beat"})," can turn send moments on or off."]}),"\n",(0,i.jsx)(n.h3,{id:"osc-1",children:"osc"}),"\n",(0,i.jsxs)(n.p,{children:["Create an emitter object of type ",(0,i.jsx)(n.code,{children:"osc"}),". The ",(0,i.jsx)(n.code,{children:"name()"})," method is used to set the opening address of the message to ",(0,i.jsx)(n.code,{children:"/"}),". Any arbitrary function name is used to set as second address in the osc-string. If no name is provided it will default to a unique number for every instrument instance. By adding other functions with any arbitrary name you can send a message with the address in the form of ",(0,i.jsx)(n.code,{children:"// "})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new emitter osc name() time()\n"})}),"\n",(0,i.jsx)(n.p,{children:"example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list params [0.25 0.5 0.75]\nlist values [3 1]\n\nnew emitter osc name(myOSC) time(1/4) \n set myOSC someParam(params) anotherParam(values)\n\n// emits => /myOSC/someParams 0.25\n// /myOSC/anotherParam 3\n// /myOSC/someParams 0.5\n// /myOSC/anotherParam 1\n// /myOSC/someParams 0.75\n// /myOSC/anotherParam 3\n// /myOSC/someParams 0.25\n// etc...\n"})}),"\n",(0,i.jsx)(n.p,{children:"The messages also support multiple arguments up to a length of 256. Multiple arguments can be provided as rings, symbols, floats or integers."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list val1 [0.25 0.5 0.75]\nlist val2 [3 1]\n\nnew emitter osc name(myOSC) time(1/4)\n set myOSC aMessage(0.1 val1 val2 100)\n\n// emits => /myOSC/aMessage 0.1 0.25 3 100\n// /myOSC/aMessage 0.1 0.5 1 100\n// /myOSC/aMessage 0.1 0.75 3 100\n// /myOSC/aMessage 0.1 0.25 1 100\n// etc...\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"Note:"})," Some variable names are not allowed because they are part of the built-in names for datastructures. These are: ",(0,i.jsx)(n.code,{children:"bang, int, float, list, mode, zlclear, zlmaxsize"})]}),"\n",(0,i.jsx)(n.h3,{id:"name-2",children:"name"}),"\n",(0,i.jsxs)(n.p,{children:["Set the name for the OSC emitter. This can be any string of 2 or more characters. The ",(0,i.jsx)(n.code,{children:"name"})," is used as reference to the instrument when the ",(0,i.jsx)(n.code,{children:"set"})," method is used to call methods for a specific object. The ",(0,i.jsx)(n.code,{children:"name"})," is also prepended as first address in the osc-message of the format ",(0,i.jsx)(n.code,{children:"// argument"}),"."]}),"\n",(0,i.jsx)(n.h3,{id:"address",children:"address"}),"\n",(0,i.jsxs)(n.p,{children:["Alternatively, if you want multiple emitters to send to the same address, you can use the ",(0,i.jsx)(n.code,{children:"address()"})," method. The ",(0,i.jsx)(n.code,{children:"address"})," is prepended as first address in the osc-message in the format: ",(0,i.jsx)(n.code,{children:"/
/ argument"}),". Useful if you want to send messages to the same address, but with different timing-intervals."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"list params [0.25 0.5 0.75]\nlist values [3 1 4]\n\nnew emitter osc name(osc1) address(myOSC) time(1/4) \n set osc1 someParam(params)\n\nnew emitter osc name(osc2) address(myOSC) time(1/2)\n set osc2 anotherParam(values)\n\n// emits => /myOSC/someParams 0.25\n// /myOSC/someParams 0.5\n// /myOSC/anotherParam 3\n// /myOSC/someParams 0.75\n// /myOSC/someParams 0.25\n// /myOSC/anotherParam 1\n// etc...\n"})}),"\n",(0,i.jsx)(n.h3,{id:"sendosc",children:"sendOSC"}),"\n",(0,i.jsx)(n.p,{children:"You can enable/disable sending messages with the sendOSC function"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new emitter osc name(osc3) sendOSC(0)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"receiving",children:"receiving"}),"\n",(0,i.jsxs)(n.p,{children:["You can use osc adresses as arguments for other functions by putting the address as argument in the form: ",(0,i.jsx)(n.code,{children:"/
//"}),". For example to control the ",(0,i.jsx)(n.code,{children:"gain()"})," of a ",(0,i.jsx)(n.code,{children:"sample"})," and the ",(0,i.jsx)(n.code,{children:"note()"})," value of a ",(0,i.jsx)(n.code,{children:"synth"})," enter the following:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new sample kick_909 time(1/4) gain(/myOSC/sliderValue1)\nnew synth saw note(/myOSC/sliderValue2) shape(1 100) time(1/8)\n"})}),"\n",(0,i.jsxs)(n.p,{children:["It is possible to scale the incoming osc value to a different range by using ",(0,i.jsx)(n.code,{children:"{}"})," after the address inputting a low and high output range separated by a colon ",(0,i.jsx)(n.code,{children:":"}),". The scaling function considers an incoming range of ",(0,i.jsx)(n.code,{children:"0 - 1"})," floatingpoint values. For example to control the ",(0,i.jsx)(n.code,{children:"note()"})," and ",(0,i.jsx)(n.code,{children:"shape()"})," ranges in a ",(0,i.jsx)(n.code,{children:"synth"})," enter the following:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"new synth saw note(/myOsc/sliderValue3{2:19} 0) shape(1 /myOsc/sliderValue4{50:500}) \n// => converts incoming slider values from 0-1 to 2-19 for note and 0-1 to 50-500 for note length\n"})})]})}function h(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>l,x:()=>d});var i=s(6540);const t={},r=i.createContext(t);function l(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:l(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d744ed8e.650c3870.js b/assets/js/d744ed8e.d33ccab2.js similarity index 60% rename from assets/js/d744ed8e.650c3870.js rename to assets/js/d744ed8e.d33ccab2.js index 87cd971..b35f4d2 100644 --- a/assets/js/d744ed8e.650c3870.js +++ b/assets/js/d744ed8e.d33ccab2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmercury_docs=self.webpackChunkmercury_docs||[]).push([[522],{2176:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>l,contentTitle:()=>t,default:()=>a,frontMatter:()=>o,metadata:()=>c,toc:()=>d});var r=n(4848),i=n(8453);const o={sidebar_position:5,id:"troubleshooting"},t="\ud83d\udea7 Troubleshooting",c={id:"usage/troubleshooting",title:"\ud83d\udea7 Troubleshooting",description:"If you are having issues please follow the steps below:",source:"@site/docs/usage/troubleshooting.md",sourceDirName:"usage",slug:"/usage/troubleshooting",permalink:"/mercury-docs/docs/usage/troubleshooting",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5,id:"troubleshooting"},sidebar:"tutorialSidebar",previous:{title:"\u2328\ufe0f External Editors",permalink:"/mercury-docs/docs/usage/editors"},next:{title:"\ud83d\udce6 Add Mercury in your Site",permalink:"/mercury-docs/docs/usage/embedding"}},l={},d=[{value:"My sounds are not playing",id:"my-sounds-are-not-playing",level:2},{value:"I hear an Alert sound when I execute the code on Mac",id:"i-hear-an-alert-sound-when-i-execute-the-code-on-mac",level:2},{value:"My CPU usage is very high",id:"my-cpu-usage-is-very-high",level:2},{value:"My editor in Mercury4Max is very laggy (low FPS)",id:"my-editor-in-mercury4max-is-very-laggy-low-fps",level:2},{value:"Mercury4Max keeps crashing when I execute code",id:"mercury4max-keeps-crashing-when-i-execute-code",level:2}];function h(e){const s={a:"a",code:"code",h1:"h1",h2:"h2",li:"li",ol:"ol",p:"p",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.h1,{id:"-troubleshooting",children:"\ud83d\udea7 Troubleshooting"}),"\n",(0,r.jsx)(s.p,{children:"If you are having issues please follow the steps below:"}),"\n",(0,r.jsxs)(s.ol,{children:["\n",(0,r.jsx)(s.li,{children:"Check if your issue is part of this troubleshooting page"}),"\n",(0,r.jsxs)(s.li,{children:["Check if your problem was already reported in the ",(0,r.jsx)(s.a,{href:"https://github.com/tmhglnd/mercury/issues",children:"issues"})]}),"\n",(0,r.jsxs)(s.li,{children:["Ask help from the community on the ",(0,r.jsx)(s.a,{href:"https://discord.gg/vt59NYU",children:"Mercury Discord"})]}),"\n",(0,r.jsxs)(s.li,{children:["In case you don't find an answer, please file a ",(0,r.jsx)(s.a,{href:"https://github.com/tmhglnd/mercury/issues/new",children:"new issue"})]}),"\n",(0,r.jsx)(s.li,{children:"Or fix the bug yourself and send me a pull request \ud83d\ude4f (much appreciated!)"}),"\n"]}),"\n",(0,r.jsx)(s.h2,{id:"my-sounds-are-not-playing",children:"My sounds are not playing"}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"in Mercury4Max"})}),"\n",(0,r.jsxs)(s.p,{children:["First make sure you have selected the correct output for your sound in the Audio Settings. Then make sure you have clicked Audio to ",(0,r.jsx)(s.code,{children:"on"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["When the soundfiles don't load correctly the first time you start Mercury you will not hear any sounds playing (for both the ",(0,r.jsx)(s.code,{children:"sample"})," and ",(0,r.jsx)(s.code,{children:"synth"}),")."]}),"\n",(0,r.jsxs)(s.p,{children:["You can add the soundfiles manually by going to ",(0,r.jsx)(s.code,{children:"Sounds > Replace Sounds"}),", then select the folder ",(0,r.jsx)(s.code,{children:"/mercury_v.0.13.0-alpha/mercury_ide/media/samples"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["Do the same for the waveforms: ",(0,r.jsx)(s.code,{children:"Sounds > Replace Waveforms"}),", then select the folder ",(0,r.jsx)(s.code,{children:"/mercury_v.0.13.0-alpha/mercury_ide/media/waveforms"})]}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"in MercuryPlayground"})}),"\n",(0,r.jsx)(s.p,{children:"First make sure you have selected the correct output for your browser to send the sound to. Usually this is the same as your system output."}),"\n",(0,r.jsxs)(s.p,{children:["When the ",(0,r.jsx)(s.code,{children:"loading sounds..."})," message doesn't seem to stop you can try refreshing the page, sometimes it can get stuck."]}),"\n",(0,r.jsx)(s.p,{children:"Check your internet connection speed, loading the sounds can take a bit of time."}),"\n",(0,r.jsxs)(s.p,{children:["If the website doesn't seem to work for you you can try installing it locally. For that see the ",(0,r.jsx)(s.a,{href:"./../getting-started",children:"Getting Started Guide"})]}),"\n",(0,r.jsx)(s.h2,{id:"i-hear-an-alert-sound-when-i-execute-the-code-on-mac",children:"I hear an Alert sound when I execute the code on Mac"}),"\n",(0,r.jsxs)(s.p,{children:['Most Mac users will hear an Alert sound when they hit keycommands that the operating system does not recognize. You can disable the "Alert Volume" in ',(0,r.jsx)(s.code,{children:"System Preferences > Sounds > Sound Effects"}),"."]}),"\n",(0,r.jsx)(s.h2,{id:"my-cpu-usage-is-very-high",children:"My CPU usage is very high"}),"\n",(0,r.jsx)(s.p,{children:"In case you are experiencing a very high cpu usage (resulting in clicks, pops, glitches, crackling, stutter or anything that doesn't sound like it is supposed to) please try:"}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"in Mercury4Max"})}),"\n",(0,r.jsxs)(s.p,{children:["Go to the settings in ",(0,r.jsx)(s.code,{children:"Settings > Audio"}),":"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Total instruments: ",(0,r.jsx)(s.code,{children:"4"})]}),"\n",(0,r.jsxs)(s.li,{children:["Driver: ",(0,r.jsx)(s.code,{children:"Core Audio"})," or ",(0,r.jsx)(s.code,{children:"Asio4All"})]}),"\n",(0,r.jsxs)(s.li,{children:["Samplerate: ",(0,r.jsx)(s.code,{children:"44100"})]}),"\n",(0,r.jsxs)(s.li,{children:["I/O Buffersize: ",(0,r.jsx)(s.code,{children:"1024"})]}),"\n",(0,r.jsxs)(s.li,{children:["Signal Buffersize: ",(0,r.jsx)(s.code,{children:"512"})]}),"\n",(0,r.jsxs)(s.li,{children:["Overdrive: ",(0,r.jsx)(s.code,{children:"on"})]}),"\n",(0,r.jsxs)(s.li,{children:["Audio Interrupt: ",(0,r.jsx)(s.code,{children:"on"})]}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"in MercuryPlayground"})}),"\n",(0,r.jsx)(s.p,{children:"The browser version sadly doesn't have much settings that can be adjusted. The best to do is try using less resources in the code."}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"reverb"})," is an effect that requires quite some processing. Applying reverbs to all instruments can increase the processing and memory usage. Try removing all reverbs to see if that makes a difference. Using less instruments is another good place to start."]}),"\n",(0,r.jsx)(s.h2,{id:"my-editor-in-mercury4max-is-very-laggy-low-fps",children:"My editor in Mercury4Max is very laggy (low FPS)"}),"\n",(0,r.jsx)(s.p,{children:"In case you are experiencing a very laggy editor, slow cursor, low FPS and slow response you can try the following settings:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Aspect Ratio: ",(0,r.jsx)(s.code,{children:"16:10"})]}),"\n",(0,r.jsxs)(s.li,{children:["Resolution: ",(0,r.jsx)(s.code,{children:"540"})]}),"\n",(0,r.jsxs)(s.li,{children:["Visual Resolution: ",(0,r.jsx)(s.code,{children:"270"})]}),"\n",(0,r.jsxs)(s.li,{children:["Window Size: ",(0,r.jsx)(s.code,{children:"540"})]}),"\n",(0,r.jsxs)(s.li,{children:["Sync to Refreshrate: ",(0,r.jsx)(s.code,{children:"off"})]}),"\n",(0,r.jsxs)(s.li,{children:["FPS: ",(0,r.jsx)(s.code,{children:"30"})]}),"\n",(0,r.jsxs)(s.li,{children:["Auto Hide Cursor: ",(0,r.jsx)(s.code,{children:"off"})]}),"\n",(0,r.jsxs)(s.li,{children:["Syphon Output: ",(0,r.jsx)(s.code,{children:"off"})]}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"For Mac users with Retina display and Max version 8.1.0 or higher and MacOS 10.13 or older."}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Go to ",(0,r.jsx)(s.code,{children:"Applications"})," in the Finder"]}),"\n",(0,r.jsxs)(s.li,{children:["Right click ",(0,r.jsx)(s.code,{children:"Max.app"})," (",(0,r.jsx)(s.code,{children:"CMD + Click"}),")"]}),"\n",(0,r.jsxs)(s.li,{children:["Click ",(0,r.jsx)(s.code,{children:"Get Info"})]}),"\n",(0,r.jsxs)(s.li,{children:["Select ",(0,r.jsx)(s.code,{children:"Open in Low Resolution"})]}),"\n",(0,r.jsx)(s.li,{children:"Restart Max and the Mercury project"}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["You can also consider using an ",(0,r.jsx)(s.a,{href:"./../usage/editors",children:"External Editor"})," instead."]}),"\n",(0,r.jsx)(s.h2,{id:"mercury4max-keeps-crashing-when-i-execute-code",children:"Mercury4Max keeps crashing when I execute code"}),"\n",(0,r.jsx)(s.p,{children:"This can indicate that the computer is not able to display the editor or visual extensions correctly. If you are using Mercury just for the sound/sequencing, please try:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Install an ",(0,r.jsx)(s.a,{href:"./../usage/editors",children:"External Editor"})," to work with Mercury4Max"]}),"\n",(0,r.jsxs)(s.li,{children:["Use the ",(0,r.jsx)(s.a,{href:"/mercury-docs/docs/getting-started#-mercuryplayground",children:"MercuryPlayground"})," instead of Max8"]}),"\n"]})]})}function a(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>t,x:()=>c});var r=n(6540);const i={},o=r.createContext(i);function t(e){const s=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function c(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:t(e.components),r.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkmercury_docs=self.webpackChunkmercury_docs||[]).push([[522],{2176:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>l,contentTitle:()=>t,default:()=>a,frontMatter:()=>o,metadata:()=>c,toc:()=>d});var r=n(4848),i=n(8453);const o={sidebar_position:5,id:"troubleshooting"},t="\ud83d\udea7 Troubleshooting",c={id:"usage/troubleshooting",title:"\ud83d\udea7 Troubleshooting",description:"If you are having issues please follow the steps below:",source:"@site/docs/usage/troubleshooting.md",sourceDirName:"usage",slug:"/usage/troubleshooting",permalink:"/mercury-docs/docs/usage/troubleshooting",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5,id:"troubleshooting"},sidebar:"tutorialSidebar",previous:{title:"\u2328\ufe0f External Editors",permalink:"/mercury-docs/docs/usage/editors"},next:{title:"\ud83d\udce6 Add Mercury in your Site",permalink:"/mercury-docs/docs/usage/embedding"}},l={},d=[{value:"My sounds are not playing",id:"my-sounds-are-not-playing",level:2},{value:"I hear an Alert sound when I execute the code on Mac",id:"i-hear-an-alert-sound-when-i-execute-the-code-on-mac",level:2},{value:"My CPU usage is very high",id:"my-cpu-usage-is-very-high",level:2},{value:"My editor in Mercury4Max is very laggy (low FPS)",id:"my-editor-in-mercury4max-is-very-laggy-low-fps",level:2},{value:"Mercury4Max keeps crashing when I execute code",id:"mercury4max-keeps-crashing-when-i-execute-code",level:2}];function h(e){const s={a:"a",code:"code",h1:"h1",h2:"h2",li:"li",ol:"ol",p:"p",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.h1,{id:"-troubleshooting",children:"\ud83d\udea7 Troubleshooting"}),"\n",(0,r.jsx)(s.p,{children:"If you are having issues please follow the steps below:"}),"\n",(0,r.jsxs)(s.ol,{children:["\n",(0,r.jsx)(s.li,{children:"Check if your issue is part of this troubleshooting page"}),"\n",(0,r.jsxs)(s.li,{children:["Check if your problem was already reported in the ",(0,r.jsx)(s.a,{href:"https://github.com/tmhglnd/mercury/issues",children:"issues"})]}),"\n",(0,r.jsxs)(s.li,{children:["Ask help from the community on the ",(0,r.jsx)(s.a,{href:"https://discord.gg/vt59NYU",children:"Mercury Discord"})]}),"\n",(0,r.jsxs)(s.li,{children:["In case you don't find an answer, please file a ",(0,r.jsx)(s.a,{href:"https://github.com/tmhglnd/mercury/issues/new",children:"new issue"})]}),"\n",(0,r.jsx)(s.li,{children:"Or fix the bug yourself and send me a pull request \ud83d\ude4f (much appreciated!)"}),"\n"]}),"\n",(0,r.jsx)(s.h2,{id:"my-sounds-are-not-playing",children:"My sounds are not playing"}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"in Mercury4Max"})}),"\n",(0,r.jsxs)(s.p,{children:["First make sure you have selected the correct output for your sound in the Audio Settings. Then make sure you have clicked Audio to ",(0,r.jsx)(s.code,{children:"on"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["When the soundfiles don't load correctly the first time you start Mercury you will not hear any sounds playing (for both the ",(0,r.jsx)(s.code,{children:"sample"})," and ",(0,r.jsx)(s.code,{children:"synth"}),")."]}),"\n",(0,r.jsxs)(s.p,{children:["You can add the soundfiles manually by going to ",(0,r.jsx)(s.code,{children:"Sounds > Replace Sounds"}),", then select the folder ",(0,r.jsx)(s.code,{children:"/mercury_v.0.13.0-alpha/mercury_ide/media/samples"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["Do the same for the waveforms: ",(0,r.jsx)(s.code,{children:"Sounds > Replace Waveforms"}),", then select the folder ",(0,r.jsx)(s.code,{children:"/mercury_v.0.13.0-alpha/mercury_ide/media/waveforms"})]}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"in MercuryPlayground"})}),"\n",(0,r.jsx)(s.p,{children:"First make sure you have selected the correct output for your browser to send the sound to. Usually this is the same as your system output."}),"\n",(0,r.jsxs)(s.p,{children:["When the ",(0,r.jsx)(s.code,{children:"loading sounds..."})," message doesn't seem to stop you can try refreshing the page, sometimes it can get stuck."]}),"\n",(0,r.jsx)(s.p,{children:"Check your internet connection speed, loading the sounds can take a bit of time."}),"\n",(0,r.jsxs)(s.p,{children:["If the website doesn't seem to work for you you can try installing it locally. For that see the ",(0,r.jsx)(s.a,{href:"./../getting-started",children:"Getting Started Guide"})]}),"\n",(0,r.jsx)(s.h2,{id:"i-hear-an-alert-sound-when-i-execute-the-code-on-mac",children:"I hear an Alert sound when I execute the code on Mac"}),"\n",(0,r.jsxs)(s.p,{children:['Most Mac users will hear an Alert sound when they hit keycommands that the operating system does not recognize. You can disable the "Alert Volume" in ',(0,r.jsx)(s.code,{children:"System Preferences > Sounds > Sound Effects"}),"."]}),"\n",(0,r.jsx)(s.h2,{id:"my-cpu-usage-is-very-high",children:"My CPU usage is very high"}),"\n",(0,r.jsx)(s.p,{children:"In case you are experiencing a very high cpu usage (resulting in clicks, pops, glitches, crackling, stutter or anything that doesn't sound like it is supposed to) please try:"}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"in Mercury4Max"})}),"\n",(0,r.jsxs)(s.p,{children:["Go to the settings in ",(0,r.jsx)(s.code,{children:"Settings > Audio"}),":"]}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Total instruments: ",(0,r.jsx)(s.code,{children:"4"})]}),"\n",(0,r.jsxs)(s.li,{children:["Driver: ",(0,r.jsx)(s.code,{children:"Core Audio"})," or ",(0,r.jsx)(s.code,{children:"Asio4All"})]}),"\n",(0,r.jsxs)(s.li,{children:["Samplerate: ",(0,r.jsx)(s.code,{children:"44100"})]}),"\n",(0,r.jsxs)(s.li,{children:["I/O Buffersize: ",(0,r.jsx)(s.code,{children:"1024"})]}),"\n",(0,r.jsxs)(s.li,{children:["Signal Buffersize: ",(0,r.jsx)(s.code,{children:"512"})]}),"\n",(0,r.jsxs)(s.li,{children:["Overdrive: ",(0,r.jsx)(s.code,{children:"on"})]}),"\n",(0,r.jsxs)(s.li,{children:["Audio Interrupt: ",(0,r.jsx)(s.code,{children:"on"})]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["For a detailed explanation of all the Audio Settings please go ",(0,r.jsx)(s.a,{href:"/mercury-docs/docs/usage/mercury4max-overview#audio-setup",children:"here"})]}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.strong,{children:"in MercuryPlayground"})}),"\n",(0,r.jsx)(s.p,{children:"The browser version sadly doesn't have much settings that can be adjusted. The best to do is try using less resources in the code."}),"\n",(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.code,{children:"reverb"})," is an effect that requires quite some processing. Applying reverbs to all instruments can increase the processing and memory usage. Try removing all reverbs to see if that makes a difference. Using less instruments is another good place to start."]}),"\n",(0,r.jsx)(s.h2,{id:"my-editor-in-mercury4max-is-very-laggy-low-fps",children:"My editor in Mercury4Max is very laggy (low FPS)"}),"\n",(0,r.jsx)(s.p,{children:"In case you are experiencing a very laggy editor, slow cursor, low FPS and slow response you can try the following settings:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Aspect Ratio: ",(0,r.jsx)(s.code,{children:"16:10"})]}),"\n",(0,r.jsxs)(s.li,{children:["Resolution: ",(0,r.jsx)(s.code,{children:"540"})]}),"\n",(0,r.jsxs)(s.li,{children:["Visual Resolution: ",(0,r.jsx)(s.code,{children:"270"})]}),"\n",(0,r.jsxs)(s.li,{children:["Window Size: ",(0,r.jsx)(s.code,{children:"540"})]}),"\n",(0,r.jsxs)(s.li,{children:["Sync to Refreshrate: ",(0,r.jsx)(s.code,{children:"off"})]}),"\n",(0,r.jsxs)(s.li,{children:["FPS: ",(0,r.jsx)(s.code,{children:"30"})]}),"\n",(0,r.jsxs)(s.li,{children:["Auto Hide Cursor: ",(0,r.jsx)(s.code,{children:"off"})]}),"\n",(0,r.jsxs)(s.li,{children:["Syphon Output: ",(0,r.jsx)(s.code,{children:"off"})]}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"For Mac users with Retina display and Max version 8.1.0 or higher and MacOS 10.13 or older."}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Go to ",(0,r.jsx)(s.code,{children:"Applications"})," in the Finder"]}),"\n",(0,r.jsxs)(s.li,{children:["Right click ",(0,r.jsx)(s.code,{children:"Max.app"})," (",(0,r.jsx)(s.code,{children:"CMD + Click"}),")"]}),"\n",(0,r.jsxs)(s.li,{children:["Click ",(0,r.jsx)(s.code,{children:"Get Info"})]}),"\n",(0,r.jsxs)(s.li,{children:["Select ",(0,r.jsx)(s.code,{children:"Open in Low Resolution"})]}),"\n",(0,r.jsx)(s.li,{children:"Restart Max and the Mercury project"}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["You can also consider using an ",(0,r.jsx)(s.a,{href:"./../usage/editors",children:"External Editor"})," instead."]}),"\n",(0,r.jsx)(s.h2,{id:"mercury4max-keeps-crashing-when-i-execute-code",children:"Mercury4Max keeps crashing when I execute code"}),"\n",(0,r.jsx)(s.p,{children:"This can indicate that the computer is not able to display the editor or visual extensions correctly. If you are using Mercury just for the sound/sequencing, please try:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["Install an ",(0,r.jsx)(s.a,{href:"./../usage/editors",children:"External Editor"})," to work with Mercury4Max"]}),"\n",(0,r.jsxs)(s.li,{children:["Use the ",(0,r.jsx)(s.a,{href:"/mercury-docs/docs/getting-started#-mercuryplayground",children:"MercuryPlayground"})," instead of Max8"]}),"\n"]})]})}function a(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>t,x:()=>c});var r=n(6540);const i={},o=r.createContext(i);function t(e){const s=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function c(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:t(e.components),r.createElement(o.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.5f0b5ab8.js b/assets/js/runtime~main.c7f22998.js similarity index 96% rename from assets/js/runtime~main.5f0b5ab8.js rename to assets/js/runtime~main.c7f22998.js index 9e396e4..dc80e91 100644 --- a/assets/js/runtime~main.5f0b5ab8.js +++ b/assets/js/runtime~main.c7f22998.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,r,t,c,d={},o={};function b(e){var a=o[e];if(void 0!==a)return a.exports;var r=o[e]={id:e,loaded:!1,exports:{}};return d[e].call(r.exports,r,r.exports,b),r.loaded=!0,r.exports}b.m=d,b.c=o,e=[],b.O=(a,r,t,c)=>{if(!r){var d=1/0;for(i=0;i=c)&&Object.keys(b.O).every((e=>b.O[e](r[f])))?r.splice(f--,1):(o=!1,c0&&e[i-1][2]>c;i--)e[i]=e[i-1];e[i]=[r,t,c]},b.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return b.d(a,{a:a}),a},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,b.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var c=Object.create(null);b.r(c);var d={};a=a||[null,r({}),r([]),r(r)];for(var o=2&t&&e;"object"==typeof o&&!~a.indexOf(o);o=r(o))Object.getOwnPropertyNames(o).forEach((a=>d[a]=()=>e[a]));return d.default=()=>e,b.d(c,d),c},b.d=(e,a)=>{for(var r in a)b.o(a,r)&&!b.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:a[r]})},b.f={},b.e=e=>Promise.all(Object.keys(b.f).reduce(((a,r)=>(b.f[r](e,a),a)),[])),b.u=e=>"assets/js/"+({28:"e59418e5",29:"6923d57d",30:"3ede6e69",48:"a94703ab",61:"1f391b9e",98:"a7bd4aaa",134:"393be207",196:"23c07e7b",258:"2c9d0a4b",283:"654de440",295:"f6471318",316:"8232b325",386:"ebfee794",401:"17896441",452:"643a29c7",458:"dd7a93eb",464:"b096b7b7",470:"610af566",485:"a63bd564",492:"3e4a7cec",503:"83adf833",522:"d744ed8e",543:"e92cf459",581:"935f2afb",591:"4ba7e5a3",613:"ba4e2648",634:"c4f5d8e4",647:"5e95c892",664:"bbca2b71",707:"d44737fc",716:"89be51a8",866:"3025b0a2",868:"6c9bc4e1",888:"2730afdf",924:"d589d3a7",969:"14eb3368",991:"46fe9eed",992:"ceb5ae55"}[e]||e)+"."+{28:"6d6ab210",29:"6ba4eb9e",30:"ced4de6f",48:"a51504f0",61:"4bec805b",98:"0bcbea7a",134:"0dcbc98b",196:"3df6e934",237:"8c1c116a",258:"a5d70420",283:"09c81628",295:"990763e5",316:"7da8e6e8",386:"1d2c29fe",401:"c6099902",452:"4bd8bbbe",458:"2e6aedd4",464:"547e8c9c",470:"59b5041c",485:"588ce5a3",492:"8b9f58aa",503:"caecc14c",522:"650c3870",543:"075f9842",581:"3129e5a4",591:"73ff730d",613:"1e7cf947",634:"70000c2d",647:"1a035e79",664:"54380d68",674:"97d286b4",707:"84ec8ff6",716:"856e73aa",866:"df6fc0f2",868:"1cb2c0d2",888:"233180c6",924:"c3a04cdd",969:"3d3f0eda",991:"1d45a538",992:"55b45ec3"}[e]+".js",b.miniCssF=e=>{},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),t={},c="mercury-docs:",b.l=(e,a,r,d)=>{if(t[e])t[e].push(a);else{var o,f;if(void 0!==r)for(var n=document.getElementsByTagName("script"),i=0;i{o.onerror=o.onload=null,clearTimeout(s);var c=t[e];if(delete t[e],o.parentNode&&o.parentNode.removeChild(o),c&&c.forEach((e=>e(r))),a)return a(r)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),f&&document.head.appendChild(o)}},b.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.p="/mercury-docs/",b.gca=function(e){return e={17896441:"401",e59418e5:"28","6923d57d":"29","3ede6e69":"30",a94703ab:"48","1f391b9e":"61",a7bd4aaa:"98","393be207":"134","23c07e7b":"196","2c9d0a4b":"258","654de440":"283",f6471318:"295","8232b325":"316",ebfee794:"386","643a29c7":"452",dd7a93eb:"458",b096b7b7:"464","610af566":"470",a63bd564:"485","3e4a7cec":"492","83adf833":"503",d744ed8e:"522",e92cf459:"543","935f2afb":"581","4ba7e5a3":"591",ba4e2648:"613",c4f5d8e4:"634","5e95c892":"647",bbca2b71:"664",d44737fc:"707","89be51a8":"716","3025b0a2":"866","6c9bc4e1":"868","2730afdf":"888",d589d3a7:"924","14eb3368":"969","46fe9eed":"991",ceb5ae55:"992"}[e]||e,b.p+b.u(e)},(()=>{var e={354:0,869:0};b.f.j=(a,r)=>{var t=b.o(e,a)?e[a]:void 0;if(0!==t)if(t)r.push(t[2]);else if(/^(354|869)$/.test(a))e[a]=0;else{var c=new Promise(((r,c)=>t=e[a]=[r,c]));r.push(t[2]=c);var d=b.p+b.u(a),o=new Error;b.l(d,(r=>{if(b.o(e,a)&&(0!==(t=e[a])&&(e[a]=void 0),t)){var c=r&&("load"===r.type?"missing":r.type),d=r&&r.target&&r.target.src;o.message="Loading chunk "+a+" failed.\n("+c+": "+d+")",o.name="ChunkLoadError",o.type=c,o.request=d,t[1](o)}}),"chunk-"+a,a)}},b.O.j=a=>0===e[a];var a=(a,r)=>{var t,c,d=r[0],o=r[1],f=r[2],n=0;if(d.some((a=>0!==e[a]))){for(t in o)b.o(o,t)&&(b.m[t]=o[t]);if(f)var i=f(b)}for(a&&a(r);n{"use strict";var e,a,r,t,c,d={},o={};function b(e){var a=o[e];if(void 0!==a)return a.exports;var r=o[e]={id:e,loaded:!1,exports:{}};return d[e].call(r.exports,r,r.exports,b),r.loaded=!0,r.exports}b.m=d,b.c=o,e=[],b.O=(a,r,t,c)=>{if(!r){var d=1/0;for(i=0;i=c)&&Object.keys(b.O).every((e=>b.O[e](r[f])))?r.splice(f--,1):(o=!1,c0&&e[i-1][2]>c;i--)e[i]=e[i-1];e[i]=[r,t,c]},b.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return b.d(a,{a:a}),a},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,b.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var c=Object.create(null);b.r(c);var d={};a=a||[null,r({}),r([]),r(r)];for(var o=2&t&&e;"object"==typeof o&&!~a.indexOf(o);o=r(o))Object.getOwnPropertyNames(o).forEach((a=>d[a]=()=>e[a]));return d.default=()=>e,b.d(c,d),c},b.d=(e,a)=>{for(var r in a)b.o(a,r)&&!b.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:a[r]})},b.f={},b.e=e=>Promise.all(Object.keys(b.f).reduce(((a,r)=>(b.f[r](e,a),a)),[])),b.u=e=>"assets/js/"+({28:"e59418e5",29:"6923d57d",30:"3ede6e69",48:"a94703ab",61:"1f391b9e",98:"a7bd4aaa",134:"393be207",196:"23c07e7b",258:"2c9d0a4b",283:"654de440",295:"f6471318",316:"8232b325",386:"ebfee794",401:"17896441",452:"643a29c7",458:"dd7a93eb",464:"b096b7b7",470:"610af566",485:"a63bd564",492:"3e4a7cec",503:"83adf833",522:"d744ed8e",543:"e92cf459",581:"935f2afb",591:"4ba7e5a3",613:"ba4e2648",634:"c4f5d8e4",647:"5e95c892",664:"bbca2b71",707:"d44737fc",716:"89be51a8",866:"3025b0a2",868:"6c9bc4e1",888:"2730afdf",924:"d589d3a7",969:"14eb3368",991:"46fe9eed",992:"ceb5ae55"}[e]||e)+"."+{28:"6d6ab210",29:"6ba4eb9e",30:"ced4de6f",48:"a51504f0",61:"4bec805b",98:"0bcbea7a",134:"0dcbc98b",196:"3df6e934",237:"8c1c116a",258:"a5d70420",283:"09c81628",295:"990763e5",316:"7da8e6e8",386:"1d2c29fe",401:"c6099902",452:"4bd8bbbe",458:"2e6aedd4",464:"547e8c9c",470:"59b5041c",485:"588ce5a3",492:"8b9f58aa",503:"caecc14c",522:"d33ccab2",543:"075f9842",581:"3129e5a4",591:"73ff730d",613:"1e7cf947",634:"70000c2d",647:"1a035e79",664:"bfbc1ab2",674:"97d286b4",707:"84ec8ff6",716:"6e2b4c60",866:"df6fc0f2",868:"1cb2c0d2",888:"233180c6",924:"c3a04cdd",969:"3d3f0eda",991:"1d45a538",992:"55b45ec3"}[e]+".js",b.miniCssF=e=>{},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),t={},c="mercury-docs:",b.l=(e,a,r,d)=>{if(t[e])t[e].push(a);else{var o,f;if(void 0!==r)for(var n=document.getElementsByTagName("script"),i=0;i{o.onerror=o.onload=null,clearTimeout(s);var c=t[e];if(delete t[e],o.parentNode&&o.parentNode.removeChild(o),c&&c.forEach((e=>e(r))),a)return a(r)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),f&&document.head.appendChild(o)}},b.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.p="/mercury-docs/",b.gca=function(e){return e={17896441:"401",e59418e5:"28","6923d57d":"29","3ede6e69":"30",a94703ab:"48","1f391b9e":"61",a7bd4aaa:"98","393be207":"134","23c07e7b":"196","2c9d0a4b":"258","654de440":"283",f6471318:"295","8232b325":"316",ebfee794:"386","643a29c7":"452",dd7a93eb:"458",b096b7b7:"464","610af566":"470",a63bd564:"485","3e4a7cec":"492","83adf833":"503",d744ed8e:"522",e92cf459:"543","935f2afb":"581","4ba7e5a3":"591",ba4e2648:"613",c4f5d8e4:"634","5e95c892":"647",bbca2b71:"664",d44737fc:"707","89be51a8":"716","3025b0a2":"866","6c9bc4e1":"868","2730afdf":"888",d589d3a7:"924","14eb3368":"969","46fe9eed":"991",ceb5ae55:"992"}[e]||e,b.p+b.u(e)},(()=>{var e={354:0,869:0};b.f.j=(a,r)=>{var t=b.o(e,a)?e[a]:void 0;if(0!==t)if(t)r.push(t[2]);else if(/^(354|869)$/.test(a))e[a]=0;else{var c=new Promise(((r,c)=>t=e[a]=[r,c]));r.push(t[2]=c);var d=b.p+b.u(a),o=new Error;b.l(d,(r=>{if(b.o(e,a)&&(0!==(t=e[a])&&(e[a]=void 0),t)){var c=r&&("load"===r.type?"missing":r.type),d=r&&r.target&&r.target.src;o.message="Loading chunk "+a+" failed.\n("+c+": "+d+")",o.name="ChunkLoadError",o.type=c,o.request=d,t[1](o)}}),"chunk-"+a,a)}},b.O.j=a=>0===e[a];var a=(a,r)=>{var t,c,d=r[0],o=r[1],f=r[2],n=0;if(d.some((a=>0!==e[a]))){for(t in o)b.o(o,t)&&(b.m[t]=o[t]);if(f)var i=f(b)}for(a&&a(r);n ๐ŸŽฎ Quick Features Overview | Mercury - + diff --git a/docs/about/index.html b/docs/about/index.html index 6a59355..accb92d 100644 --- a/docs/about/index.html +++ b/docs/about/index.html @@ -4,7 +4,7 @@ ๐Ÿค” What is Mercury? | Mercury - + diff --git a/docs/about/inspiration/index.html b/docs/about/inspiration/index.html index 8d97c20..bc4f54a 100644 --- a/docs/about/inspiration/index.html +++ b/docs/about/inspiration/index.html @@ -4,7 +4,7 @@ ๐Ÿ‘พ Made with Mercury | Mercury - + diff --git a/docs/about/vision/index.html b/docs/about/vision/index.html index 5c191bb..252f591 100644 --- a/docs/about/vision/index.html +++ b/docs/about/vision/index.html @@ -4,7 +4,7 @@ ๐Ÿ”ญ What can you do with Mercury? | Mercury - + diff --git a/docs/category/-about/index.html b/docs/category/-about/index.html index 71b5bad..54c9cda 100644 --- a/docs/category/-about/index.html +++ b/docs/category/-about/index.html @@ -4,7 +4,7 @@ ๐Ÿ“Ÿ About | Mercury - + diff --git a/docs/category/-reference/index.html b/docs/category/-reference/index.html index 8510a2f..d47dde1 100644 --- a/docs/category/-reference/index.html +++ b/docs/category/-reference/index.html @@ -4,7 +4,7 @@ ๐Ÿ“– Reference | Mercury - + diff --git a/docs/category/-usage/index.html b/docs/category/-usage/index.html index cb02b80..4f7045e 100644 --- a/docs/category/-usage/index.html +++ b/docs/category/-usage/index.html @@ -4,7 +4,7 @@ ๐Ÿ•น Usage | Mercury - + diff --git a/docs/collaborate/index.html b/docs/collaborate/index.html index 45e477c..6c9379d 100644 --- a/docs/collaborate/index.html +++ b/docs/collaborate/index.html @@ -4,7 +4,7 @@ ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป Collaborative Coding | Mercury - + diff --git a/docs/contribute/index.html b/docs/contribute/index.html index bcc7ff4..64d5d02 100644 --- a/docs/contribute/index.html +++ b/docs/contribute/index.html @@ -4,7 +4,7 @@ ๐Ÿ“ Contribute | Mercury - + diff --git a/docs/getting-started/index.html b/docs/getting-started/index.html index 21ec97f..66797fc 100644 --- a/docs/getting-started/index.html +++ b/docs/getting-started/index.html @@ -4,7 +4,7 @@ ๐Ÿš€ Getting Started | Mercury - + diff --git a/docs/reference/actions/index.html b/docs/reference/actions/index.html index f58659f..5b63172 100644 --- a/docs/reference/actions/index.html +++ b/docs/reference/actions/index.html @@ -4,7 +4,7 @@ Actions | Mercury - + @@ -27,7 +27,7 @@

new
new synth saw shape(20 500)

new sample kick_909 time(1/8)

new midi "AU DLS Synth 1" note(3 1)

By default Mercury has a small library of samples included in the environment. It is possible to include your own sounds as well:

diff --git a/docs/reference/effects/index.html b/docs/reference/effects/index.html index 9288629..784c78d 100644 --- a/docs/reference/effects/index.html +++ b/docs/reference/effects/index.html @@ -4,7 +4,7 @@ Instrument Effects | Mercury - + diff --git a/docs/reference/global/index.html b/docs/reference/global/index.html index 5df73cf..8cbbca2 100644 --- a/docs/reference/global/index.html +++ b/docs/reference/global/index.html @@ -4,7 +4,7 @@ Global Settings | Mercury - + diff --git a/docs/reference/instruments/index.html b/docs/reference/instruments/index.html index a375a56..2478d8e 100644 --- a/docs/reference/instruments/index.html +++ b/docs/reference/instruments/index.html @@ -4,7 +4,7 @@ Instrument Functions | Mercury - + @@ -217,6 +217,11 @@

noisesampleโ€‹

The sample instrument allows you to play sound-recordings and loops. These so called "samples" are loaded in memory and can be accessed by their filename (without the extension).

new sample <sample-name>
+

speedโ€‹

Set the playback speed for the sample, where 1 = original speed, 0.5 = half the speed and 2 = twice as fast. Adjusting the playback speed will change the pitch of the sample. A negative value will play the sample backwards starting at the end (or at the start() position)

arguments

diff --git a/docs/reference/list-functions/index.html b/docs/reference/list-functions/index.html index 922df6b..43e2f82 100644 --- a/docs/reference/list-functions/index.html +++ b/docs/reference/list-functions/index.html @@ -4,7 +4,7 @@ List Functions | Mercury - + diff --git a/docs/reference/syntax/index.html b/docs/reference/syntax/index.html index 39065a0..a2bb5f1 100644 --- a/docs/reference/syntax/index.html +++ b/docs/reference/syntax/index.html @@ -4,7 +4,7 @@ Syntax Overview | Mercury - + diff --git a/docs/usage/coding/index.html b/docs/usage/coding/index.html index c174ab1..c771a62 100644 --- a/docs/usage/coding/index.html +++ b/docs/usage/coding/index.html @@ -4,7 +4,7 @@ ๐Ÿค“ Coding in Mercury | Mercury - + diff --git a/docs/usage/editors/index.html b/docs/usage/editors/index.html index ebb77b4..472510b 100644 --- a/docs/usage/editors/index.html +++ b/docs/usage/editors/index.html @@ -4,7 +4,7 @@ โŒจ๏ธ External Editors | Mercury - + diff --git a/docs/usage/embedding/index.html b/docs/usage/embedding/index.html index 7238c28..0669f60 100644 --- a/docs/usage/embedding/index.html +++ b/docs/usage/embedding/index.html @@ -4,7 +4,7 @@ ๐Ÿ“ฆ Add Mercury in your Site | Mercury - + diff --git a/docs/usage/extending/index.html b/docs/usage/extending/index.html index e582d1f..722d039 100644 --- a/docs/usage/extending/index.html +++ b/docs/usage/extending/index.html @@ -4,7 +4,7 @@ ๐Ÿ›  Extending Mercury | Mercury - + diff --git a/docs/usage/howto/index.html b/docs/usage/howto/index.html index ae65b2b..d61c358 100644 --- a/docs/usage/howto/index.html +++ b/docs/usage/howto/index.html @@ -4,7 +4,7 @@ ๐Ÿ“š How To's | Mercury - + diff --git a/docs/usage/mercury4max-overview/index.html b/docs/usage/mercury4max-overview/index.html index 8269e47..cc4a212 100644 --- a/docs/usage/mercury4max-overview/index.html +++ b/docs/usage/mercury4max-overview/index.html @@ -4,7 +4,7 @@ ๐Ÿ” Mercury4Max Overview | Mercury - + diff --git a/docs/usage/playground-overview/index.html b/docs/usage/playground-overview/index.html index c7c4805..1249fcb 100644 --- a/docs/usage/playground-overview/index.html +++ b/docs/usage/playground-overview/index.html @@ -4,7 +4,7 @@ ๐Ÿ› MercuryPlayground Overview | Mercury - + diff --git a/docs/usage/shortkeys/index.html b/docs/usage/shortkeys/index.html index 915f085..4f2ed3c 100644 --- a/docs/usage/shortkeys/index.html +++ b/docs/usage/shortkeys/index.html @@ -4,7 +4,7 @@ ๐Ÿฉณ Short-keys | Mercury - + diff --git a/docs/usage/sounds/index.html b/docs/usage/sounds/index.html index 64d60cd..1daaffa 100644 --- a/docs/usage/sounds/index.html +++ b/docs/usage/sounds/index.html @@ -4,7 +4,7 @@ ๐Ÿ“ข Sounds in Mercury | Mercury - + diff --git a/docs/usage/troubleshooting/index.html b/docs/usage/troubleshooting/index.html index f6f9c83..859fb34 100644 --- a/docs/usage/troubleshooting/index.html +++ b/docs/usage/troubleshooting/index.html @@ -4,7 +4,7 @@ ๐Ÿšง Troubleshooting | Mercury - + @@ -43,6 +43,7 @@

My
  • Overdrive: on
  • Audio Interrupt: on
  • +

    For a detailed explanation of all the Audio Settings please go here

    in MercuryPlayground

    The browser version sadly doesn't have much settings that can be adjusted. The best to do is try using less resources in the code.

    reverb is an effect that requires quite some processing. Applying reverbs to all instruments can increase the processing and memory usage. Try removing all reverbs to see if that makes a difference. Using less instruments is another good place to start.

    diff --git a/docs/welcome/index.html b/docs/welcome/index.html index aa9895b..aed0c1d 100644 --- a/docs/welcome/index.html +++ b/docs/welcome/index.html @@ -4,7 +4,7 @@ ๐Ÿ‘‹ Welcome | Mercury - + diff --git a/index.html b/index.html index 41f8b58..b325750 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Mercury Docs | Mercury - + diff --git a/markdown-page/index.html b/markdown-page/index.html index 4f584ad..977617a 100644 --- a/markdown-page/index.html +++ b/markdown-page/index.html @@ -4,7 +4,7 @@ Markdown page example | Mercury - +