1"use strict";(self.webpackChunkweb_music_score_org=self.webpackChunkweb_music_score_org||[]).push([["9638"],{4206(e,n,s){s.r(n),s.d(n,{metadata:()=>t,default:()=>x,frontMatter:()=>c,contentTitle:()=>a,toc:()=>h,assets:()=>o});var t=JSON.parse('{"id":"create-doc/add-rest","title":"Add Rest","description":"Arguments:","source":"@site/docs/060-create-doc/110-add-rest.md","sourceDirName":"060-create-doc","slug":"/create-doc/add-rest","permalink":"/docs/v7/create-doc/add-rest","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":110,"frontMatter":{"sidebar_position":110},"sidebar":"docSidebar","previous":{"title":"Add Note","permalink":"/docs/v7/create-doc/add-note"},"next":{"title":"Add Tuplet","permalink":"/docs/v7/create-doc/add-tuplet"}}'),d=s(4848),r=s(8453),i=s(7282);let l=` 2function ExampleCode() { 3 const doc = new Score.DocumentBuilder() 4 .setTimeSignature("4/4") 5 .addRest(0, "1n") 6 .addMeasure() 7 .addRest(1, "2n") 8 .addRest(1, "4n") 9 .addRest(1, "8n") 10 .addRest(1, "16n", { staffPos: "G4" }) 11 .addRest(1, "16n", { staffPos: "C5" }) 12 .addMeasure() 13 .addRest(2, "32n") 14 .fillWithRests() 15 .getDocument(); 16 17 return <div>
18 <ReactUI.WmsControls doc={doc} playStopPause /> 19 <br /> 20 <ReactUI.WmsView doc={doc} /> 21 </div>; 22}`,c={sidebar_position:110},a="Add Rest",o={},h=[{value:"Live Example",id:"live-example",level:2}];function u(e){let n={code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.header,{children:(0,d.jsx)(n.h1,{id:"add-rest",children:"Add Rest"})}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",children:'// Add rest.\r\nbuilder.addRest(voiceId, restLength, restOptions?);\r\n\r\n// Example: add quarter rest\r\nbuilder.addRest(0, "4n");\n'})}),"\n",(0,d.jsx)(n.p,{children:"Arguments:"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"voiceId"}),"\r\nThere are 4 voice tracks: ",(0,d.jsx)(n.code,{children:"0"}),", ",(0,d.jsx)(n.code,{children:"1"}),", ",(0,d.jsx)(n.code,{children:"2"})," and ",(0,d.jsx)(n.code,{children:"3"}),"."]}),"\n"]}),"\n",(0,d.jsxs)(n.li,{children:["\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"restLength"}),"\r\nRest length (equal to note length) can be:"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:'"1n"'})," (whole note), ",(0,d.jsx)(n.code,{children:'"2n"'})," (half note), etc."]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:'"4."'})," (dotted quarter note), ",(0,d.jsx)(n.code,{children:'"4.."'})," (double dotted quarter note), etc."]}),"\n"]}),"\n"]}),"\n",(0,d.jsxs)(n.li,{children:["\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.code,{children:"restOptions"})," (optional)\r\nRest options is object. All fields are optional."]}),"\n"]}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-ts",children:'{\r\n staffPos: Note | string | number, // position on staff (e.g. "C4")\r\n hide: boolean // invisible rest\r\n}\n'})}),"\n",(0,d.jsx)(n.h2,{id:"live-example",children:"Live Example"}),"\n",(0,d.jsx)(i.r,{code:l})]})}function x(e={}){let{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(u,{...e})}):u(e)}},7282(e,n,s){s.d(n,{r:()=>h});var t,d=s(4848),r=s(6540),i=s(923),l=s(85),c=s(9526);async function a(){let[e,n,t,d,r,i]=await Promise.all([s.e("8040").then(s.bind(s,8923)),Promise.all([s.e("8040"),s.e("4818"),s.e("9171")]).then(s.bind(s,6462)),Promise.all([s.e("8040"),s.e("4818"),s.e("9171"),s.e("5099"),s.e("5851")]).then(s.bind(s,6838)),Promise.all([s.e("8040"),s.e("4818")]).then(s.bind(s,8793)),Promise.all([s.e("8040"),s.e("4818"),s.e("9171"),s.e("5099")]).then(s.bind(s,486)),Promise.all([s.e("8040"),s.e("4818"),s.e("9171"),s.e("5099"),s.e("80")]).then(s.bind(s,2515))]);return{Core:e,Audio:n,ReactUI:t,Theory:d,Score:r,Pieces:i}}function o(e){let[n,l]=r.useState(e.entry.code);return(0,d.jsx)(c.A,{children:()=>{let[c,o]=r.useState(null);if(r.useEffect(()=>{a().then(e=>{o(e)})},[]),!c)return(0,d.jsx)("div",{children:"Loading..."});let{Core:h,Audio:u,ReactUI:x,Score:j,Theory:p,Pieces:m}=c;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(i.Q,{language:"jsx",code:n,scope:{Core:h,Audio:u,Score:j,Theory:p,Pieces:m,ReactUI:x,React:t||(t=s.t(r,2))},children:[(0,d.jsx)(i.w,{onChange:n=>{e.onEdit&&e.onEdit(n),l(n),u.stop()}}),(0,d.jsx)(i.p1,{}),(0,d.jsx)("br",{}),(0,d.jsx)(i.pA,{})]}),(0,d.jsx)("br",{}),(0,d.jsxs)("p",{children:["\u2139\uFE0F Runs on ",(0,d.jsx)("code",{children:h.getLibInfo()}),"."]})]})}})}function h(e){let[n,s]=r.useState(0),t=(0,l.M)(e.code),i=t[n];return(0,d.jsxs)(d.Fragment,{children:[t.length>1?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("select",{value:n,onChange:e=>s(Number(e.target.value)),className:"select",children:t.map((e,n)=>(0,d.jsx)("option",{value:n,children:e.name},n))}),(0,d.jsx)("br",{}),(0,d.jsx)("br",{})]}):null,(0,d.jsx)(o,{entry:i},n)]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.