0

i'm very bored and have decided to try to blow my speakers out by outputting every possible music note across the spectrum simultaneously... which command do i use to do this?: A2=220hz >> speaker?

set: "m1"=9.166295471417966;
set: "m2"=9.1666666666666667;
set: "m3"=9.163160355306218;
set: "m4"=9.8;
set: "m5"=9.166295884315907;
set: "m6"=9.16541822721598;
set: "m7"=-1.126410057693964;
//DEFINE MAJOR
SET: "MAJOR1"="C";
SET: "MAJOR4"="F";
SET: "MAJOR5"="G";
//DEFINE MINOR
SET: "MINOR2"="A";
SET: "MINOR3"="D";
SET: "MINOR6"="E";
//DEFINE DIMINISHED
SET: "DIMINISHED7"="B";
//DEFINE BLUES
SET: "BLUES"="A#","D#","G#";
//DEFINE OCTAVE
SET: "O1"="A1","B1","C1","D1","E1","F1","G1";
SET: "O2"="A2","B2","C2","D2","E2","F2","G2";
SET: "O3"="A3","B3","C3","D3","E3","F3","G3";
SET: "O4"="A4","B4","C4","D4","E4","F4","G4";
SET: "O5"="A5","B5","C5","D5","E5","F5","G5";
SET: "O6"="A6","B6","C6","D6","E6","F6","G6";
SET: "O7"="A7","B7","C7","D7","E7","F7","G7";
SET: "O8"="A8","B8","C8","D8","E8","F8","G8";
SET: "O9"="A9","B9","C9","D9","E9","F9","G9"; 
SET: "NOTEVARIABLEHERE"=INPUTYOURHZVALUEHERE
//EXAMPLE: SET: "A2=220"


set: "I"="a","b","c","d","e","f","g";
math p1=m1/B-p1=A/p2=m2/A-p2=G/p3=m3/G-p3=F/p4=m4/F-p4=E/p5=m5/E-p5=D/p6=m6/D-p6=C/p7=m7/C-p7=B
FOR(i, I<999999999, I(2) , I++) // double a note = next octave

//the broken code is just for context, i have a few more lines in the script //pls no angrey

  • you are referring to sound card or internal PC Speaker ? what sound api? those are OS dependent. I do not code in JAVASCRIPT but I assume it has some own api for sound (to enable cross platform capability) ... Your code makes absolutely no sense to me. There are 2 basic approaches for sound card sound. Using polyphonic synthetizer (like MIDI) or generate PCM data (like WAV). Some platforms also have `PlaySound` function that can play a soundfile instead (so you would need to generate it first). Form 2 sec of search [Playing audio with JavaScript?](https://stackoverflow.com/q/9419263/2521214) – Spektre Jul 11 '20 at 08:37
  • so chose api you want and then start to code around it ... – Spektre Jul 11 '20 at 08:41

0 Answers0