Bytebeat

Return To bottom
Changelog / Common thread / SthephanShi / kOLbOSa_exe / lhphr / PortablePorcelain / HypernovaHeathen / BaenHoHoHo / SArpnt / hcdphobe / OnixIsThePewterGod / Zackx / GetDolphinedLol / psubscirbe / ChrisRM380 / Kouzerumatsu / MT2023 / Decent-Manager-6169 / Chasyxx / Glebguything / absolute197 / ANoUserXD / MarioFan171

CAPTCHA
 Deletion password
  • Supported file types are JPG, PNG, GIF, WEBP, WEBM, MP4 and MOV.
  • Limit: 4 files, 30 MB per file (60 MB for Passcode users).
  • Images greater than 250x250 will be thumbnailed.
  • 991 unique users on the board.

4972
baglini+-+web+-+photo+43.png
(676.22KB, 765x712)
Write a chord progression player that's shorter and more concise than this one but has far more capabilities and can play rare/strangely-named chords (found in jazz/prog for instance), better if you use cool synths (Float64 wavetables, FM, soft pads) with rhythms, envelopes (ADSR), effects (N-order IIR filters, FDN reverb, chorus, dynamic compression) and arpeggios with some drums (pattern generation (rush/rolls, dynamics, off-beat/humanized swing), membrane simulation (snares, hi-hat, cymbal, bells)), even better if it's microtonal (are new chord notations required for this?) and not the standard 12-TET:
var PI=Math.PI,TAU=2*PI,noteNumbers={C:0,"C#":1,Db:1,D:2,"D#":3,Eb:3,E:4,F:5,"F#":6,Gb:6,G:7,"G#":8,Ab:8,A:9,"A#":10,Bb:10,B:11};function parseChordString(s){var t=s.match(/\/([A-G][#b]?)$/),e=null;t&&(e=t[1],s=s.slice(0,s.length-t[0].length));t=s.match(/^([A-G][#b]?)(.*)$/);if(!t)throw new Error("Invalid chord: "+s);return{rootNote:t[1],modifiers:t[2],bassNote:e}}function parseModifiers(s){let e=[],r=s;for(;0<r.length;){let s=!1,t;(t=r.match(/^maj(7|9|11|13)?/))?(e.push("maj"),t[1]&&e.push(t[1]),r=r.substr(t[0].length),s=!0):(t=r.match(/^m(in)?(7|9|11|13)?/))?(e.push("min"),t[2]&&e.push(t[2]),r=r.substr(t[0].length),s=!0):(t=r.match(/^dim(7)?/))?(e.push("dim"),t[1]&&e.push(t[1]),r=r.substr(t[0].length),s=!0):(t=r.match(/^aug/))?(e.push("aug"),r=r.substr(t[0].length),s=!0):(t=r.match(/^sus(2|4)?/))?(e.push("sus"+(t[1]||"")),r=r.substr(t[0].length),s=!0):(t=r.match(/^add(#|b)?(\d+)/))?(e.push("add"),e.push((t[1]||"")+t[2]),r=r.substr(t[0].length),s=!0):(t=r.match(/^(13|11|9)/))?(e.push(t[1]),r=r.substr(t[1].length),s=!0):(t=r.match(/^([#b])(\d+)/))?(e.push(t[1]+t[2]),r=r.substr(t[0].length),s=!0):(t=r.match(/^6\/9/))?(e.push("6/9"),r=r.substr(4),s=!0):(t=r.match(/^(6|7|5)/))?(e.push(t[1]),r=r.substr(1),s=!0):r=r.substr(1)}return e}var intervalsMap={1:0,2:2,3:4,4:5,5:7,6:9,7:11,9:14,11:17,13:21};function getIntervalFromDegree(s){return intervalsMap[s]||0}function getChordIntervals(s){var t,e=parseModifiers(s),r=[],s="major";return e.includes("maj")?s="major":e.includes("min")?s="minor":e.includes("dim")?s="diminished":e.includes("aug")&&(s="augmented"),"major"==s?r.push(0,4,7):"minor"==s?r.push(0,3,7):"diminished"==s?r.push(0,3,6):"augmented"==s&&r.push(0,4,8),e.includes("maj")&&e.includes("7")?r.push(11):e.includes("7")&&r.push(10),e.includes("9")&&r.push(14),e.includes("11")&&r.push(17),e.includes("13")&&r.push(21),e.includes("6/9")?r.push(9,14):e.includes("6")&&r.push(9),e.includes("add")&&e.filter(s=>s.startsWith("#")||s.startsWith("b")||/^\d+$/.test(s)).forEach(s=>{var t=getIntervalFromDegree(parseInt(s.replace("#","").replace("b","")));s.startsWith("#")&&t++,s.startsWith("b")&&t--,r.push(t)}),e.includes("sus2")?0<=(t=r.indexOf("major"==s?4:3))&&(r[t]=2):e.includes("sus4")?0<=(t=r.indexOf("major"==s?4:3))&&(r[t]=5):e.includes("sus")&&0<=(t=r.indexOf("major"==s?4:3))&&(r[t]=5),e.forEach(s=>{var t;"#5"==s?0<=(t=r.indexOf(7))&&(r[t]=8):"b5"==s?0<=(t=r.indexOf(7))&&(r[t]=6):"#9"==s?r.push(15):"b9"==s?r.push(13):"#11"==s?r.push(18):"b13"==s&&r.push(20)}),(r=r.filter((s,t,e)=>e.indexOf(s)===t)).sort((s,t)=>s-t),r}function note(s,t=440,e=12){return t*Math.pow(2,s/e)}function sine(s){return Math.sin(TAU*s)}function pulse(s){return s%1<.5?-1:1}function limitFrequency(s,t,e){for(;s<t;)s*=2;for(;e<s;)s/=2;return s}var chordDuration=2,chords="Gb7 Gmmaj7 Emmaj9 Ab9addb13/C Gbaug Bmaj9 Abm11 Dbm11 Gb7/#11 Dbmaj9sus2 Eb13sus4 Dbm9".split(" "),totalChords=chords.length;return function dsp(s){for(var t=0,e=Math.floor(s/chordDuration)%totalChords,r=parseChordString(chords[e]),n=r.rootNote,e=r.modifiers,r=r.bassNote||r.rootNote,u=getChordIntervals(e),h=noteNumbers[n]-9,n=u.length+1,i=0;i<u.length;i++)t+=sine(limitFrequency(note(h+u[i]),220,880)*s);return r&&(t+=sine(note(noteNumbers[r]-9-12)*s)),t/=n};

pic unrelated, also had to compress the JS because it was too long.
5083
link below if you're lazy to copy..
link

Delete Post  

Changelog / Common thread / SthephanShi / kOLbOSa_exe / lhphr / PortablePorcelain / HypernovaHeathen / BaenHoHoHo / SArpnt / hcdphobe / OnixIsThePewterGod / Zackx / GetDolphinedLol / psubscirbe / ChrisRM380 / Kouzerumatsu / MT2023 / Decent-Manager-6169 / Chasyxx / Glebguything / absolute197 / ANoUserXD / MarioFan171
Return To top