PageSourceSearch

https://mastering.to/assets/GenreReference-MnmaP0z6.js

js mastering.to collected 2026-10-02 01:09:03 UTC 7,734 bytes, 18 lines download raw bytes

1import{n as U,j as o}from"./index-DGKNtf3q.js";import{b as H}from"./vendor-Djr1IunZ.js";import{a as N,b as A,G as ee}from"./genre-library-bo01yQ8l.js";function R(n,s,l){if(l<=n[0])return s[0];if(l>=n[n.length-1])return s[s.length-1];for(let i=0;i<n.length-1;i++)if(l>=n[i]&&l<=n[i+1]){const r=(l-n[i])/(n[i+1]-n[i]);return s[i]+r*(s[i+1]-s[i])}return s[s.length-1]}function te(n){const s=[...n].sort((i,r)=>i-r),l=Math.floor(s.length/2);return s.length%2?s[l]:(s[l-1]+s[l])/2}function C(n){return n>=1e3?`${(n/1e3).toFixed(n>=1e4?0:1)}k`:Math.round(n).toString()}function re({genreSpectrum:n}){const s=U(),[l,i]=H.useState("pop"),r=N.genres[l],v=N.frequencies,d=H.useMemo(()=>{if(!r||!n)return null;const e=n.frequencies,t=n.dB,x=[];for(let a=0;a<e.length;a++){const k=R(v,r.mean,e[a]);x.push(t[a]-k)}const j=te(x),Z=t.map(a=>a-j),w=e.map((a,k)=>{const h=Z[k],u=R(v,r.mean,a),F=R(v,r.high,a),y=R(v,r.low,a),S=h>=y&&h<=F,W=h<y?h-y:h>F?h-F:0;return{freq:a,userVal:h,gMean:u,gHigh:F,gLow:y,inRange:S,deviation:W}}),K=(r.bands||[]).map(a=>{const[k,h]=a.range,u=w.filter(f=>f.freq>=k&&f.freq<=h);if(u.length===0)return{...a,avgDev:0,maxDev:0,pctInRange:100,status:"pass"};const y=u.filter(f=>f.inRange).length/u.length*100,S=u.reduce((f,B)=>f+B.deviation,0)/u.length,W=u.reduce((f,B)=>Math.abs(B.deviation)>Math.abs(f)?B.deviation:f,0);let z="pass";return y<50?z="fail":y<75&&(z="warn"),{...a,avgDev:S,maxDev:W,pctInRange:y,status:z}}),Q=w.filter(a=>a.inRange).length/w.length*100;return{points:w,bands:K,overallPct:Q,alignOffset:j}},[r,n,v]);if(!n||!d)return null;const L=600,M=220,c=40,E=16,p=16,b=28,V=L-c-E,P=M-p-b,D=d.points.flatMap(e=>[e.userVal,e.gHigh,e.gLow]),$=Math.min(...D)-3,I=Math.max(...D)+3,g=e=>c+Math.log10(e/20)/Math.log10(2e4/20)*V,m=e=>p+(1-(e-$)/(I-$))*P,J=d.points.map((e,t)=>`${t===0?"M":"L"}${g(e.freq).toFixed(1)},${m(e.gHigh).toFixed(1)}`).join(" "),_=[...d.points].reverse().map((e,t)=>`L${g(e.freq).toFixed(1)},${m(e.gLow).toFixed(1)}`).join(" "),Y=`${J} ${_} Z`,O=d.points.map((e,t)=>`${t===0?"M":"L"}${g(e.freq).toFixed(1)},${m(e.gMean).toFixed(1)}`).join(" ");d.points.map((e,t)=>`${t===0?"M":"L"}${g(e.freq).toFixed(1)},${m(e.userVal).toFixed(1)}`).join(" ");const T=[];for(let e=0;e<d.points.length-1;e++){const t=d.points[e],x=d.points[e+1];t.inRange&&x.inRange,T.push({d:`M${g(t.freq).toFixed(1)},${m(t.userVal).toFixed(1)} L${g(x.freq).toFixed(1)},${m(x.userVal).toFixed(1)}`,color:s})}const q=[20,50,100,200,500,1e3,2e3,5e3,1e4,2e4],X=["Low","Mid","High-Mid","High"],G={pass:"#d8d8e4",warn:s,fail:s};return o.jsxs("div",{children:[o.jsx("style",{children:`
2        .genre-select {
3          background: #0d0f15; color: #e8e8f0; border: 1px solid #2a2d38;
4          border-radius: 6px; padding: 7px 12px; font-family: 'JetBrains Mono', monospace;
5          font-size: 12px; cursor: pointer; outline: none; transition: border-color 0.2s;
6          appearance: none; -webkit-appearance: none;
7          background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23555568' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
8          background-repeat: no-repeat; background-position: right 10px center;
9          padding-right: 28px;
10        }
11        .genre-select:focus { border-color: ${s}55; }
12        .genre-select optgroup { color: #9aa0ad; font-style: normal; }
13        .genre-select option { color: #e8e8f0; background: #0d0f15; }
14        .band-card {
15          background: #0a0c12; border: 1px solid #1a1d28; border-radius: 8px;
16          padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
17        }
18      `}),o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12,marginBottom:16},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[o.jsx("select",{className:"genre-select",value:l,onChange:e=>i(e.target.value),children:A.map(e=>o.jsx("optgroup",{label:e,children:ee.filter(t=>t.category===e).map(t=>o.jsx("option",{value:t.slug,children:t.name},t.slug))},e))}
18),o.jsx("span",{style:{fontSize:10,color:"#9aa0ad",fontFamily:"'JetBrains Mono', monospace",textTransform:"uppercase",letterSpacing:"0.08em"},children:"vs your master"})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.jsx("span",{style:{fontSize:10,color:"#9aa0ad",fontFamily:"'JetBrains Mono', monospace",textTransform:"uppercase",letterSpacing:"0.08em"},children:"Match"}),o.jsxs("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'JetBrains Mono', monospace",color:"#d8d8e4"},children:[d.overallPct.toFixed(0),"%"]})]})]}),o.jsx("div",{style:{background:"#06070b",border:"1px solid #1a1d28",borderRadius:8,padding:"8px 4px 4px",marginBottom:16,overflow:"hidden"},children:o.jsxs("svg",{viewBox:`0 0 ${L} ${M}`,style:{width:"100%",height:"auto",display:"block"},children:[q.map(e=>{const t=g(e);return o.jsxs("g",{children:[o.jsx("line",{x1:t,y1:p,x2:t,y2:M-b,stroke:"#1a1d28",strokeWidth:"0.5"}),o.jsx("text",{x:t,y:M-b+14,textAnchor:"middle",fill:"#44445a",fontSize:"9",fontFamily:"'JetBrains Mono', monospace",children:C(e)})]},e)}),Array.from({length:5},(e,t)=>{const x=$+t/4*(I-$),j=m(x);return o.jsxs("g",{children:[o.jsx("line",{x1:c,y1:j,x2:L-E,y2:j,stroke:"#12141e",strokeWidth:"0.5"}),o.jsx("text",{x:c-4,y:j+3,textAnchor:"end",fill:"#33334a",fontSize:"8",fontFamily:"'JetBrains Mono', monospace",children:x.toFixed(0)})]},t)}),o.jsx("path",{d:Y,fill:"#6a6d80",opacity:"0.08"}),o.jsx("path",{d:J.replace(/^M/,"M"),fill:"none",stroke:"#6a6d80",strokeWidth:"0.8",opacity:"0.25",strokeDasharray:"3,2"}),o.jsx("path",{d:d.points.map((e,t)=>`${t===0?"M":"L"}${g(e.freq).toFixed(1)},${m(e.gLow).toFixed(1)}`).join(" "),fill:"none",stroke:"#6a6d80",strokeWidth:"0.8",opacity:"0.25",strokeDasharray:"3,2"}),o.jsx("path",{d:O,fill:"none",stroke:"#6a6d80",strokeWidth:"1.2",opacity:"0.6"}),T.map((e,t)=>o.jsx("path",{d:e.d,fill:"none",stroke:e.color,strokeWidth:"1.8",strokeLinecap:"round"},t)),(r.bands||[]).slice(0,-1).map((e,t)=>{const x=g(e.range[1]);return o.jsx("line",{x1:x,y1:p,x2:x,y2:M-b,stroke:"#2a2d38",strokeWidth:"0.5",strokeDasharray:"2,3"},t)}),o.jsx("line",{x1:c+4,y1:p+6,x2:c+16,y2:p+6,stroke:s,strokeWidth:"1.8"}),o.jsx("text",{x:c+20,y:p+9,fill:"#8888a0",fontSize:"8",fontFamily:"'JetBrains Mono', monospace",children:"Your master"}),o.jsx("line",{x1:c+100,y1:p+6,x2:c+112,y2:p+6,stroke:"#6a6d80",strokeWidth:"1.2",opacity:"0.6"}),o.jsxs("text",{x:c+116,y:p+9,fill:"#8888a0",fontSize:"8",fontFamily:"'JetBrains Mono', monospace",children:[r.name," target"]}),o.jsx("rect",{x:c+230,y:p+1,width:"10",height:"10",fill:"#6a6d80",opacity:"0.12",stroke:"#6a6d80",strokeWidth:"0.5",rx:"1"}),o.jsx("text",{x:c+244,y:p+9,fill:"#8888a0",fontSize:"8",fontFamily:"'JetBrains Mono', monospace",children:"Tolerance range"})]})}),o.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:8},children:d.bands.map((e,t)=>o.jsxs("div",{className:"band-card",style:{borderColor:G[e.status]+"33"},children:[o.jsx("div",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.1em",color:"#9aa0ad",fontFamily:"'JetBrains Mono', monospace"},children:X[t]||`Band ${t+1}`}),o.jsxs("div",{style:{fontSize:9,color:"#44445a",fontFamily:"'JetBrains Mono', monospace"},children:[C(e.range[0])," – ",C(e.range[1])]}),o.jsxs("div",{style:{fontSize:14,fontWeight:700,fontFamily:"'JetBrains Mono', monospace",color:G[e.status],marginTop:2},children:[e.pctInRange.toFixed(0),"%"]}),o.jsx("div",{style:{fontSize:10,color:"#8888a0"},children:e.status==="pass"?"In range":e.avgDev>0?`+${e.avgDev.toFixed(1)} dB high`:`${e.avgDev.toFixed(1)} dB low`})]},t))})]})}export{re as default};

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.