diff --git a/examples/USB_MIDI.bell b/examples/USB_MIDI.bell new file mode 100644 index 00000000..9d729cc6 --- /dev/null +++ b/examples/USB_MIDI.bell @@ -0,0 +1 @@ +{"boxes":{"box-1":{"id":"box-1","text":"hardware","inlets":4,"outlets":3,"rect":[495,210,80,22],"background":false,"presentation":false,"presentationRect":[0,0,90,20],"args":[],"props":{},"data":{"boxes":{"box-1":{"id":"box-1","text":"seed","pinNames":["D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","D11","D12","D13","D14","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","D26","D27","A11","D29","D30","USB D+","USB D-"],"rect":[105,60,103.88000000000001,302.40000000000003],"presentation":false,"presentationRect":[180,345,210,90],"args":[],"props":{},"data":{},"zIndex":0},"box-2":{"id":"box-2","text":"usbmidi","pinNames":["dp","dm"],"rect":[120,450,66.421875,24],"presentation":false,"presentationRect":[75,330,90,20],"args":[],"props":{"polarity":0,"pull":0},"data":{},"zIndex":0}},"lines":{"line-1":{"id":"line-1","aIo":["box-1",31],"bIo":["box-2",0],"disabled":false},"line-2":{"id":"line-2","aIo":["box-1",32],"bIo":["box-2",1],"disabled":false}},"props":{"mode":"daisy","dependencies":[],"bgColor":"rgba(61, 65, 70, 1)","editingBgColor":"rgba(82, 87, 94, 1)","grid":[15,15],"openInPresentation":false,"boxIndexCount":2,"lineIndexCount":2,"objectInit":true},"inlets":[["box-1",0],["box-1",1],["box-1",2],["box-2",0]],"outlets":[["box-1",0],["box-1",1],["box-2",0]]},"zIndex":0},"box-4":{"id":"box-4","text":"hardware","inlets":4,"outlets":3,"rect":[465,795,80,22],"background":false,"presentation":false,"presentationRect":[0,0,90,20],"args":[],"props":{},"data":{"boxes":{"box-1":{"id":"box-1","text":"seed","pinNames":["D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","D11","D12","D13","D14","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","D26","D27","A11","D29","D30","USB D+","USB D-"],"rect":[195,90,103.88000000000001,302.40000000000003],"presentation":false,"presentationRect":[180,345,210,90],"args":[],"props":{},"data":{},"zIndex":0},"box-2":{"id":"box-2","text":"usbmidi","pinNames":["dp","dm"],"rect":[210,450,66.421875,24],"presentation":false,"presentationRect":[75,330,90,20],"args":[],"props":{"polarity":0,"pull":0},"data":{},"zIndex":0}},"lines":{"line-1":{"id":"line-1","aIo":["box-1",31],"bIo":["box-2",0],"disabled":false},"line-2":{"id":"line-2","aIo":["box-1",32],"bIo":["box-2",1],"disabled":false}},"props":{"mode":"daisy","dependencies":[],"bgColor":"rgba(61, 65, 70, 1)","editingBgColor":"rgba(82, 87, 94, 1)","grid":[15,15],"openInPresentation":false,"boxIndexCount":2,"lineIndexCount":2,"objectInit":true},"inlets":[["box-1",0],["box-1",1],["box-1",2],["box-2",0]],"outlets":[["box-1",0],["box-1",1],["box-2",0]]},"zIndex":0},"box-6":{"id":"box-6","text":"midiparse","inlets":1,"outlets":7,"rect":[465,300,195,22],"background":false,"presentation":false,"presentationRect":[540,525,90,20],"args":[],"props":{"pitchBendResolution":"float"},"data":{},"zIndex":0},"box-15":{"id":"box-15","text":"mtof","inlets":1,"outlets":1,"rect":[465,480,44.8125,22],"background":false,"presentation":false,"presentationRect":[405,675,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-16":{"id":"box-16","text":"saw~","inlets":1,"outlets":1,"rect":[465,540,44.8125,22],"background":false,"presentation":false,"presentationRect":[405,750,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-13":{"id":"box-13","text":"adsr~ 10 250 0.5 250","inlets":5,"outlets":1,"rect":[705,480,160.03125,22],"background":false,"presentation":false,"presentationRect":[480,630,90,20],"args":[10,250,0.5,250],"props":{},"data":{},"zIndex":0},"box-17":{"id":"box-17","text":"ota~ 1000 2","inlets":3,"outlets":1,"rect":[465,600,95.21875,22],"background":false,"presentation":false,"presentationRect":[420,765,90,20],"args":[1000,2],"props":{},"data":{},"zIndex":0},"box-24":{"id":"box-24","text":"scale~ 1 0 5000 1000","inlets":5,"outlets":1,"rect":[525,540,165,22],"background":false,"presentation":false,"presentationRect":[630,765,90,20],"args":[1,0,5000,1000],"props":{},"data":{},"zIndex":0},"box-18":{"id":"box-18","text":"*~","inlets":2,"outlets":1,"rect":[465,690,40,22],"background":false,"presentation":false,"presentationRect":[465,825,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-30":{"id":"box-30","text":"mididevice","inlets":1,"outlets":2,"rect":[360,75,88.015625,22],"background":false,"presentation":false,"presentationRect":[120,150,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-31":{"id":"box-31","text":"button","inlets":1,"outlets":1,"rect":[225,105,30,30],"background":false,"presentation":false,"presentationRect":[135,180,30,30],"args":[],"props":{},"data":{},"zIndex":0},"box-32":{"id":"box-32","text":"menu","inlets":2,"outlets":1,"rect":[360,120,90,22],"background":false,"presentation":false,"presentationRect":[150,210,90,20],"args":[],"props":{"options":[{"key":0,"icon":"sign-in","text":"Midi Through Port-0","value":"1A0CE1F47C19C43DAEB93B9595F6E4BA822ED318FE8D8BF2750B66286B5BEC38"},{"key":1,"icon":"sign-in","text":"Daisy Seed Built In MIDI 1","value":"71029850E5371DA63002DE2B147749A0B34923F603BAC6A8BCEE06AD1A27D556"},{"key":2,"icon":"sign-in","text":"A-Series Keyboard Keyboard","value":"0BA9535420A8CDB91EB4C53F2DE45C5AE9AF2B940322A313E66D31DDB6A93E91"},{"key":3,"icon":"sign-out","text":"Midi Through Port-0","value":"6FF5590044F4859ED50C5167BCFE9700A1798E39AA55A628E86D39011FAECD5D"},{"key":4,"icon":"sign-out","text":"Daisy Seed Built In MIDI 1","value":"610CD821881C940FFB62F27FCC548AC86B279709D856BF81D300810BFD6CD062"},{"key":5,"icon":"sign-out","text":"A-Series Keyboard Keyboard","value":"6C7B524FC0BF04724B86604E076F4B1C27A2DC55BF97D5611C0F9E4ADE7AA5CF"},{"key":6,"icon":"sign-out","text":"A-Series Keyboard MIDI","value":"BD4AAA46C24E6DB13D63ACC3DB66B8BC013F1741261A6AEA6B99382CC9E0A855"}]},"data":{},"zIndex":0},"box-33":{"id":"box-33","text":"midiin","inlets":1,"outlets":2,"rect":[360,210,59.21875,22],"background":false,"presentation":false,"presentationRect":[150,240,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-34":{"id":"box-34","text":"audioOut~","inlets":2,"outlets":1,"rect":[360,795,80.8125,22],"background":false,"presentation":false,"presentationRect":[90,690,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-35":{"id":"box-35","text":"*~ 0.5","inlets":2,"outlets":1,"rect":[360,735,59.21875,22],"background":false,"presentation":false,"presentationRect":[135,645,90,20],"args":[0.5],"props":{},"data":{},"zIndex":0},"box-39":{"id":"box-39","text":"mididevice","inlets":1,"outlets":2,"rect":[225,180,88.015625,22],"background":false,"presentation":false,"presentationRect":[90,435,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-40":{"id":"box-40","text":"menu","inlets":2,"outlets":1,"rect":[225,240,90,22],"background":false,"presentation":false,"presentationRect":[75,450,90,20],"args":[],"props":{"options":[{"key":0,"icon":"sign-in","text":"Midi Through Port-0","value":"1A0CE1F47C19C43DAEB93B9595F6E4BA822ED318FE8D8BF2750B66286B5BEC38"},{"key":1,"icon":"sign-in","text":"Daisy Seed Built In MIDI 1","value":"71029850E5371DA63002DE2B147749A0B34923F603BAC6A8BCEE06AD1A27D556"},{"key":2,"icon":"sign-in","text":"A-Series Keyboard Keyboard","value":"0BA9535420A8CDB91EB4C53F2DE45C5AE9AF2B940322A313E66D31DDB6A93E91"},{"key":3,"icon":"sign-out","text":"Midi Through Port-0","value":"6FF5590044F4859ED50C5167BCFE9700A1798E39AA55A628E86D39011FAECD5D"},{"key":4,"icon":"sign-out","text":"Daisy Seed Built In MIDI 1","value":"610CD821881C940FFB62F27FCC548AC86B279709D856BF81D300810BFD6CD062"},{"key":5,"icon":"sign-out","text":"A-Series Keyboard Keyboard","value":"6C7B524FC0BF04724B86604E076F4B1C27A2DC55BF97D5611C0F9E4ADE7AA5CF"},{"key":6,"icon":"sign-out","text":"A-Series Keyboard MIDI","value":"BD4AAA46C24E6DB13D63ACC3DB66B8BC013F1741261A6AEA6B99382CC9E0A855"}]},"data":{},"zIndex":0},"box-41":{"id":"box-41","text":"midiout","inlets":1,"outlets":1,"rect":[210,795,66.421875,22],"background":false,"presentation":false,"presentationRect":[60,510,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-44":{"id":"box-44","text":"monovoice","inlets":2,"outlets":3,"rect":[465,420,80.8125,22],"background":false,"presentation":false,"presentationRect":[465,720,90,20],"args":[],"props":{"retrigger":false},"data":{},"zIndex":0},"box-23":{"id":"box-23","text":"adsr~ 10 100 0 100","inlets":5,"outlets":1,"rect":[525,480,145.625,22],"background":false,"presentation":false,"presentationRect":[735,720,90,20],"args":[10,100,0,100],"props":{},"data":{},"zIndex":0},"box-48":{"id":"box-48","text":"midiformat","inlets":7,"outlets":1,"rect":[525,750,195,22],"background":false,"presentation":false,"presentationRect":[600,735,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-54":{"id":"box-54","text":"loadbang","inlets":1,"outlets":1,"rect":[225,60,73.609375,22],"background":false,"presentation":false,"presentationRect":[135,135,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-61":{"id":"box-61","text":"scale 0 127 0.5 1","inlets":5,"outlets":1,"rect":[765,540,138.421875,22],"background":false,"presentation":false,"presentationRect":[495,690,90,20],"args":[0,127,0.5,1],"props":{},"data":{},"zIndex":0},"box-62":{"id":"box-62","text":"*~","inlets":2,"outlets":1,"rect":[705,600,40,22],"background":false,"presentation":false,"presentationRect":[450,705,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-64":{"id":"box-64","text":"patcher metronote","inlets":0,"outlets":1,"rect":[525,705,195,22],"background":false,"presentation":false,"presentationRect":[990,675,90,20],"args":["metronote"],"props":{},"data":{"boxes":{"box-52":{"id":"box-52","text":"loadbang","inlets":1,"outlets":1,"rect":[15,30,75,24],"background":false,"presentation":false,"presentationRect":[840,315,90,20],"args":[],"props":{},"data":{},"zIndex":0},"box-50":{"id":"box-50","text":"metro 500","inlets":2,"outlets":1,"rect":[15,75,80.8125,24],"background":false,"presentation":false,"presentationRect":[840,465,90,20],"args":[500],"props":{},"data":{},"zIndex":0},"box-56":{"id":"box-56","text":"counter 2","inlets":1,"outlets":3,"rect":[15,120,120,24],"background":false,"presentation":false,"presentationRect":[795,645,90,20],"args":[2],"props":{},"data":{},"zIndex":0},"box-59":{"id":"box-59","text":"select 0 1","inlets":3,"outlets":3,"rect":[15,165,105,24],"background":false,"presentation":false,"presentationRect":[765,690,90,20],"args":[0,1],"props":{},"data":{},"zIndex":0},"box-53":{"id":"box-53","text":"message","inlets":1,"outlets":1,"rect":[15,225,90,22],"background":false,"presentation":false,"presentationRect":[840,540,90,20],"args":[],"props":{},"data":{"text":"69 127"},"zIndex":0},"box-60":{"id":"box-60","text":"message","inlets":1,"outlets":1,"rect":[135,225,90,22],"background":false,"presentation":false,"presentationRect":[735,720,90,20],"args":[],"props":{},"data":{"text":"69 0"},"zIndex":0},"box-61":{"id":"box-61","text":"out 1","inlets":1,"outlets":0,"rect":[15,300,75,24],"background":false,"presentation":false,"presentationRect":[420,405,90,20],"args":[1],"props":{},"data":{},"zIndex":0},"box-62":{"id":"box-62","text":"comment","inlets":1,"outlets":0,"rect":[135,30,150,44],"background":false,"presentation":false,"presentationRect":[585,75,90,20],"args":[],"props":{},"data":{"value":"This patcher will produce regular note events\n"},"zIndex":0}},"lines":{"line-1":{"id":"line-1","src":["box-52",0],"dest":["box-50",0],"disabled":false},"line-2":{"id":"line-2","src":["box-50",0],"dest":["box-56",0],"disabled":false},"line-3":{"id":"line-3","src":["box-56",0],"dest":["box-59",0],"disabled":false},"line-4":{"id":"line-4","src":["box-59",0],"dest":["box-53",0],"disabled":false},"line-5":{"id":"line-5","src":["box-59",1],"dest":["box-60",0],"disabled":false},"line-6":{"id":"line-6","src":["box-53",0],"dest":["box-61",0],"disabled":false},"line-7":{"id":"line-7","src":["box-60",0],"dest":["box-61",0],"disabled":false}},"props":{"mode":"bell","dependencies":[],"bgColor":"rgba(61, 65, 70, 1)","editingBgColor":"rgba(82, 87, 94, 1)","grid":[15,15],"openInPresentation":false,"boxIndexCount":62,"lineIndexCount":7,"objectInit":true}},"zIndex":0},"box-65":{"id":"box-65","text":"comment","inlets":1,"outlets":0,"rect":[765,585,195,36],"background":false,"presentation":false,"presentationRect":[720,585,90,20],"args":[],"props":{"fontFamily":"Lato","fontSize":14},"data":{"value":"This scales the envelope based on velocity"},"zIndex":0},"box-66":{"id":"box-66","text":"comment","inlets":1,"outlets":0,"rect":[570,585,135,50],"background":false,"presentation":false,"presentationRect":[570,435,90,20],"args":[],"props":{"fontFamily":"Lato","fontSize":14},"data":{"value":"We also have an envelope for the filter.\n"},"zIndex":0},"box-68":{"id":"box-68","text":"comment","inlets":1,"outlets":0,"rect":[270,405,180,78],"background":false,"presentation":false,"presentationRect":[300,480,90,20],"args":[],"props":{"fontFamily":"Lato","fontSize":14},"data":{"value":"This is an all-in-one mono voice object. It transforms a MIDI note stream into easy-to-use note, velocity, and gate outputs."},"zIndex":0},"box-69":{"id":"box-69","text":"* 2","inlets":2,"outlets":1,"rect":[525,360,40,22],"background":false,"presentation":false,"presentationRect":[480,375,90,20],"args":[2],"props":{},"data":{},"zIndex":0},"box-70":{"id":"box-70","text":"comment","inlets":1,"outlets":0,"rect":[570,360,165,64],"background":false,"presentation":false,"presentationRect":[510,375,90,20],"args":[],"props":{"fontFamily":"Lato","fontSize":14},"data":{"value":"The default pitch-bend range is -1 to 1, so we multiply it by 2 for the classic 2-semitone range."},"zIndex":0},"box-71":{"id":"box-71","text":"comment","inlets":1,"outlets":0,"rect":[480,90,225,78],"background":false,"presentation":false,"presentationRect":[420,120,90,20],"args":[],"props":{"fontFamily":"Lato","fontSize":14},"data":{"value":"Here's how we can configure our MIDI input device on a computer. You should be able to see all the MIDI devices available to your system in this dropdown."},"zIndex":0},"box-72":{"id":"box-72","text":"comment","inlets":1,"outlets":0,"rect":[15,240,195,78],"background":false,"presentation":false,"presentationRect":[45,255,90,20],"args":[],"props":{"fontFamily":"Lato","fontSize":14},"data":{"value":"If you set the output device to your Seed (\"Daisy Seed Built In MIDI 1\" or similar), you can control it right from this patcher!"},"zIndex":0},"box-73":{"id":"box-73","text":"comment","inlets":1,"outlets":0,"rect":[15,330,195,64],"background":false,"presentation":false,"presentationRect":[45,255,90,20],"args":[],"props":{"fontFamily":"Lato","fontSize":14},"data":{"value":"If you also set the input device to your Seed, it will send MIDI messages to itself through your computer."},"zIndex":0},"box-75":{"id":"box-75","text":"comment","inlets":1,"outlets":0,"rect":[585,195,225,50],"background":false,"presentation":false,"presentationRect":[420,120,90,20],"args":[],"props":{"fontFamily":"Lato","fontSize":14},"data":{"value":"In the hardware, we've set up the built-in USB port to send and receive MIDI."},"zIndex":0},"box-77":{"id":"box-77","text":"*~ 2","inlets":2,"outlets":1,"rect":[465,735,44.8125,22],"background":false,"presentation":false,"presentationRect":[765,855,90,20],"args":[2],"props":{},"data":{},"zIndex":0}},"lines":{"line-17":{"id":"line-17","src":["box-15",0],"dest":["box-16",0],"disabled":false},"line-18":{"id":"line-18","src":["box-16",0],"dest":["box-17",0],"disabled":false},"line-19":{"id":"line-19","src":["box-13",0],"dest":["box-62",0],"disabled":false},"line-21":{"id":"line-21","src":["box-24",0],"dest":["box-17",1],"disabled":false},"line-22":{"id":"line-22","src":["box-17",0],"dest":["box-18",0],"disabled":false},"line-24":{"id":"line-24","src":["box-1",2],"dest":["box-6",0],"disabled":false},"line-25":{"id":"line-25","src":["box-77",0],"dest":["box-4",0],"disabled":false},"line-26":{"id":"line-26","src":["box-77",0],"dest":["box-4",1],"disabled":false},"line-27":{"id":"line-27","src":["box-31",0],"dest":["box-30",0],"disabled":false},"line-28":{"id":"line-28","src":["box-30",1],"dest":["box-32",1],"disabled":false},"line-29":{"id":"line-29","src":["box-32",0],"dest":["box-33",0],"disabled":false},"line-30":{"id":"line-30","src":["box-33",0],"dest":["box-6",0],"disabled":false},"line-31":{"id":"line-31","src":["box-18",0],"dest":["box-35",0],"disabled":false},"line-32":{"id":"line-32","src":["box-35",0],"dest":["box-34",0],"disabled":false},"line-33":{"id":"line-33","src":["box-35",0],"dest":["box-34",1],"disabled":false},"line-39":{"id":"line-39","src":["box-31",0],"dest":["box-39",0],"disabled":false},"line-40":{"id":"line-40","src":["box-39",1],"dest":["box-40",1],"disabled":false},"line-41":{"id":"line-41","src":["box-40",0],"dest":["box-41",0],"disabled":false},"line-42":{"id":"line-42","src":["box-33",0],"dest":["box-41",0],"disabled":false},"line-46":{"id":"line-46","src":["box-6",0],"dest":["box-44",0],"disabled":false},"line-48":{"id":"line-48","src":["box-44",0],"dest":["box-15",0],"disabled":false},"line-49":{"id":"line-49","src":["box-44",2],"dest":["box-13",0],"disabled":false},"line-50":{"id":"line-50","src":["box-44",2],"dest":["box-23",0],"disabled":false},"line-20":{"id":"line-20","src":["box-23",0],"dest":["box-24",0],"disabled":false},"line-56":{"id":"line-56","src":["box-48",0],"dest":["box-4",3],"disabled":false},"line-61":{"id":"line-61","src":["box-54",0],"dest":["box-31",0],"disabled":false},"line-68":{"id":"line-68","src":["box-44",1],"dest":["box-61",0],"disabled":false},"line-69":{"id":"line-69","src":["box-61",0],"dest":["box-62",1],"disabled":false},"line-70":{"id":"line-70","src":["box-62",0],"dest":["box-18",1],"disabled":false},"line-71":{"id":"line-71","src":["box-64",0],"dest":["box-48",0],"disabled":false},"line-72":{"id":"line-72","src":["box-6",5],"dest":["box-69",0],"disabled":false},"line-73":{"id":"line-73","src":["box-69",0],"dest":["box-44",1],"disabled":false},"line-74":{"id":"line-74","src":["box-18",0],"dest":["box-77",0],"disabled":false}},"props":{"mode":"bell","dependencies":[],"bgColor":"rgba(61, 65, 70, 1)","editingBgColor":"rgba(82, 87, 94, 1)","grid":[15,15],"openInPresentation":false,"boxIndexCount":97,"lineIndexCount":100,"objectInit":true}} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6f8ba86c..f91a7d86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,15 @@ { "name": "@jspatcher/jspatcher", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@jspatcher/jspatcher", - "version": "0.3.3", + "version": "0.3.4", "license": "GPL-3.0-or-later", "dependencies": { "@types/node": "^18.11.9", - "fomantic-ui-css": "^2.9.3", "github-markdown-css": "^5.2.0" }, "devDependencies": { @@ -18,6 +17,7 @@ "@electrosmith/package-generators": "file:../objects/generators/web", "@electrosmith/package-io": "file:../objects/io/web", "@electrosmith/package-math": "file:../objects/math/web", + "@electrosmith/package-midi": "file:../objects/midi/web", "@electrosmith/package-ui": "file:../objects/ui/web", "@electrosmith/package-utilities": "file:../objects/utilities/web", "@ffmpeg/core": "^0.10.0", @@ -68,6 +68,7 @@ "eslint-plugin-import": "^2.24.2", "eslint-plugin-react": "^7.25.0", "express": "^4.17.1", + "fomantic-ui-css": "^2.9.3", "jszip": "^3.7.1", "lato-font": "^3.0.0", "monaco-editor": "^0.26.1", @@ -157,6 +158,23 @@ "webpack-cli": "^4.8.0" } }, + "../objects/midi/web": { + "name": "@electrosmith/package-midi", + "version": "1.0.2", + "dev": true, + "license": "GPL-3.0-or-later", + "devDependencies": { + "@jspatcher/jspatcher": "file:../../../frontend", + "@types/webmidi": "^2.0.6", + "clean-webpack-plugin": "^4.0.0", + "esbuild-loader": "^2.18.0", + "semantic-ui-react": "^2.0.4", + "typescript": "^4.5.4", + "webpack": "^5.65.0", + "webpack-cli": "^4.9.1", + "worklet-loader": "^2.0.0" + } + }, "../objects/ui/web": { "name": "@electrosmith/package-ui", "version": "1.0.5", @@ -1913,6 +1931,10 @@ "resolved": "../objects/math/web", "link": true }, + "node_modules/@electrosmith/package-midi": { + "resolved": "../objects/midi/web", + "link": true + }, "node_modules/@electrosmith/package-ui": { "resolved": "../objects/ui/web", "link": true @@ -5543,6 +5565,7 @@ "version": "2.9.3", "resolved": "https://registry.npmjs.org/fomantic-ui-css/-/fomantic-ui-css-2.9.3.tgz", "integrity": "sha512-7bM6p3QRpfZFofg7Fd3crzox2E/nBsPyyWDN+N4lnTjNMxgKltSaXJTfhLoK5xBA+wEoNtcmm6w6FQ5Drj+27A==", + "dev": true, "dependencies": { "jquery": "^3.4.0" } @@ -6745,6 +6768,7 @@ }, "node_modules/jquery": { "version": "3.6.3", + "dev": true, "license": "MIT" }, "node_modules/js-base64": { @@ -11961,6 +11985,20 @@ "webpack-cli": "^4.8.0" } }, + "@electrosmith/package-midi": { + "version": "file:../objects/midi/web", + "requires": { + "@jspatcher/jspatcher": "file:../../../frontend", + "@types/webmidi": "^2.0.6", + "clean-webpack-plugin": "^4.0.0", + "esbuild-loader": "^2.18.0", + "semantic-ui-react": "^2.0.4", + "typescript": "^4.5.4", + "webpack": "^5.65.0", + "webpack-cli": "^4.9.1", + "worklet-loader": "^2.0.0" + } + }, "@electrosmith/package-ui": { "version": "file:../objects/ui/web", "requires": { @@ -14492,6 +14530,7 @@ "version": "2.9.3", "resolved": "https://registry.npmjs.org/fomantic-ui-css/-/fomantic-ui-css-2.9.3.tgz", "integrity": "sha512-7bM6p3QRpfZFofg7Fd3crzox2E/nBsPyyWDN+N4lnTjNMxgKltSaXJTfhLoK5xBA+wEoNtcmm6w6FQ5Drj+27A==", + "dev": true, "requires": { "jquery": "^3.4.0" } @@ -15226,7 +15265,8 @@ "dev": true }, "jquery": { - "version": "3.6.3" + "version": "3.6.3", + "dev": true }, "js-base64": { "version": "2.6.4", diff --git a/package.json b/package.json index 7f1fb6ca..7bdf067b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jspatcher/jspatcher", - "version": "0.3.4", + "version": "0.3.5", "description": "patcher js", "scripts": { "prebuild": "node ./src/scripts/patchSemanticUICss.js", @@ -25,6 +25,7 @@ "@electrosmith/package-math": "file:../objects/math/web", "@electrosmith/package-ui": "file:../objects/ui/web", "@electrosmith/package-utilities": "file:../objects/utilities/web", + "@electrosmith/package-midi": "file:../objects/midi/web", "@ffmpeg/core": "^0.10.0", "@ffmpeg/ffmpeg": "^0.10.1", "@grame/libmusicxml": "^3.19.1", diff --git a/src/components/topmenu/FileMenu.tsx b/src/components/topmenu/FileMenu.tsx index cf13b330..276bc274 100644 --- a/src/components/topmenu/FileMenu.tsx +++ b/src/components/topmenu/FileMenu.tsx @@ -16,11 +16,14 @@ import AtariPunkConsole from "../../../examples/AtariV2.bell"; import RandomNoteGenerator from "../../../examples/RandomNoteGenerator.bell"; import SawSynthBp from "../../../examples/SawSynthBp.bell"; import Seed2DFMRect from "../../../examples/s2dfm_simple.bell"; +import UsbMidi from "../../../examples/USB_MIDI.bell"; + const examples: Record = { "8 Step Sequencer": [EightStepSequencer, ""], "Atari Punk Console": [AtariPunkConsole, ""], "Blink": [BlinkExample, "Seed"], + "USB MIDI": [UsbMidi, "Seed"], "Simple Rect": [Seed2DFMRect, "S2DFM Eval Euro"], "Random Note Generator": [RandomNoteGenerator, ""], "Saw Synth BP": [SawSynthBp, ""], diff --git a/src/components/topmenu/FlashMenu.tsx b/src/components/topmenu/FlashMenu.tsx index 16d8b024..c43a17a3 100644 --- a/src/components/topmenu/FlashMenu.tsx +++ b/src/components/topmenu/FlashMenu.tsx @@ -364,8 +364,8 @@ export default class FlashMenu extends React.PureComponent { {/* {this.state.device !== null ?
Connected to {this.state.device.device_.productName}
:
} */} - {this.state.building && this.state.progress === null ?
:
} - {this.state.building && this.state.progress !== null ?
:
+ {this.state.building && this.state.progress === null ?
:
} + {this.state.building && this.state.progress !== null ?
:
} {this.state.building ?
{this.state.build_message}
:
} {this.state.build_error ?
{this.state.error_message}
:
} diff --git a/src/core/hardware/Compatibility.ts b/src/core/hardware/Compatibility.ts index 5f04caf2..d2c403f0 100644 --- a/src/core/hardware/Compatibility.ts +++ b/src/core/hardware/Compatibility.ts @@ -1,74 +1,103 @@ - -import { BasePin } from "./types"; +import { BasePin, USBBus } from "./types"; export function compatibleBus(pins: BasePin[]) { - // idk they're all complicated and I don't know what they mean - return false; + // USB Compatibility Check + let dplusCount = 0; + let dminusCount = 0; + let idCount = 0; + + pins.forEach((pin) => { + if (pin.busCapabilities) { + for (const busType in pin.busCapabilities) { + const bus = pin.busCapabilities[busType] as USBBus; + if (bus.usb) { + // Increment counters based on USB capabilities + if (bus.dplus) dplusCount++; + if (bus.dminus) dminusCount++; + if (bus.id) idCount++; + } + } + } + }); + + // Let's consider tie flexibility + const tiePinsCount = pins.filter((p) => p.tie).length; + + if ( + pins.length === 2 && + (dplusCount === 1 || dminusCount === 1 || idCount === 1) && + tiePinsCount === 1 + ) { + // If there's only one dplus, dminus, or id, the tie pin can accommodate it + return true; + } + + if (dplusCount >= 2 || dminusCount >= 2) { + return true; + } + + // Continue with other bus checks (SPI, I2C, etc.) here when you want to expand compatibility checks. + return false; } export function compatibleDigital(pins: BasePin[]) { - let num_outputs = pins.filter(p => p.digitalOutput && !p.digitalInput).length; + let num_outputs = pins.filter((p) => p.digitalOutput && !p.digitalInput).length; - if (num_outputs > 1) { - return false; - } + if (num_outputs > 1) { + return false; + } - // now, for all fixed outputs, every other pin must have an input - let outputs = pins.map((p, i) => ({ p, i })).filter(({ p }) => p.digitalOutput); + // now, for all fixed outputs, every other pin must have an input + let outputs = pins.map((p, i) => ({ p, i })).filter(({ p }) => p.digitalOutput); - let some_valid_config = false; - for (const output of outputs) { - const { p: pin, i: index } = output; + let some_valid_config = false; + for (const output of outputs) { + const { p: pin, i: index } = output; - // In any configuration where an output is able to not conflict, there must be a compatibility - if (pins.filter((_, i) => i !== index).every(p => p.digitalInput || p.tie)) { - some_valid_config = true; - break; - } + // In any configuration where an output is able to not conflict, there must be a compatibility + if (pins.filter((_, i) => i !== index).every((p) => p.digitalInput || p.tie)) { + some_valid_config = true; + break; } + } - // otherwise, simple analog connections should be compatible - return some_valid_config; + // otherwise, simple analog connections should be compatible + return some_valid_config; } export function compatibleAnalog(pins: BasePin[]) { - let num_outputs = pins.filter(p => p.analogOutput && !p.analogInput).length; + let num_outputs = pins.filter((p) => p.analogOutput && !p.analogInput).length; - if (num_outputs > 1) { - return false; - } + if (num_outputs > 1) { + return false; + } - // now, for all outputs, every other pin must have an input - let outputs = pins.map((p, i) => ({ p, i })).filter(({ p }) => p.analogOutput); + // now, for all outputs, every other pin must have an input + let outputs = pins.map((p, i) => ({ p, i })).filter(({ p }) => p.analogOutput); - let some_valid_config = false; - for (const output of outputs) { - const { p: pin, i: index } = output; + let some_valid_config = false; + for (const output of outputs) { + const { p: pin, i: index } = output; - // In any configuration where an output is able to not conflict, there must be a compatibility - if (pins.filter((_, i) => i !== index).every(p => p.analogInput || p.tie)) { - some_valid_config = true; - break; - } + // In any configuration where an output is able to not conflict, there must be a compatibility + if (pins.filter((_, i) => i !== index).every((p) => p.analogInput || p.tie)) { + some_valid_config = true; + break; } + } - // otherwise, simple analog connections should be compatible - return some_valid_config; + // otherwise, simple analog connections should be compatible + return some_valid_config; } export function compatiblePins(pins: BasePin[]) { + let compatibilities = [compatibleBus, compatibleDigital, compatibleAnalog]; - let compatibilities = [ - compatibleBus, - compatibleDigital, - compatibleAnalog, - ]; + // If any of the compatibilities are true, then the pins are compatible + // TODO -- this should probably return exactly which aspects are compatible + if (compatibilities.some((f) => f(pins))) { + return true; + } - // If any of the compatibilities are true, then the pins are compatible - // TODO -- this should probably return exactly which aspects are compatible - if (compatibilities.some(f => f(pins))) { - return true; - } - - return false; + return false; } diff --git a/src/core/hardware/objects/hardware/HardwareObjects.ts b/src/core/hardware/objects/hardware/HardwareObjects.ts index f73fb358..54681b0f 100644 --- a/src/core/hardware/objects/hardware/HardwareObjects.ts +++ b/src/core/hardware/objects/hardware/HardwareObjects.ts @@ -4,12 +4,14 @@ import Gpo from "./Gpo"; import AMux from "./Mux"; import Button from "./Button"; import Cv from "./Cv"; +import UsbMidi from "./UsbMidi"; export default { - 'knob': Knob, - 'gpi': Gpi, - 'gpo': Gpo, - 'amux': AMux, - 'button': Button, - 'cv': Cv, + knob: Knob, + gpi: Gpi, + gpo: Gpo, + amux: AMux, + button: Button, + cv: Cv, + usbmidi: UsbMidi, }; diff --git a/src/core/hardware/objects/hardware/UsbMidi.ts b/src/core/hardware/objects/hardware/UsbMidi.ts new file mode 100644 index 00000000..beb3b0b7 --- /dev/null +++ b/src/core/hardware/objects/hardware/UsbMidi.ts @@ -0,0 +1,75 @@ +import { IInletsMeta, IOutletsMeta } from "../../../objects/base/AbstractObject"; +import type { IIosMeta, IPropsMeta, THardwareMetaType } from "../base/AbstractHardwareObject"; +import DefaultObject from "../base/DefaultHardwareObject"; + +export default class UsbMidi extends DefaultObject<{}, {}, any[], any[], []> { + static author = "Corvus Prudens"; + static version = "v1.0.0"; + static description = "USB MIDI interface"; + static ios: IIosMeta = [ + { + pin: { + pinName: "dp", + busCapabilities: { USB_HS: { usb: true, dplus: true, dminus: false } }, + }, + type: "anything", + description: "USB D+ pin", + }, + { + pin: { + pinName: "dm", + busCapabilities: { USB_HS: { usb: true, dplus: false, dminus: true } }, + }, + type: "anything", + description: "USB D- pin", + }, + ]; + + static patcherInlets: IInletsMeta = [ + { + type: "anything", + description: "MIDI bytestream (sent to host)", + isHot: true, + }, + ]; + + static patcherOutlets: IOutletsMeta = [ + { + type: "anything", + description: "MIDI bytestream (received from host)", + }, + ]; + + static props: IPropsMeta = { + polarity: { + type: "number", + default: 0, + description: "determines button polarity (0 = active low, 1 = active high)", + alwaysSerialize: true, + }, + pull: { + type: "number", + default: 0, + description: + "determines if the pull-up or pull-down state (0 = pull-down, 1 = pull-up, 2 = none)", + alwaysSerialize: true, + }, + }; + + subscribe() { + super.subscribe(); + + this.on("preInit", () => { + this.ios = [ + { + edge: "T", + position: 0.25, + }, + { + edge: "T", + position: 0.75, + }, + ]; + }); + } +} diff --git a/src/core/hardware/objects/soms/DaisySeed.ts b/src/core/hardware/objects/soms/DaisySeed.ts index fa219bf1..c42e742a 100644 --- a/src/core/hardware/objects/soms/DaisySeed.ts +++ b/src/core/hardware/objects/soms/DaisySeed.ts @@ -1,406 +1,483 @@ import { IInletsMeta, IOutletsMeta } from "../../../objects/base/AbstractObject"; import { BasePin } from "../../types"; -import type { IIosMeta, THardwareMetaType } from "../base/AbstractHardwareObject"; +import type { IIoMeta, IIosMeta, THardwareMetaType } from "../base/AbstractHardwareObject"; import ImageObject from "../base/ImageObject"; - const DaisyPins = [ - { - pinName: "D0", - digitalInput: true, - digitalOutput: true, - pwmOutput: true, - busCapabilities: { - "USB_HS": { usb: true, id: true, dplus: false, dminus: false }, - "UART5": { usart: true, rx: true, tx: false }, - "USART3": { usart: true, cts: false, rts: false, tx: false, rx: false, ck: true }, - } + { + pinName: "D0", + digitalInput: true, + digitalOutput: true, + pwmOutput: true, + busCapabilities: { + USB_HS: { usb: true, id: true, dplus: false, dminus: false }, + UART5: { usart: true, rx: true, tx: false }, + USART3: { usart: true, cts: false, rts: false, tx: false, rx: false, ck: true }, }, - { - pinName: "D1", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SDMMC1": { sdmmc: true, cmd: false, clk: false, dat0: false, dat1: false, dat2: false, dat3: true }, - "USART3": { usart: true, rx: true, tx: false }, - "UART4": { usart: true, rx: true, tx: false }, - "SPI3": { spi: true, miso: true, mosi: false, sck: false, ss: false }, - "I2S3": { i2s: true, sd: true, ws: false, sck: false }, - } + }, + { + pinName: "D1", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SDMMC1: { + sdmmc: true, + cmd: false, + clk: false, + dat0: false, + dat1: false, + dat2: false, + dat3: true, + }, + USART3: { usart: true, rx: true, tx: false }, + UART4: { usart: true, rx: true, tx: false }, + SPI3: { spi: true, miso: true, mosi: false, sck: false, ss: false }, + I2S3: { i2s: true, sd: true, ws: false, sck: false }, }, - { - pinName: "D2", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SDMMC1": { sdmmc: true, cmd: false, clk: false, dat0: false, dat1: false, dat2: true, dat3: false }, - "USART3": { usart: true, rx: false, tx: true }, - "UART4": { usart: true, rx: false, tx: true }, - "SPI3": { spi: true, miso: false, mosi: false, sck: true, ss: false }, - "I2S3": { i2s: true, sd: false, ws: false, sck: true }, - } + }, + { + pinName: "D2", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SDMMC1: { + sdmmc: true, + cmd: false, + clk: false, + dat0: false, + dat1: false, + dat2: true, + dat3: false, + }, + USART3: { usart: true, rx: false, tx: true }, + UART4: { usart: true, rx: false, tx: true }, + SPI3: { spi: true, miso: false, mosi: false, sck: true, ss: false }, + I2S3: { i2s: true, sd: false, ws: false, sck: true }, }, - { - pinName: "D3", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SDMMC1": { sdmmc: true, cmd: false, clk: false, dat0: false, dat1: true, dat2: false, dat3: false }, - "UART5": { usart: true, rx: false, tx: false, cts: true, rts: false }, - "I2S": { i2s: true, sd: false, ws: false, sck: false }, - } + }, + { + pinName: "D3", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SDMMC1: { + sdmmc: true, + cmd: false, + clk: false, + dat0: false, + dat1: true, + dat2: false, + dat3: false, + }, + UART5: { usart: true, rx: false, tx: false, cts: true, rts: false }, + I2S: { i2s: true, sd: false, ws: false, sck: false }, }, - { - pinName: "D4", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SDMMC1": { sdmmc: true, cmd: false, clk: false, dat0: true, dat1: false, dat2: false, dat3: false }, - "UART5": { usart: true, rx: false, tx: false, cts: false, rts: true }, - } + }, + { + pinName: "D4", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SDMMC1: { + sdmmc: true, + cmd: false, + clk: false, + dat0: true, + dat1: false, + dat2: false, + dat3: false, + }, + UART5: { usart: true, rx: false, tx: false, cts: false, rts: true }, }, - { - pinName: "D5", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SDMMC1": { sdmmc: true, cmd: true, clk: false, dat0: false, dat1: false, dat2: false, dat3: false }, - "UART5": { usart: true, rx: true, tx: false }, - } + }, + { + pinName: "D5", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SDMMC1: { + sdmmc: true, + cmd: true, + clk: false, + dat0: false, + dat1: false, + dat2: false, + dat3: false, + }, + UART5: { usart: true, rx: true, tx: false }, }, - { - pinName: "D6", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SDMMC1": { sdmmc: true, cmd: false, clk: true, dat0: false, dat1: false, dat2: false, dat3: false }, - "UART5": { usart: true, rx: false, tx: true }, - "USART3": { usart: true, rx: false, tx: false, cts: false, rts: false, ck: true }, - "SPI3": { spi: true, miso: false, mosi: true, sck: false, ss: false }, - "I2S3": { i2s: true, sd: true, ws: false, sck: false }, - } + }, + { + pinName: "D6", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SDMMC1: { + sdmmc: true, + cmd: false, + clk: true, + dat0: false, + dat1: false, + dat2: false, + dat3: false, + }, + UART5: { usart: true, rx: false, tx: true }, + USART3: { usart: true, rx: false, tx: false, cts: false, rts: false, ck: true }, + SPI3: { spi: true, miso: false, mosi: true, sck: false, ss: false }, + I2S3: { i2s: true, sd: true, ws: false, sck: false }, }, - { - pinName: "D7", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SPI1": { spi: true, miso: false, mosi: false, sck: false, ss: true }, - "I2S1": { i2s: true, sd: false, ws: true, sck: false }, - } + }, + { + pinName: "D7", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SPI1: { spi: true, miso: false, mosi: false, sck: false, ss: true }, + I2S1: { i2s: true, sd: false, ws: true, sck: false }, }, - { - pinName: "D8", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SPI1": { spi: true, miso: false, mosi: false, sck: true, ss: false }, - "I2S1": { i2s: true, sd: false, ws: false, sck: true }, - } + }, + { + pinName: "D8", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SPI1: { spi: true, miso: false, mosi: false, sck: true, ss: false }, + I2S1: { i2s: true, sd: false, ws: false, sck: true }, }, - { - pinName: "D9", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SPI1": { spi: true, miso: true, mosi: false, sck: false, ss: false }, - "UART7": { usart: true, rx: false, tx: true }, - "SPI3": { spi: true, miso: true, mosi: false, sck: false, ss: false }, - "I2S1": { i2s: true, sd: true, ws: false, sck: false }, - "SPI6": { spi: true, miso: true, mosi: false, sck: false, ss: false }, - } + }, + { + pinName: "D9", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SPI1: { spi: true, miso: true, mosi: false, sck: false, ss: false }, + UART7: { usart: true, rx: false, tx: true }, + SPI3: { spi: true, miso: true, mosi: false, sck: false, ss: false }, + I2S1: { i2s: true, sd: true, ws: false, sck: false }, + SPI6: { spi: true, miso: true, mosi: false, sck: false, ss: false }, }, - { - pinName: "D10", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SPI1": { spi: true, mosi: true }, - "UART5": { usart: true, rx: true }, - "I2S1": { i2s: true, sd: true }, - "SPI3": { spi: true, mosi: true }, - "I2S3": { i2s: true, sd: true }, - "SPI6": { spi: true, mosi: true }, - "I2C4": { i2c: true, sda: true } - } + }, + { + pinName: "D10", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SPI1: { spi: true, mosi: true }, + UART5: { usart: true, rx: true }, + I2S1: { i2s: true, sd: true }, + SPI3: { spi: true, mosi: true }, + I2S3: { i2s: true, sd: true }, + SPI6: { spi: true, mosi: true }, + I2C4: { i2c: true, sda: true }, }, - { - pinName: "D11", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "I2C1": { i2c: true, scl: true }, - "UART4": { usart: true, rx: true }, - "I2C4": { i2c: true, scl: true } - } + }, + { + pinName: "D11", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + I2C1: { i2c: true, scl: true }, + UART4: { usart: true, rx: true }, + I2C4: { i2c: true, scl: true }, }, - { - pinName: "D12", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "I2C1": { i2c: true, sda: true }, - "UART4": { usart: true, tx: true }, - "SPI2": { spi: true, ss: true }, - "I2S2": { i2s: true, ws: true }, - "I2C4": { i2c: true, sda: true } - } + }, + { + pinName: "D12", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + I2C1: { i2c: true, sda: true }, + UART4: { usart: true, tx: true }, + SPI2: { spi: true, ss: true }, + I2S2: { i2s: true, ws: true }, + I2C4: { i2c: true, sda: true }, }, - { - pinName: "D13", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "USART1": { usart: true, tx: true }, - "LPUART1": { usart: true, tx: true }, - "UART5": { usart: true, tx: true }, - "I2C1": { i2c: true, scl: true }, - "I2C4": { i2c: true, scl: true } - } + }, + { + pinName: "D13", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + USART1: { usart: true, tx: true }, + LPUART1: { usart: true, tx: true }, + UART5: { usart: true, tx: true }, + I2C1: { i2c: true, scl: true }, + I2C4: { i2c: true, scl: true }, }, - { - pinName: "D14", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "USART1": { usart: true, rx: true }, - "LPUART1": { usart: true, rx: true }, - "I2C1": { i2c: true, sda: true }, - "I2C4": { i2c: true, sda: true } - } + }, + { + pinName: "D14", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + USART1: { usart: true, rx: true }, + LPUART1: { usart: true, rx: true }, + I2C1: { i2c: true, sda: true }, + I2C4: { i2c: true, sda: true }, }, - null, - null, - null, - null, - null, - null, - { - pinName: "A0", - digitalInput: true, - digitalOutput: true, - analogInput: true + }, + null, + null, + null, + null, + null, + null, + { + pinName: "A0", + digitalInput: true, + digitalOutput: true, + analogInput: true, + }, + { + pinName: "A1", + digitalInput: true, + digitalOutput: true, + analogInput: true, + busCapabilities: { + USART2: { usart: true, rx: true }, }, - { - pinName: "A1", - digitalInput: true, - digitalOutput: true, - analogInput: true, - busCapabilities: { - "USART2": { usart: true, rx: true } - } + }, + { + pinName: "A2", + digitalInput: true, + digitalOutput: true, + analogInput: true, + }, + { + pinName: "A3", + digitalInput: true, + digitalOutput: true, + analogInput: true, + busCapabilities: { + SPI1: { spi: true, mosi: true }, + I2S1: { i2s: true, sd: true }, + SPI6: { spi: true, mosi: true }, }, - { - pinName: "A2", - digitalInput: true, - digitalOutput: true, - analogInput: true + }, + { + pinName: "A4", + digitalInput: true, + digitalOutput: true, + analogInput: true, + busCapabilities: { + SPI1: { spi: true, miso: true }, + I2S1: { i2s: true, sd: true }, + SPI6: { spi: true, miso: true }, }, - { - pinName: "A3", - digitalInput: true, - digitalOutput: true, - analogInput: true, - busCapabilities: { - "SPI1": { spi: true, mosi: true }, - "I2S1": { i2s: true, sd: true }, - "SPI6": { spi: true, mosi: true } - } + }, + { + pinName: "A5", + digitalInput: true, + digitalOutput: true, + analogInput: true, + }, + { + pinName: "A6", + digitalInput: true, + digitalOutput: true, + analogInput: true, + busCapabilities: { + I2S1: { i2s: true, ws: false, sd: false, sck: true }, }, - { - pinName: "A4", - digitalInput: true, - digitalOutput: true, - analogInput: true, - busCapabilities: { - "SPI1": { spi: true, miso: true }, - "I2S1": { i2s: true, sd: true }, - "SPI6": { spi: true, miso: true } - } + }, + { + pinName: "A7", + digitalInput: true, + digitalOutput: true, + analogInput: true, + busCapabilities: { + SPI1: { spi: true, mosi: false, miso: false, sck: true, ss: false }, + SPI6: { spi: true, mosi: false, miso: false, sck: true, ss: false }, + I2S1: { i2s: true, ws: false, sd: false, sck: true }, }, - { - pinName: "A5", - digitalInput: true, - digitalOutput: true, - analogInput: true + }, + { + pinName: "A8", + digitalInput: true, + digitalOutput: true, + analogInput: true, + busCapabilities: { + SPI1: { spi: true, mosi: false, miso: false, sck: false, ss: true }, + SPI3: { spi: true, mosi: false, miso: false, sck: false, ss: true }, + SPI6: { spi: true, mosi: false, miso: false, sck: false, ss: true }, + I2S1: { i2s: true, ws: true, sd: false, sck: false }, + I2S3: { i2s: true, ws: true, sd: false, sck: false }, }, - { - pinName: "A6", - digitalInput: true, - digitalOutput: true, - analogInput: true, - busCapabilities: { - "I2S1": { i2s: true, ws: false, sd: false, sck: true } - } + }, + { + pinName: "A9", + digitalInput: true, + digitalOutput: true, + analogInput: true, + busCapabilities: { + UART4: { usart: true, rx: true, tx: false }, }, - { - pinName: "A7", - digitalInput: true, - digitalOutput: true, - analogInput: true, - busCapabilities: { - "SPI1": { spi: true, mosi: false, miso: false, sck: true, ss: false }, - "SPI6": { spi: true, mosi: false, miso: false, sck: true, ss: false }, - "I2S1": { i2s: true, ws: false, sd: false, sck: true } - } + }, + { + pinName: "A10", + digitalInput: true, + digitalOutput: true, + analogInput: true, + busCapabilities: { + UART4: { usart: true, rx: false, tx: true }, }, - { - pinName: "A8", - digitalInput: true, - digitalOutput: true, - analogInput: true, - busCapabilities: { - "SPI1": { spi: true, mosi: false, miso: false, sck: false, ss: true }, - "SPI3": { spi: true, mosi: false, miso: false, sck: false, ss: true }, - "SPI6": { spi: true, mosi: false, miso: false, sck: false, ss: true }, - "I2S1": { i2s: true, ws: true, sd: false, sck: false }, - "I2S3": { i2s: true, ws: true, sd: false, sck: false } - } + }, + { + pinName: "D26", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + I2C4: { i2c: true, sda: false, scl: false }, }, + }, + { + pinName: "D27", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + SAI2: { i2s: true, ws: false, sd: false, sck: false }, + USART6: { usart: true, rx: true, tx: false }, + SPI1: { spi: true, mosi: false, miso: true, sck: false, ss: false }, + I2S1: { i2s: true, ws: false, sd: true, sck: false }, + }, + }, + { + pinName: "A11", + digitalInput: true, + digitalOutput: true, + analogInput: true, + busCapabilities: { + USART2: { usart: true, rx: false, tx: true }, + }, + }, + { + pinName: "D29", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + USB_HS: { usb: true, dplus: false, dminus: true }, + USART1: { usart: true, rx: false, tx: true }, + }, + }, + { + pinName: "D30", + digitalInput: true, + digitalOutput: true, + busCapabilities: { + USB_HS: { usb: true, dplus: true, dminus: false }, + USART1: { usart: true, rx: true, tx: false }, + }, + }, + null, + null, + null, +]; + +export class DaisySeed extends ImageObject<{}, {}, any[], any[], any[]> { + static author = "Corvus Prudens"; + static version = "v1.0.0"; + static description = "Daisy Seed SOM"; + static ios: IIosMeta = [ + ...DaisyPins.filter((pin) => pin != null).map( + (pin) => + ({ + type: "anything", + description: `Pin ${pin.pinName}`, + pin, + } as IIoMeta) + ), { - pinName: "A9", - digitalInput: true, - digitalOutput: true, - analogInput: true, + type: "anything", + description: "Internal USB D+", + pin: { + pinName: "USB D+", busCapabilities: { - "UART4": { usart: true, rx: true, tx: false } - } + USB_HS: { usb: true, dplus: true, dminus: false }, + }, + }, }, { - pinName: "A10", - digitalInput: true, - digitalOutput: true, - analogInput: true, + type: "anything", + description: "Internal USB D-", + pin: { + pinName: "USB D-", busCapabilities: { - "UART4": { usart: true, rx: false, tx: true } - } + USB_HS: { usb: true, dplus: false, dminus: true }, + }, + }, }, + ]; + + static patcherInlets: IInletsMeta = [ { - pinName: "D26", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "I2C4": { i2c: true, sda: false, scl: false } - } + isHot: true, + type: "signal", + description: "Audio DAC left", }, { - pinName: "D27", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "SAI2": { i2s: true, ws: false, sd: false, sck: false }, - "USART6": { usart: true, rx: true, tx: false }, - "SPI1": { spi: true, mosi: false, miso: true, sck: false, ss: false }, - "I2S1": { i2s: true, ws: false, sd: true, sck: false } - } + isHot: true, + type: "signal", + description: "Audio DAC right", }, { - pinName: "A11", - digitalInput: true, - digitalOutput: true, - analogInput: true, - busCapabilities: { - "USART2": { usart: true, rx: false, tx: true } - } + isHot: false, + type: "number", + description: "Set on-board LED", }, + ]; + + static patcherOutlets: IOutletsMeta = [ { - pinName: "D29", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "USB_HS": { usb: true, dplus: false, dminus: true }, - "USART1": { usart: true, rx: false, tx: true } - } + type: "signal", + description: "Audio ADC left", }, { - pinName: "D30", - digitalInput: true, - digitalOutput: true, - busCapabilities: { - "USB_HS": { usb: true, dplus: true, dminus: false }, - "USART1": { usart: true, rx: true, tx: false } - } + type: "signal", + description: "Audio ADC right", }, - null, - null, - null, -] + ]; -export class DaisySeed extends ImageObject<{}, {}, any[], any[], any[]> { - static author = "Corvus Prudens"; - static version = "v1.0.0"; - static description = "Daisy Seed SOM"; - static ios: IIosMeta = [ - ...DaisyPins.filter(pin => pin != null).map(pin => ({ - type: "anything", - description: `Pin ${pin.pinName}`, - pin - })) - ]; + subscribe() { + super.subscribe(); - static patcherInlets: IInletsMeta = [ - { - isHot: true, - type: "signal", - description: "Audio DAC left" - }, - { - isHot: true, - type: "signal", - description: "Audio DAC right" - }, - { - isHot: false, - type: "number", - description: "Set on-board LED", - } - ]; + this.on("preInit", () => { + const spacing = 1.0 / 20.8; + const offset = 0.6 * spacing; - static patcherOutlets: IOutletsMeta = [ - { - type: "signal", - description: "Audio ADC left" - }, - { - type: "signal", - description: "Audio ADC right" + const right = []; + for (let i = 0; i < 20; i++) { + if (DaisyPins[i] != null) { + right.push({ + edge: "R" as any, + position: offset + spacing * (19 - i), + }); } - ] + } - subscribe() { - super.subscribe(); - - this.on("preInit", () => { - - const spacing = 1.0 / 20.8; - const offset = 0.6 * spacing; + const left = []; + for (let i = 0; i < 20; i++) { + if (DaisyPins[20 + i] != null) { + left.push({ + edge: "L" as any, + position: offset + spacing * i, + }); + } + } - const right = []; - for (let i = 0; i < 20; i++) { - if (DaisyPins[i] != null) { - right.push({ - edge: "R" as any, - position: offset + spacing * (19 - i) - }); - } - } + const usb_dp = { + edge: "B", + position: 0.375, + }; - const left = []; - for (let i = 0; i < 20; i++) { - if (DaisyPins[20 + i] != null) { - left.push({ - edge: "L" as any, - position: offset + spacing * i - }); - } - } + const usb_dm = { + edge: "B", + position: 0.625, + }; - this.ios = [ - ...right, - ...left, - ] - this._.key = "https://cdn.discordapp.com/attachments/1049762470694223903/1111025669544095806/Daisy_Seed_illustrated_top.png"; - this._.scale = 0.28; - }); - } + this.ios = [...right, ...left, usb_dp, usb_dm]; + this._.key = + "https://cdn.discordapp.com/attachments/1049762470694223903/1111025669544095806/Daisy_Seed_illustrated_top.png"; + this._.scale = 0.28; + }); + } } diff --git a/src/scripts/internal-packages.json b/src/scripts/internal-packages.json index d6040cd0..e953906f 100644 --- a/src/scripts/internal-packages.json +++ b/src/scripts/internal-packages.json @@ -1 +1 @@ -["generators", "io", "math", "utilities", "ui"] +["generators", "io", "math", "utilities", "ui", "midi"]