diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c09d838 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.wav filter=lfs diff=lfs merge=lfs -text +*.m4a filter=lfs diff=lfs merge=lfs -text +*.asd filter=lfs diff=lfs merge=lfs -text diff --git a/audio/20220622-171706.wav b/audio/20220622-171706.wav new file mode 100644 index 0000000..402f0d7 --- /dev/null +++ b/audio/20220622-171706.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a6db833c8438dea164e6ce4bdfbb7fe1c65829994771baa80ff2d68be0c4856 +size 34207472 diff --git a/audio/20220622-171706.wav.asd b/audio/20220622-171706.wav.asd new file mode 100644 index 0000000..0b22fd4 --- /dev/null +++ b/audio/20220622-171706.wav.asd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f067029f944954dedbd80f9ed60a8ccab38593f392cb3476fb1038479cf8188 +size 588437 diff --git a/audio/Untitled Project/Ableton Project Info/Project8_1.cfg b/audio/Untitled Project/Ableton Project Info/Project8_1.cfg new file mode 100644 index 0000000..1da5409 Binary files /dev/null and b/audio/Untitled Project/Ableton Project Info/Project8_1.cfg differ diff --git a/audio/Untitled Project/Backup/Untitled [2022-06-24 152453].als b/audio/Untitled Project/Backup/Untitled [2022-06-24 152453].als new file mode 100644 index 0000000..a77789f Binary files /dev/null and b/audio/Untitled Project/Backup/Untitled [2022-06-24 152453].als differ diff --git "a/audio/Untitled Project/Icon\r" "b/audio/Untitled Project/Icon\r" new file mode 100644 index 0000000..e69de29 diff --git a/audio/Untitled Project/Untitled.als b/audio/Untitled Project/Untitled.als new file mode 100644 index 0000000..66dbc8d Binary files /dev/null and b/audio/Untitled Project/Untitled.als differ diff --git a/audio/comme_ca.m4a b/audio/comme_ca.m4a new file mode 100644 index 0000000..652afba --- /dev/null +++ b/audio/comme_ca.m4a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85d66357e644c3185ee88019e044607072166dc0acd301e22bb8b7a89010251d +size 98223 diff --git a/audio/comme_ca.wav b/audio/comme_ca.wav new file mode 100644 index 0000000..87f7ed2 --- /dev/null +++ b/audio/comme_ca.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9814820fe2ec846f4d01514f7264f729e6edd098393548e17d96bac873ecaa91 +size 385916 diff --git a/audio/edits/E1.read.wav b/audio/edits/E1.read.wav new file mode 100644 index 0000000..799cd9e --- /dev/null +++ b/audio/edits/E1.read.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd82515c23e884e6c91b29d6a7fbd7b28d95633bcbc37a01eaa1f1e2eb331416 +size 154396 diff --git a/audio/edits/E10.they_only.wav b/audio/edits/E10.they_only.wav new file mode 100644 index 0000000..ec33372 --- /dev/null +++ b/audio/edits/E10.they_only.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d164d3ff2c31a373b8f8b65ee1fc3125c36e78ddfbc0e4d86ac6b23de6190568 +size 231572 diff --git a/audio/edits/E11.knew.wav b/audio/edits/E11.knew.wav new file mode 100644 index 0000000..316253d --- /dev/null +++ b/audio/edits/E11.knew.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3babcde673b7ad53692e1a72191c77f283ad1bde06a3bcfd0292db941d26bca +size 132344 diff --git a/audio/edits/E12.from.wav b/audio/edits/E12.from.wav new file mode 100644 index 0000000..c3302c4 --- /dev/null +++ b/audio/edits/E12.from.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:136ffd344fab310b72bac9b0eb32b9c32a74629a8062a73009bc5d9fddfc6f3b +size 121320 diff --git a/audio/edits/E13.books.wav b/audio/edits/E13.books.wav new file mode 100644 index 0000000..626abda --- /dev/null +++ b/audio/edits/E13.books.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1bef252f02b6f78d4ed9e5f2c7c7b8922c359fd8df5349612b6ff01f843aea4 +size 143372 diff --git a/audio/edits/E2.old_tales.wav b/audio/edits/E2.old_tales.wav new file mode 100644 index 0000000..5eb69e8 --- /dev/null +++ b/audio/edits/E2.old_tales.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79d426e9ab11757eedc92494027e568c5a94a51670040184237817759c0df3ba +size 319772 diff --git a/audio/edits/E3.traversed_provinces.wav b/audio/edits/E3.traversed_provinces.wav new file mode 100644 index 0000000..0516a07 --- /dev/null +++ b/audio/edits/E3.traversed_provinces.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5fe989040c52673c7d00aa3a1d2d035215226f8e110d862980758e9dcf64d94 +size 418996 diff --git a/audio/edits/E4.crossed_seas.wav b/audio/edits/E4.crossed_seas.wav new file mode 100644 index 0000000..09e44d7 --- /dev/null +++ b/audio/edits/E4.crossed_seas.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be0a960f52964646682ee953e410b18ddf480ab0e93667b2184fa7505cfd7b41 +size 385920 diff --git a/audio/edits/E5.visited.wav b/audio/edits/E5.visited.wav new file mode 100644 index 0000000..d08f9f2 --- /dev/null +++ b/audio/edits/E5.visited.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb1ffb123e6ebfd92b91b7bb7e55dcb6bcbdef0ef45feea9c63cef2eb0afddc9 +size 187472 diff --git a/audio/edits/E6.new_peoples.wav b/audio/edits/E6.new_peoples.wav new file mode 100644 index 0000000..ac2734d --- /dev/null +++ b/audio/edits/E6.new_peoples.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f851050e02360572825afcf37d80cbccba1df5d97b33c2773de20374de229d3 +size 253620 diff --git a/audio/edits/E7.to_see.wav b/audio/edits/E7.to_see.wav new file mode 100644 index 0000000..3eb5ba7 --- /dev/null +++ b/audio/edits/E7.to_see.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:313bf334be792516922b1ec088fa0365cfd78b28461fd964ab4ea580c9d2df01 +size 209520 diff --git a/audio/edits/E8.face_to_face.wav b/audio/edits/E8.face_to_face.wav new file mode 100644 index 0000000..a0da8bd --- /dev/null +++ b/audio/edits/E8.face_to_face.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e929864462dd3da5be208580e9eeef29b069ca161513f65c98c6bd4b39d4a0e9 +size 363872 diff --git a/audio/edits/E9.persons.wav b/audio/edits/E9.persons.wav new file mode 100644 index 0000000..f222b83 --- /dev/null +++ b/audio/edits/E9.persons.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:beac2e31edee535271c8bc25fb757610bd2ead0fe7153f5588abc1dc8854139e +size 132344 diff --git a/audio/edits/EA.we_read_in_old_tales.wav b/audio/edits/EA.we_read_in_old_tales.wav new file mode 100644 index 0000000..8fb49b8 --- /dev/null +++ b/audio/edits/EA.we_read_in_old_tales.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afaafbf1dde9e079e41f8367d1ab79bcfe1bb30f372848675e6228062007eaf9 +size 323088 diff --git a/audio/edits/EB.that_men_traversed_provinces.wav b/audio/edits/EB.that_men_traversed_provinces.wav new file mode 100644 index 0000000..a3c8ce5 --- /dev/null +++ b/audio/edits/EB.that_men_traversed_provinces.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:813a32ba4fe5a6c62ff590937cfc41e19a566afb26c1f3350b7ed74832ab5365 +size 315792 diff --git a/audio/edits/EC.crossed_seas_and_visited_new_peoples.wav b/audio/edits/EC.crossed_seas_and_visited_new_peoples.wav new file mode 100644 index 0000000..b0d5f76 --- /dev/null +++ b/audio/edits/EC.crossed_seas_and_visited_new_peoples.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9dfa4d1aa38da2f025421277d4259d749158edd373a44b405750f419b23fa646 +size 546620 diff --git a/audio/edits/ED.to_see_face_to_face_persons.wav b/audio/edits/ED.to_see_face_to_face_persons.wav new file mode 100644 index 0000000..92c83a9 --- /dev/null +++ b/audio/edits/ED.to_see_face_to_face_persons.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd0febd463d74ece328fa8ef5af50f167ded9ef8984c50a7d219aaecb5ebe3f6 +size 334720 diff --git a/audio/edits/EE.whom_they_only_knew_from_books.wav b/audio/edits/EE.whom_they_only_knew_from_books.wav new file mode 100644 index 0000000..91494ec --- /dev/null +++ b/audio/edits/EE.whom_they_only_knew_from_books.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:856fd5b1b79413c175f7715003235de0e74059c548ab0ce6e3cad6a074f4cbd0 +size 301992 diff --git a/audio/edits/ENGLISH.wav b/audio/edits/ENGLISH.wav new file mode 100644 index 0000000..160fb92 --- /dev/null +++ b/audio/edits/ENGLISH.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f14dd2f385746b7e8de3dd68b47ee755723ea05be5c20dd2bf24643e05b8f13b +size 1984544 diff --git a/audio/edits/L0.legimus.wav b/audio/edits/L0.legimus.wav new file mode 100644 index 0000000..e0f5982 --- /dev/null +++ b/audio/edits/L0.legimus.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9cda58783cbaa77d7597819daf162028a7ac5dd8c427c6aa09d5612603a177c +size 170932 diff --git a/audio/edits/L1.in_veteribus.wav b/audio/edits/L1.in_veteribus.wav new file mode 100644 index 0000000..9f7a8ed --- /dev/null +++ b/audio/edits/L1.in_veteribus.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ffdc6bcdb978fd357366f1519b74794980f2de097e05423919118d8ff0801a6d +size 344576 diff --git a/audio/edits/L10.noverant.wav b/audio/edits/L10.noverant.wav new file mode 100644 index 0000000..6dc1090 --- /dev/null +++ b/audio/edits/L10.noverant.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e669618fc1af7d9493b2d2186ccbd6b37a490fff956aa1f8acf148c0093c6d56 +size 253620 diff --git a/audio/edits/L11.coram.wav b/audio/edits/L11.coram.wav new file mode 100644 index 0000000..ca623f0 --- /dev/null +++ b/audio/edits/L11.coram.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a4396d48f3ea169a4fd3b2bb5dcdc7b8c3007e6b6ce825d45da17eff21f1bb6 +size 209520 diff --git a/audio/edits/L12.quoque_viderent.wav b/audio/edits/L12.quoque_viderent.wav new file mode 100644 index 0000000..fa6392d --- /dev/null +++ b/audio/edits/L12.quoque_viderent.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e80550d731332825810b44d2a39635534e50cdd463e628a1324d4d8605444506 +size 385920 diff --git a/audio/edits/L2.historiis.wav b/audio/edits/L2.historiis.wav new file mode 100644 index 0000000..2e75921 --- /dev/null +++ b/audio/edits/L2.historiis.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73adab59d08554e4740f1eef0792fc931d85d401a426d77fafbc6ca1e3e95b9d +size 319772 diff --git a/audio/edits/L3.quosdam_lustrasse_provincias.wav b/audio/edits/L3.quosdam_lustrasse_provincias.wav new file mode 100644 index 0000000..ed323b9 --- /dev/null +++ b/audio/edits/L3.quosdam_lustrasse_provincias.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54ba5733c44167b6d7a9b836f3bbf78f77fd26779316aaf89cdcda7f3fe4aec2 +size 617444 diff --git a/audio/edits/L4.novos.wav b/audio/edits/L4.novos.wav new file mode 100644 index 0000000..b3a1243 --- /dev/null +++ b/audio/edits/L4.novos.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c64ef36aea8c5dcaf193a063b99702e9d29d795e01c884e8080c6454e997bcb1 +size 187472 diff --git a/audio/edits/L5.adiisse_populos.wav b/audio/edits/L5.adiisse_populos.wav new file mode 100644 index 0000000..de66b43 --- /dev/null +++ b/audio/edits/L5.adiisse_populos.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbfb5be26e93b6dd5ba1fbcd0df0c79e9f0f54ad5f04f8ae05caaf1a98855c91 +size 430020 diff --git a/audio/edits/L6.maria_transisse.wav b/audio/edits/L6.maria_transisse.wav new file mode 100644 index 0000000..641e0d0 --- /dev/null +++ b/audio/edits/L6.maria_transisse.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c97d54b83af7d4f9b150c0016a27c502db73d63e4492104ff4d9f9d5d302376e +size 407972 diff --git a/audio/edits/L7.ut_eos.wav b/audio/edits/L7.ut_eos.wav new file mode 100644 index 0000000..8812932 --- /dev/null +++ b/audio/edits/L7.ut_eos.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:783c1d85c33bd8f0e8ff9b5fc90ddfb28520960555ead7d1d834c59f54e3b0e1 +size 242596 diff --git a/audio/edits/L8.quos.wav b/audio/edits/L8.quos.wav new file mode 100644 index 0000000..de72e97 --- /dev/null +++ b/audio/edits/L8.quos.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8877f417bbeb33e30eff7a3bd3e973a199fab95a850e92f0b6022984e95bcc4c +size 165420 diff --git a/audio/edits/L9.ex_libris.wav b/audio/edits/L9.ex_libris.wav new file mode 100644 index 0000000..85ba2be --- /dev/null +++ b/audio/edits/L9.ex_libris.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:061ce4ed051d8a4b8d5cb7c775b0e138fb3a6159ca18e99fc95c8b42bf1bbdb6 +size 242596 diff --git a/audio/edits/LA.legimus_in_vereribus_historiis.wav b/audio/edits/LA.legimus_in_vereribus_historiis.wav new file mode 100644 index 0000000..a1555de --- /dev/null +++ b/audio/edits/LA.legimus_in_vereribus_historiis.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbe80bf30f76de60ec49c29608b9918a64f99dfa184e14a6d697cb671f7c0867 +size 491564 diff --git a/audio/edits/LATIN.wav b/audio/edits/LATIN.wav new file mode 100644 index 0000000..965718c --- /dev/null +++ b/audio/edits/LATIN.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4eb92025c3c9b633fd6a81156b522a759acd3ca9fc4dae578f206d1434bc3557 +size 2535796 diff --git a/audio/edits/LB.quodam_lustrasse_provincias.wav b/audio/edits/LB.quodam_lustrasse_provincias.wav new file mode 100644 index 0000000..81d4999 --- /dev/null +++ b/audio/edits/LB.quodam_lustrasse_provincias.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a88e0d204e107440b567cbeec92bc879bbdb3eac3af7ffd1ba8e4dd91850dbf +size 357404 diff --git a/audio/edits/LC.novos_adiisse_populos_maria_transisse.wav b/audio/edits/LC.novos_adiisse_populos_maria_transisse.wav new file mode 100644 index 0000000..896707d --- /dev/null +++ b/audio/edits/LC.novos_adiisse_populos_maria_transisse.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64eecc1380fb446e1343f8d64f927ab2337bcc762a985ff0563cc82c70a4c081 +size 648528 diff --git a/audio/edits/LD.ut_eos_quos_ex_libris_noverant.wav b/audio/edits/LD.ut_eos_quos_ex_libris_noverant.wav new file mode 100644 index 0000000..47a6289 --- /dev/null +++ b/audio/edits/LD.ut_eos_quos_ex_libris_noverant.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a76d216885cb5af8abf12fb44734aacc0bde6f05d00a772eda8d1323e299b725 +size 498776 diff --git a/audio/edits/LE.coram_quoque_viderent.wav b/audio/edits/LE.coram_quoque_viderent.wav new file mode 100644 index 0000000..07f22ae --- /dev/null +++ b/audio/edits/LE.coram_quoque_viderent.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd6b6ab19daf363fc7a6acf4fc42d1a653266661fc5068f8b5c387ac18cd2e3e +size 370084 diff --git a/audio/edits/translation.rtf b/audio/edits/translation.rtf new file mode 100644 index 0000000..6558e01 --- /dev/null +++ b/audio/edits/translation.rtf @@ -0,0 +1,84 @@ +{\rtf1\ansi\ansicpg1252\cocoartf2638 +\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\froman\fcharset0 TimesNewRomanPSMT;\f1\froman\fcharset0 TimesNewRomanPS-ItalicMT;} +{\colortbl;\red255\green255\blue255;\red24\green55\blue106;\red0\green0\blue0;} +{\*\expandedcolortbl;;\cssrgb\c12157\c28627\c49020;\cssrgb\c0\c0\c0;} +\paperw11900\paperh16840\margl1440\margr1440\vieww11520\viewh8400\viewkind0 +\deftab720 +\pard\pardeftab720\partightenfactor0 + +\f0\fs37\fsmilli18667 \cf2 \expnd0\expndtw0\kerning0 +Dear Sam, +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 Thank you for the message. I am okay, and hope you are, too. +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 The section you print reads: +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'85 studia conciliant. Legimus in veteribus | +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 Historiis, quosdam lustrasse provincias, | +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 novos adiisse \{sic.\} populos, maria transisse, | +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 ut eos quos ex libris noverant, coram | +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 quoque viderent. Sicut \{sic.\} pitagoras memphi= | +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 I have checked this against the printing in +\f1\i Patrologia Latina +\f0\i0 , and have marked two variants: PL records \'91adisse\'92 and \'91Sic\'92, but I have transcribed what is in Gutenberg. The final phrase finishes \'91memphiticos vates\'92. +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 Hope this helps. +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 Best wishes, +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 \'a0 +\fs32 \cf0 \ + +\fs37\fsmilli18667 \cf2 Alan.} \ No newline at end of file diff --git a/audio/libris_laborem.m4a b/audio/libris_laborem.m4a new file mode 100644 index 0000000..f731419 --- /dev/null +++ b/audio/libris_laborem.m4a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19496684bb4d108a01723cddf438d12e334dd19c1bb8c47e29a3a668996e2cb0 +size 40013 diff --git a/audio/libris_laborem.wav b/audio/libris_laborem.wav new file mode 100644 index 0000000..7338df3 --- /dev/null +++ b/audio/libris_laborem.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f1510bed6fc3484cf724fae58e6bd4134891665d034729e28724dd52f66c376 +size 416684 diff --git a/audio/phrases/ENGLISH.wav b/audio/phrases/ENGLISH.wav new file mode 100644 index 0000000..160fb92 --- /dev/null +++ b/audio/phrases/ENGLISH.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f14dd2f385746b7e8de3dd68b47ee755723ea05be5c20dd2bf24643e05b8f13b +size 1984544 diff --git a/audio/phrases/LATIN.wav b/audio/phrases/LATIN.wav new file mode 100644 index 0000000..965718c --- /dev/null +++ b/audio/phrases/LATIN.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4eb92025c3c9b633fd6a81156b522a759acd3ca9fc4dae578f206d1434bc3557 +size 2535796 diff --git a/libs/42line/FASTSENSOR.h b/libs/42line/FASTSENSOR.h new file mode 100644 index 0000000..17e9ff6 --- /dev/null +++ b/libs/42line/FASTSENSOR.h @@ -0,0 +1,96 @@ +#pragma once + +// #include +#include + +static float alpha = 0.2; +static int baseline_fluctuation = 5; +static int baseline_fluctuation_hits = 100; +static int max_s = 60; + +typedef void(*toggle_cb)(bool, int); + +struct SENSOR_t { + + int PIN, base, num_base, max_c, v, prev, raw, cutoff_s; + int dv; + unsigned long timestamp_calib; + toggle_cb fn_toggle_cb; + bool call_toggle = false; + + SENSOR_t(const int& pin, int cutoff) { + PIN = pin; + max_c = max_s; + num_base = 0; + cutoff_s = cutoff; + fn_toggle_cb = NULL; + } + + void plug_toggle_cb(toggle_cb fn) { + fn_toggle_cb = fn; + } + + void baseline(int n, int d) { + float cum = 0; + for (int i = 0; i < n; i++){ + update(false, false); + if(abs(dv) < baseline_fluctuation){ + cum += v; + } + delay(d); + + } + base = (int)floor(cum / n); + } + + void calibrate() { + // if(abs(dv) < baseline_fluctuation) { + // num_base++; + // if (num_base > baseline_fluctuation_hits) + // base = (int) (alpha * (float)v + (1.0 - alpha) * (float)base); + // } else { + // num_base = 0; + // } + if(v > max_c) max_c = v; + timestamp_calib = millis(); + } + + void update(bool calib = true, bool filt = true) { + raw = fastTouchRead(PIN); + if(filt) + v = filter(raw); + else + v = raw; + dv = v - prev; + if(calib) calibrate(); + + if(fn_toggle_cb) { + int m_v = map(v, base, max_c, 0, 100); + int m_prev = map(prev, base, max_c, 0, 100); + if(m_prev < cutoff_s && m_v >= cutoff_s) + fn_toggle_cb(true, PIN); + else if(m_prev > cutoff_s && m_v <= cutoff_s) + fn_toggle_cb(false, PIN); + } + + prev = v; + + } + + int map_range(int min_v, int max_v) { + return map(v, base, max_c, min_v, max_v); + } + + int map_range_raw(int min_v, int max_v) { + return map(raw, base, max_c, min_v, max_v); + } + + int filter(int n) { + return (int) (alpha * n + (1.0 - alpha) * prev); + } + + bool touch() { + return (v > cutoff_s); + } + +}; diff --git a/libs/42line/SENSOR.h b/libs/42line/SENSOR.h new file mode 100644 index 0000000..cba19cf --- /dev/null +++ b/libs/42line/SENSOR.h @@ -0,0 +1,64 @@ +#pragma once + +#include + +static float alpha = 0.2; +static int baseline_fluctuation = 75; +static int max_s = 3000; + +typedef struct SENSOR_t { + + int PIN, base, num_base, max_c, v, prev; + int dv; + unsigned long timestamp_calib; + + SENSOR_t(int& pin) { + PIN = pin; + max_c = max_s; + num_base = 0; + } + + void baseline(int n, int d) { + int cum = 0; + for (int i = 0; i < n; i++){ + update(false, false); + if(abs(dv) < baseline_fluctuation){ + cum += v; + } + delay(d); + } + base = (int)(cum / n); + } + + void calibrate() { + if(abs(dv) < baseline_fluctuation) { + num_base++; + if (num_base > 25) + base = (int) (alpha * (float)v + (1.0 - alpha) * (float)base); + } else { + num_base = 0; + } + if(v > max_c) max_c = v; + timestamp_calib = millis(); + } + + void update(bool calib = true, bool filt = true) { + int d = touchRead(PIN); + if(filt) + v = filter(d); + else + v = d; + dv = v - prev; + prev = v; + if(calib) calibrate(); + } + + int map_range(int min_v, int max_v) { + return map(v, base, max_c, min_v, max_v); + } + + int filter(int n) { + return (int) (alpha * n + (1.0 - alpha) * prev); + } + +}; diff --git a/libs/42line/SOUND.h b/libs/42line/SOUND.h new file mode 100644 index 0000000..288b92f --- /dev/null +++ b/libs/42line/SOUND.h @@ -0,0 +1,135 @@ +#pragma once + +#include +#include "WORDS.h" + +static int time_interval_random_start = 2000; + +typedef void(*synth_toggle_cb)(bool, int); + +void _random_wav(AudioPlaySdWav* wav, E_WORDS* e_words, int MAX_WORD) { + int w = (int)random(0, MAX_WORD); + wav->play(words[e_words[w]]); +} + +enum WAVPLAY_STATE { + LATIN, ENGLISH, RANDOM, NONE +}; + +typedef struct WAVPLAY_t { + + int pin; + AudioPlaySdWav* wav; + E_PHRASES en_phrase; + E_PHRASES la_phrase; + E_WORDS* random_words; + int nbr_random_words; + synth_toggle_cb synth_toggle_func = NULL; + + long random_start; + + WAVPLAY_STATE state; + + WAVPLAY_t(const int p, AudioPlaySdWav* w, E_PHRASES en, E_PHRASES la, E_WORDS* wds, int nbr_wds, synth_toggle_cb synth_func) { + pin = p; + wav = w; + en_phrase = en; + la_phrase = la; + random_words = wds; + nbr_random_words = nbr_wds; + state = NONE; + synth_toggle_func = synth_func; + } + + void play(){ + + switch(state) { + case NONE: + wav->play(phrases[la_phrase]); + delay(25); + state = LATIN; + // Serial.println("state none > latin"); + break; + default: + break; + } + } + + void stop(){ + wav->stop(); + if(state == RANDOM) synth_toggle_func(false, pin); + state = NONE; + } + + void update(){ + + if(state == NONE) return; + + if(wav->isPlaying()) { + // Serial.println("..."); + return; + } + + switch(state) { + case LATIN: + wav->play(phrases[en_phrase]); + state = ENGLISH; + // Serial.println("state latin > english"); + break; + case ENGLISH: + // _random_wav(wav, random_words, nbr_random_words); + state = RANDOM; + random_start = millis(); + synth_toggle_func(true, pin); + // Serial.println("state english > random"); + break; + case RANDOM: + if(millis() - random_start > time_interval_random_start) { + _random_wav(wav, random_words, nbr_random_words); + // Serial.println("random"); + } + break; + default: + break; + } + } +}; + + +typedef struct DETUNE_t { + + AudioSynthWaveformSine sine3; + AudioSynthWaveformSine sine2; + AudioSynthWaveformSine sine1; + + int base_freq = 0; + + DETUNE_t(int freq) { + set_frequency(freq); + } + + void set_frequency(int freq) { + sine1.frequency(freq); + sine2.frequency(freq); + sine3.frequency(freq); + base_freq = freq; + } + + void set_detune(float detune) { + int det_mid = (int)(detune/2.0); + sine2.frequency(base_freq + det_mid); + + if(detune > 100) + sine3.frequency(base_freq - det_mid); + else + sine3.frequency(base_freq - 2 * det_mid); + + int r = (int)random(0, 100); + if(r > 33) + sine1.frequency(det_mid/2); + + } + +}; + + diff --git a/libs/42line/WORDS.h b/libs/42line/WORDS.h new file mode 100644 index 0000000..66a5ab9 --- /dev/null +++ b/libs/42line/WORDS.h @@ -0,0 +1,55 @@ +#pragma once + +static const char* const words[] = { +"E1.read.wav", +"E2.old_tales.wav", +"E3.traversed_provinces.wav", +"E4.crossed_seas.wav", +"E5.visited.wav", +"E6.new_peoples.wav", +"E7.to_see.wav", +"E8.face_to_face.wav", +"E9.persons.wav", +"E10.they_only.wav", +"E11.knew.wav", +"E12.from.wav", +"E13.books.wav", +"L0.legimus.wav", +"L1.in_veteribus.wav", +"L2.historiis.wav", +"L3.quosdam_lustrasse_provincias.wav", +"L4.novos.wav", +"L5.adiisse_populos.wav", +"L6.maria_transisse.wav", +"L7.ut_eos.wav", +"L8.quos.wav", +"L9.ex_libris.wav", +"L10.noverant.wav", +"L11.coram.wav", +"L12.quoque_viderent.wav", +"ENGLISH.wav", +"LATIN.wav" +}; + +enum E_WORDS { +E1,E2,E3,E4,E5,E6,E7,E8,E9,E10,E11,E12,E13,L0,L1,L2,L3,L4,L5,L6,L7,L8,L9,L10,L11,L12,EN,LAT +}; + + +static const char* const phrases[] = { + +"EA.we_read_in_old_tales.wav", +"EB.that_men_traversed_provinces.wav", +"EC.crossed_seas_and_visited_new_peoples.wav", +"ED.to_see_face_to_face_persons.wav", +"EE.whom_they_only_knew_from_books.wav", +"LA.legimus_in_vereribus_historiis.wav", +"LB.quodam_lustrasse_provincias.wav", +"LC.novos_adiisse_populos_maria_transisse.wav", +"LD.ut_eos_quos_ex_libris_noverant.wav", +"LE.coram_quoque_viderent.wav" +}; + +enum E_PHRASES { +EA, EB, EC, ED, EE, LA, LB, LC, LD, LE +}; diff --git a/libs/FastTouch/Examples/FastTouchSerialReportLilypadUSB/FastTouchSerialReportLilypadUSB.ino b/libs/FastTouch/Examples/FastTouchSerialReportLilypadUSB/FastTouchSerialReportLilypadUSB.ino new file mode 100644 index 0000000..efbf67c --- /dev/null +++ b/libs/FastTouch/Examples/FastTouchSerialReportLilypadUSB/FastTouchSerialReportLilypadUSB.ino @@ -0,0 +1,27 @@ +#include + +// Adrian Freed 2018 + +void setup() +{ + SerialUSB.begin(9600); +} + + + void loop() + { + SerialUSB.print(fastTouchRead(A2)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(A3)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(A4)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(A5)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(2)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(3)); SerialUSB.print(" "); + + for(int i=9;i<=11;++i) + { + SerialUSB.print(fastTouchRead(i)); SerialUSB.print(" "); + } + SerialUSB.println(); + delay(100); +} + diff --git a/libs/FastTouch/Examples/FastTouchSerialReportTeensy/FastTouchSerialReportTeensy.ino b/libs/FastTouch/Examples/FastTouchSerialReportTeensy/FastTouchSerialReportTeensy.ino new file mode 100644 index 0000000..6af828a --- /dev/null +++ b/libs/FastTouch/Examples/FastTouchSerialReportTeensy/FastTouchSerialReportTeensy.ino @@ -0,0 +1,30 @@ +#include +// +// Adrian Freed 2019 +// +// report on whether pins are being touched based on how +// slow the pins arrive at HIGH from ground when a PULLUP resistor is enabled +// all pin except the built-in LED are probed. Note that each pin will be hard pulled +// to ground and that interrupts are briefly stopped during the measurement. +// + +void setup() +{ + SerialUSB.begin(9600); +} + + + void loop() + { + for(int i=0;i + +// monotone touch sequencer +// Adrian Freed 2018 + +void setup() +{ + SerialUSB.begin(9600); +} + + + void loop() + { + int r; + const int tonepin=10; + const int notelength=140, notetonote=160; + SerialUSB.print(r = fastTouchRead(A2)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 587, notelength/(r-1)); delay(notetonote); } + SerialUSB.print(r = fastTouchRead(A3)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 440, notelength/(r-1)); delay(notetonote); } + SerialUSB.print(r = fastTouchRead(A4)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 880, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(A5)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 153, notelength/(r-1)); delay(notetonote); } + SerialUSB.print(r = fastTouchRead(2)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 185, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(3)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 196, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(9)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 349, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(11)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 370, notelength/(r-1)); delay(notetonote);} + + SerialUSB.println(); +} + diff --git a/libs/FastTouch/Examples/FastTouchSerialTonePlaygroundExpress/FastTouchSerialTonePlaygroundExpress.ino b/libs/FastTouch/Examples/FastTouchSerialTonePlaygroundExpress/FastTouchSerialTonePlaygroundExpress.ino new file mode 100644 index 0000000..e151da3 --- /dev/null +++ b/libs/FastTouch/Examples/FastTouchSerialTonePlaygroundExpress/FastTouchSerialTonePlaygroundExpress.ino @@ -0,0 +1,41 @@ +#include + +// monotone touch sequencer +// Adrian Freed 2018 + +void setup() +{ + SerialUSB.begin(9600); +} + + + void loop() + { + int r; + const int tonepin=A0; + const int notelength=140, notetonote=190; + SerialUSB.print(r = fastTouchRead(A2)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 587/2, notelength/(r-1)); delay(notetonote); } + SerialUSB.print(r = fastTouchRead(A3)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 440, notelength/(r-1)); delay(notetonote); } + SerialUSB.print(r = fastTouchRead(A4)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 220, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(A5)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 153, notelength/(r-1)); delay(notetonote); } + SerialUSB.print(r = fastTouchRead(A1)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 185, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(A6)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 196, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(A7)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 349, notelength/(r-1)); delay(notetonote);} + + SerialUSB.println(); +} + diff --git a/libs/FastTouch/README.md b/libs/FastTouch/README.md new file mode 100644 index 0000000..599e366 --- /dev/null +++ b/libs/FastTouch/README.md @@ -0,0 +1,6 @@ +# FastTouch +Use this library to detect whether your choice of Arduino pin is being touched. +The technique works with any Arduino pin that has an internal pull up resistor that +can be enabled. It returns a measure of how long it takes for a pin to rise +to a HIGH level after the pull up is enabled. This will be slowed by any +capacitive load added. diff --git a/libs/FastTouch/keywords.txt b/libs/FastTouch/keywords.txt new file mode 100755 index 0000000..e45d161 --- /dev/null +++ b/libs/FastTouch/keywords.txt @@ -0,0 +1,2 @@ +fastTouchRead KEYWORD1 +fastTouchMax KEYWORD1 \ No newline at end of file diff --git a/libs/FastTouch/library.properties b/libs/FastTouch/library.properties new file mode 100644 index 0000000..f277c59 --- /dev/null +++ b/libs/FastTouch/library.properties @@ -0,0 +1,9 @@ +name=FastTouch +version=0.91 +author=Adrian Freed +maintainer=Adrian Freed +sentence=Fast Touch Library +paragraph=Fast Capacitive Touch on any digital pin with a pull up option +category=Device Control +url=https://github.com/AdrianFreed/FastTouch +architectures=* diff --git a/libs/FastTouch/src/FastTouch.cpp b/libs/FastTouch/src/FastTouch.cpp new file mode 100644 index 0000000..11019d3 --- /dev/null +++ b/libs/FastTouch/src/FastTouch.cpp @@ -0,0 +1,803 @@ +// +// FastTouch.cpp +// +// +// Created by AdrianFreed on 3/12/18. +// +// + +#include "FastTouch.h" + + + + +#if defined(CORE_TEENSY) + +//#if defined(__IMXRT1052__) || defined(__IMXRT10562__) + +#if defined(__IMXRT1052__) || defined(__IMXRT1062__) + +FASTRUN +int fastTouchRead(int pin) +{ + int i; + const struct digital_pin_bitband_and_config_table_struct *p; + if (pin >= CORE_NUM_DIGITAL) return -1; + p = digital_pin_to_info_PGM + pin; + + + pinMode(pin, OUTPUT_OPENDRAIN); + digitalWrite(pin, LOW); + delayMicroseconds(1); + /* disable interrupts */ + noInterrupts(); + pinMode(pin, INPUT_PULLUP); + i=0; + if((*(p->reg + 2) & p->mask)!=0) + goto out; + if((*(p->reg + 2) & p->mask)!=0) + goto out; + if((*(p->reg + 2) & p->mask)!=0) + goto out; + i++; + if((*(p->reg + 2) & p->mask)!=0) + goto out; + i++; + if((*(p->reg + 2) & p->mask)!=0) + goto out; + i++; + if((*(p->reg + 2) & p->mask)!=0) + goto out; + i++; + if((*(p->reg + 2) & p->mask)!=0) + goto out; + i++; + if((*(p->reg + 2) & p->mask)!=0) + goto out; + i++; + + for(;i<64;++i) + if((*(p->reg + 2) & p->mask)!=0) + break; +// v += fastDigitalRead(pin)? 0:1; + { + + pinMode(pin, OUTPUT_OPENDRAIN); + digitalWrite(pin, LOW); + + + + } +out: + interrupts(); + return i; +} +#elif defined(__MKL26Z64__)|| defined(__IMXRT1052__) || defined(__IMXRT1062__) /* Teensy 3LC */ +FASTRUN +int fastTouchRead(int pin) +{ + const unsigned m = digitalPinToBitMask(pin); + + pinMode(pin, OUTPUT_OPENDRAIN); + digitalWrite(pin, LOW); + delayMicroseconds(50); + /* disable interrupts */ + noInterrupts(); + pinMode(pin, INPUT_PULLUP); + + // for(int i=0;i<64;++i) + // ft_o += *port&x; + { + register unsigned a,b,c,d,e,f; + register unsigned aa,ba,ca,da; +#ifdef CONDITIONALAPPROACH + register unsigned i=0; + + + a = *portInputRegister(pin) & m ; + a = *portInputRegister(pin) & m ; + a = *portInputRegister(pin) & m ; + b = *portInputRegister(pin) & m ; + c = *portInputRegister(pin) & m ; + d = *portInputRegister(pin) & m ; + e = *portInputRegister(pin) & m ; + f = *portInputRegister(pin) & m ; + aa = *portInputRegister(pin) & m; + ba = *portInputRegister(pin) & m; + ca = *portInputRegister(pin) & m; + da = *portInputRegister(pin) & m; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + if( *portInputRegister(pin) & m ) + goto out; + ++i; + out: ; + +#else + register unsigned i; + + i = *portInputRegister(pin) & m; + i = *portInputRegister(pin) & m; + + i = *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + i+= *portInputRegister(pin) & m; + + + +#endif + + + interrupts(); + + // i += ((a & m)?0:1 ) + ((b& m )?0:1 ) + + // ((c & m)?0:1 ) + ((d& m)?0:1 ) + ((e & m)?0:1 ) + ((f& m)?0:1 ); + //i += ((aa & m)?0:1 ) + ((ba& m )?0:1 ) + + // ((ca & m)?0:1 ) + ((da & m)?0:1 ) + ((ea & m)?0:1 ) + ((fa& m)?0:1 ); + {volatile unsigned t = i, mm = m; + while(mm >>= 1) + t >>= 1; + i = 64 -t; } //+(a+b+c+d+e+f+da+ca+ba+aa 10+ + pinMode(pin, OUTPUT_OPENDRAIN); + digitalWrite(pin, LOW); + + return i; + + } +} +#else +FASTRUN +int fastTouchRead(int pin) +{ + pinMode(pin, OUTPUT_OPENDRAIN); + digitalWriteFast(pin, LOW); + delayMicroseconds(50); + /* disable interrupts */ + noInterrupts(); + pinMode(pin, INPUT_PULLUP); + + // for(int i=0;i<64;++i) + // ft_o += *port&x; + { + register unsigned i=0; + register uint8_t a,b,c,d,e,f; + register uint8_t aa,ba,ca,da; + + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + + + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + a = *portInputRegister(pin) ; + b = *portInputRegister(pin) ; + c = *portInputRegister(pin) ; + d = *portInputRegister(pin) ; + e = *portInputRegister(pin) ; + f = *portInputRegister(pin) ; + aa = *portInputRegister(pin) ; + ba = *portInputRegister(pin) ; + ca = *portInputRegister(pin) ; + da = *portInputRegister(pin) ; + + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + if( *portInputRegister(pin)) + goto out; + ++i; + out: + + + + interrupts(); + // i += ((a & m)?0:1 ) + ((b& m )?0:1 ) + + // ((c & m)?0:1 ) + ((d& m)?0:1 ) + ((e & m)?0:1 ) + ((f& m)?0:1 ); + //i += ((aa & m)?0:1 ) + ((ba& m )?0:1 ) + + // ((ca & m)?0:1 ) + ((da & m)?0:1 ) + ((ea & m)?0:1 ) + ((fa& m)?0:1 ); + {volatile uint8_t t =10-(a+b+c+d+e+f+da+ca+ba+aa); + i+= t; } + pinMode(pin, OUTPUT_OPENDRAIN); + digitalWriteFast(pin, LOW); + + return i; + + } +} +#endif +#endif + +int fastTouchMax() +{ + return 60; +} + + diff --git a/libs/FastTouch/src/FastTouch.h b/libs/FastTouch/src/FastTouch.h new file mode 100644 index 0000000..a53eaa0 --- /dev/null +++ b/libs/FastTouch/src/FastTouch.h @@ -0,0 +1,243 @@ +// +// +//FastTouch.h +// Fast Touch Sensing for AVR and Teensy 3 +// Adrian Freed 2006-2018 Copyright. All Rights Reserved. +// Tested on Teensy 2.0, Clio, Lilypad, Lilypad USB, Flora, Leonardo, UNO, Micro, BLEpad, PRO Mini, +// Teensy 3.2 (more sensitive with optimized compiler settings and higher clock rate) +// Teensy 3LC +// + +#ifndef FastTouch_h +#define FastTouch_h + +#include +#if defined(CORE_TEENSY) +#include "core_pins.h" +#endif + +#ifndef BIT_SET +# define BIT_SET(value, bit) ((value) |= (1UL << (bit))) +#endif + + + +//Arduino +#if (defined(ARDUINO_AVR_MEGA) || \ +defined(ARDUINO_AVR_MEGA1280) || \ +defined(ARDUINO_AVR_MEGA2560) || \ +defined(__AVR_ATmega1280__) || \ +defined(__AVR_ATmega1281__) || \ +defined(__AVR_ATmega2560__) || \ +defined(__AVR_ATmega2561__)) + +#define __digitalPinToPortReg(P) \ +(((P) >= 22 && (P) <= 29) ? &PORTA : \ +((((P) >= 10 && (P) <= 13) || ((P) >= 50 && (P) <= 53)) ? &PORTB : \ +(((P) >= 30 && (P) <= 37) ? &PORTC : \ +((((P) >= 18 && (P) <= 21) || (P) == 38) ? &PORTD : \ +((((P) >= 0 && (P) <= 3) || (P) == 5) ? &PORTE : \ +(((P) >= 54 && (P) <= 61) ? &PORTF : \ +((((P) >= 39 && (P) <= 41) || (P) == 4) ? &PORTG : \ +((((P) >= 6 && (P) <= 9) || (P) == 16 || (P) == 17) ? &PORTH : \ +(((P) == 14 || (P) == 15) ? &PORTJ : \ +(((P) >= 62 && (P) <= 69) ? &PORTK : &PORTL)))))))))) + +#define __digitalPinToDDRReg(P) \ +(((P) >= 22 && (P) <= 29) ? &DDRA : \ +((((P) >= 10 && (P) <= 13) || ((P) >= 50 && (P) <= 53)) ? &DDRB : \ +(((P) >= 30 && (P) <= 37) ? &DDRC : \ +((((P) >= 18 && (P) <= 21) || (P) == 38) ? &DDRD : \ +((((P) >= 0 && (P) <= 3) || (P) == 5) ? &DDRE : \ +(((P) >= 54 && (P) <= 61) ? &DDRF : \ +((((P) >= 39 && (P) <= 41) || (P) == 4) ? &DDRG : \ +((((P) >= 6 && (P) <= 9) || (P) == 16 || (P) == 17) ? &DDRH : \ +(((P) == 14 || (P) == 15) ? &DDRJ : \ +(((P) >= 62 && (P) <= 69) ? &DDRK : &DDRL)))))))))) + +#define __digitalPinToPINReg(P) \ +(((P) >= 22 && (P) <= 29) ? &PINA : \ +((((P) >= 10 && (P) <= 13) || ((P) >= 50 && (P) <= 53)) ? &PINB : \ +(((P) >= 30 && (P) <= 37) ? &PINC : \ +((((P) >= 18 && (P) <= 21) || (P) == 38) ? &PIND : \ +((((P) >= 0 && (P) <= 3) || (P) == 5) ? &PINE : \ +(((P) >= 54 && (P) <= 61) ? &PINF : \ +((((P) >= 39 && (P) <= 41) || (P) == 4) ? &PING : \ +((((P) >= 6 && (P) <= 9) || (P) == 16 || (P) == 17) ? &PINH : \ +(((P) == 14 || (P) == 15) ? &PINJ : \ +(((P) >= 62 && (P) <= 69) ? &PINK : &PINL)))))))))) + +#define __digitalPinToBit(P) \ +(((P) >= 7 && (P) <= 9) ? (P) - 3 : \ +(((P) >= 10 && (P) <= 13) ? (P) - 6 : \ +(((P) >= 22 && (P) <= 29) ? (P) - 22 : \ +(((P) >= 30 && (P) <= 37) ? 37 - (P) : \ +(((P) >= 39 && (P) <= 41) ? 41 - (P) : \ +(((P) >= 42 && (P) <= 49) ? 49 - (P) : \ +(((P) >= 50 && (P) <= 53) ? 53 - (P) : \ +(((P) >= 54 && (P) <= 61) ? (P) - 54 : \ +(((P) >= 62 && (P) <= 69) ? (P) - 62 : \ +(((P) == 0 || (P) == 15 || (P) == 17 || (P) == 21) ? 0 : \ +(((P) == 1 || (P) == 14 || (P) == 16 || (P) == 20) ? 1 : \ +(((P) == 19) ? 2 : \ +(((P) == 5 || (P) == 6 || (P) == 18) ? 3 : \ +(((P) == 2) ? 4 : \ +(((P) == 3 || (P) == 4) ? 5 : 7))))))))))))))) + + +// --- Arduino 644 --- +#elif (defined(__AVR_ATmega644__) || \ +defined(__AVR_ATmega644P__)) + +#define __digitalPinToPortReg(P) \ +(((P) >= 0 && (P) <= 7) ? &PORTB : (((P) >= 8 && (P) <= 15) ? &PORTD : (((P) >= 16 && (P) <= 23) ? &PORTC : &PORTA))) +#define __digitalPinToDDRReg(P) \ +(((P) >= 0 && (P) <= 7) ? &DDRB : (((P) >= 8 && (P) <= 15) ? &DDRD : (((P) >= 8 && (P) <= 15) ? &DDRC : &DDRA))) +#define __digitalPinToPINReg(P) \ +(((P) >= 0 && (P) <= 7) ? &PINB : (((P) >= 8 && (P) <= 15) ? &PIND : (((P) >= 8 && (P) <= 15) ? &PINC : &PINA))) +#define __digitalPinToBit(P) \ +(((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 15) ? (P) - 8 : (((P) >= 16 && (P) <= 23) ? (P) - 16 : (P) - 24))) + +#elif defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY) +#define __digitalPinToPortReg(P) \ +(((P) == 22 || (P) == 23 || (P) == 5 || (P) == 6 || (P) == 7 || (P) == 8 || (P) == 11 || (P) == 12) ? &PORTD : (((P) == 9 || (P) == 10) ? &PORTC : (((P) >= 17 && (P) <= 21)) ? &PORTF : (((P) == 24) ? &PORTE : &PORTB))) +#define __digitalPinToDDRReg(P) \ +(((P) == 22 || (P) == 23 || (P) == 5 || (P) == 6 || (P) == 7 || (P) == 8 || (P) == 11 || (P) == 12) ? &DDRD : (((P) == 9 || (P) == 10) ? &DDRC : (((P) >= 17 && (P) <= 21)) ? &DDRF : (((P) == 24) ? &DDRE : &DDRB))) +#define __digitalPinToPINReg(P) \ +(((P) == 22 || (P) == 23 || (P) == 5 || (P) == 6 || (P) == 7 || (P) == 8 || (P) == 11 || (P) == 12) ? &PIND : (((P) == 9 || (P) == 10) ? &PINC : (((P) >= 17 && (P) <= 21)) ? &PINF : (((P) == 24) ? &PINE : &PINB))) +#define __digitalPinToBit(P) \ +(((P) >= 0 && (P) <= 3) ? (P) : (((P) >= 5 && (P) < 9) ? (P) - 5 : (((P) == 4) ? 7 : (((P) == 9) ? 6 : (((P) == 10) ? 7 : \ +(((P) == 11) ? 6 : (((P) == 12) ? 7 : (((P) == 13) ? 4 : (((P) == 14) ? 5 : (((P) == 15) ? 6 : (((P) == 16) ? 7 :\ +(((P) == 17) ? 6 : (((P) == 18) ? 5 : (((P) == 19) ? 4 : (((P) == 20) ? 1 : (((P) == 21) ? 0 : (((P) == 22) ? 4 : (((P) == 23) ? 5 :\ +(((P) == 24) ? 6 : 6 ))))))))))))))))))) + +// --- Arduino Leonardo --- +#elif (defined(ARDUINO_AVR_LEONARDO) || \ +defined(__AVR_ATmega16U4__) || \ +defined(__AVR_ATmega32U4__)) + + +#define __digitalPinToPortReg(P) \ +((((P) >= 0 && (P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &PORTD : (((P) == 5 || (P) == 13) ? &PORTC : (((P) >= 18 && (P) <= 23)) ? &PORTF : (((P) == 7) ? &PORTE : &PORTB))) +#define __digitalPinToDDRReg(P) \ +((((P) >= 0 && (P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &DDRD : (((P) == 5 || (P) == 13) ? &DDRC : (((P) >= 18 && (P) <= 23)) ? &DDRF : (((P) == 7) ? &DDRE : &DDRB))) +#define __digitalPinToPINReg(P) \ +((((P) >= 0 && (P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &PIND : (((P) == 5 || (P) == 13) ? &PINC : (((P) >= 18 && (P) <= 23)) ? &PINF : (((P) == 7) ? &PINE : &PINB))) +#define __digitalPinToBit(P) \ +(((P) >= 8 && (P) <= 11) ? (P) - 4 : (((P) >= 18 && (P) <= 21) ? 25 - (P) : (((P) == 0) ? 2 : (((P) == 1) ? 3 : (((P) == 2) ? 1 : (((P) == 3) ? 0 : (((P) == 4) ? 4 : (((P) == 6) ? 7 : (((P) == 13) ? 7 : (((P) == 14) ? 3 : (((P) == 15) ? 1 : (((P) == 16) ? 2 : (((P) == 17) ? 0 : (((P) == 22) ? 1 : (((P) == 23) ? 0 : (((P) == 24) ? 4 : (((P) == 25) ? 7 : (((P) == 26) ? 4 : (((P) == 27) ? 5 : 6 ))))))))))))))))))) + + +// --- Arduino Uno --- +#elif (defined(ARDUINO_AVR_UNO) || \ +defined(ARDUINO_AVR_DUEMILANOVE) || \ +defined(__AVR_ATmega328__) || \ +defined(__AVR_ATmega328P__) || \ +defined(__AVR_ATmega328PB__)) + + + +#if defined(__AVR_ATmega328PB__) +#define __digitalPinToPortReg(P) \ +(((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : (((P) >= 14 && (P) <= 19) ? &PORTC : &PORTE))) +#define __digitalPinToDDRReg(P) \ +(((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : (((P) >= 14 && (P) <= 19) ? &DDRC : &DDRE))) +#define __digitalPinToPINReg(P) \ +(((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : (((P) >= 14 && (P) <= 19) ? &PINC : &PINE))) +#define __digitalPinToBit(P) \ +(((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 13) ? (P) - 8 : (((P) >= 14 && (P) <= 19) ? (P) - 14 : (((P) >= 20 && (P) <= 21) ? (P) - 18 : (P) - 22)))) +#else +#define __digitalPinToPortReg(P) \ +(((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) +#define __digitalPinToDDRReg(P) \ +(((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) +#define __digitalPinToPINReg(P) \ +(((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC)) +#define __digitalPinToBit(P) \ +(((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 13) ? (P) - 8 : (P) - 14)) +#endif + + +#endif + +#if defined(AVR) +static byte ft_o,ft_p,ft_q,ft_r,ft_s,ft_t,ft_u,ft_v,ft_w,ft_x, ft_y, ft_z; +#define fastTouchRead(pin) \ +( digitalWrite(pin, LOW), \ +pinMode(pin, OUTPUT), \ +delay(1), \ +pinMode(pin, INPUT), \ +/* disable interrupts */ \ +BIT_SET(*__digitalPinToPortReg(pin), __digitalPinToBit(pin)), \ +ft_o = *__digitalPinToPINReg(pin), \ +ft_p = *__digitalPinToPINReg(pin), \ +ft_q = *__digitalPinToPINReg(pin), \ +ft_r = *__digitalPinToPINReg(pin), \ +ft_s = *__digitalPinToPINReg(pin), \ +ft_t = *__digitalPinToPINReg(pin), \ +ft_u = *__digitalPinToPINReg(pin), \ +ft_v = *__digitalPinToPINReg(pin), \ +ft_w = *__digitalPinToPINReg(pin), \ +ft_x = *__digitalPinToPINReg(pin), \ +ft_y = *__digitalPinToPINReg(pin), \ +ft_z = *__digitalPinToPINReg(pin), \ +/* enable interrupts */ \ +!(ft_p & (1<< __digitalPinToBit(pin))) + !(ft_q & (1<< __digitalPinToBit(pin))) + \ +!(ft_r & (1<< __digitalPinToBit(pin))) + !(ft_s & (1<< __digitalPinToBit(pin))) + \ +!(ft_t & (1<< __digitalPinToBit(pin)))+ !(ft_u & (1<< __digitalPinToBit(pin)))+ \ +!(ft_v & (1<< __digitalPinToBit(pin)))+ !(ft_w & (1<< __digitalPinToBit(pin)))+ \ +!(ft_x & (1<< __digitalPinToBit(pin)))+ !(ft_y & (1<< __digitalPinToBit(pin)))+ \ +!(ft_z & (1<< __digitalPinToBit(pin))) ) +#elif defined(_SAMD21_) + +static volatile uint32_t ft_o,ft_p,ft_q,ft_r,ft_s,ft_t,ft_u,ft_v,ft_w,ft_x, ft_y, ft_z; +static volatile uint32_t ft_xo,ft_xp,ft_xq,ft_xr,ft_xs,ft_xt,ft_xu,ft_xv,ft_xw,ft_xx, ft_xy, ft_xz; +#define fastTouchRead(pin) \ +( pinMode(pin, OUTPUT), \ +digitalWrite(pin, LOW), \ +delay(1), \ +pinMode(pin, INPUT_PULLUP), \ +/* disable interrupts */ \ +ft_p = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_q = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_r = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_s = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_t = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_u = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_v = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_w = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_x = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_y = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_z = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xo = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xp = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xq = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xr = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xs = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xt = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xu = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xv = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xw = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xx = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xy = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +ft_xz = PORT->Group[g_APinDescription[pin].ulPort].IN.reg, \ +/* enable interrupts */ \ +!(ft_p & (1ul << g_APinDescription[pin].ulPin)) + !(ft_q & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_r & (1ul << g_APinDescription[pin].ulPin)) + !(ft_s & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_t & (1ul << g_APinDescription[pin].ulPin)) + !(ft_u & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_v & (1ul << g_APinDescription[pin].ulPin)) + !(ft_w & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_x & (1ul << g_APinDescription[pin].ulPin)) + !(ft_y & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_z & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_xo & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_xp & (1ul << g_APinDescription[pin].ulPin)) + !(ft_xq & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_xr & (1ul << g_APinDescription[pin].ulPin)) + !(ft_xs & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_xt & (1ul << g_APinDescription[pin].ulPin)) + !(ft_xu & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_xv & (1ul << g_APinDescription[pin].ulPin)) + !(ft_xw & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_xx & (1ul << g_APinDescription[pin].ulPin)) + !(ft_xy & (1ul << g_APinDescription[pin].ulPin)) + \ +!(ft_xz & (1ul << g_APinDescription[pin].ulPin)) \ +) + +#else +int fastTouchRead( int ); +extern int fastTouchMax(void); +#endif +#endif /* FastTouch_h */ diff --git a/sketch_42line/sketch_42line.ino b/sketch_42line/sketch_42line.ino new file mode 100644 index 0000000..3a73ff2 --- /dev/null +++ b/sketch_42line/sketch_42line.ino @@ -0,0 +1,377 @@ +#include +#include +#include +#include + +/*----------------------- + * TOUCH + ------------------------*/ + +static const int PIN_A = 1; // white +static const int PIN_B = 3; // red +static const int PIN_C = 5; // black +static const int PIN_D = 16; // green +static const int PIN_E = 17; // yellow +static const int PIN_F = 22; // blue -> orange -> yellow + +static int cutoff = 20; + +SENSOR_t s_A(PIN_A, cutoff); +SENSOR_t s_B(PIN_B, cutoff); +SENSOR_t s_C(PIN_C, cutoff); +SENSOR_t s_D(PIN_D, cutoff); +SENSOR_t s_E(PIN_E, cutoff); +SENSOR_t s_F(PIN_F, cutoff); + +static int READ_DELAY = 150; + +///forward declare + +void synth_toggle(bool p, int pin); + +/*----------------------- + * WORDS + ------------------------*/ + +static E_WORDS voice_A_words[] = {E1, E2, L0, L1, L2}; +static E_WORDS voice_B_words[] = {E3, L3}; +static E_WORDS voice_C_words[] = {E4, E5, E6, L4, L5, L6}; +static E_WORDS voice_D_words[] = {E7, E8, E9, L7, L8, L9, L10}; +static E_WORDS voice_E_words[] = {E10, E11, E12, E13, L11, L12}; + +static int MAX_WORD = 4; + +/*----------------------- + * AUDIO + ------------------------*/ +// Use these with the Teensy 4 Audio Shield +#define SDCARD_CS_PIN 10 +#define SDCARD_MOSI_PIN 11 +#define SDCARD_SCK_PIN 13 +#define SDCARD_SCK_PIN 13 + + +AudioOutputI2S audioOutput; +AudioControlSGTL5000 sgtl5000_1; + +// WAV + +AudioPlaySdWav wav_A; +AudioPlaySdWav wav_B; +AudioPlaySdWav wav_C; +AudioPlaySdWav wav_D; +AudioPlaySdWav wav_E; +AudioPlaySdWav wav_F; + +WAVPLAY_t wavplay_A(PIN_A, &wav_A, EA, LA, voice_A_words, 5, synth_toggle); +WAVPLAY_t wavplay_B(PIN_B, &wav_B, EB, LB, voice_B_words, 2, synth_toggle); +WAVPLAY_t wavplay_C(PIN_C, &wav_C, EC, LC, voice_C_words, 6, synth_toggle); +WAVPLAY_t wavplay_D(PIN_D, &wav_D, ED, LD, voice_D_words, 7, synth_toggle); +WAVPLAY_t wavplay_E(PIN_E, &wav_E, EE, LE, voice_E_words, 6, synth_toggle); + +AudioMixer4 wav_mixer1; +AudioMixer4 wav_mixer2; + +AudioConnection patchCordA1(wav_A, 0, wav_mixer1, 0); +AudioConnection patchCordA2(wav_A, 1, wav_mixer2, 0); +AudioConnection patchCordB1(wav_B, 0, wav_mixer1, 1); +AudioConnection patchCordB2(wav_B, 1, wav_mixer2, 1); +AudioConnection patchCordC1(wav_C, 0, wav_mixer1, 2); +AudioConnection patchCordC2(wav_C, 1, wav_mixer2, 2); +AudioConnection patchCordD1(wav_D, 0, wav_mixer1, 3); +AudioConnection patchCordD2(wav_D, 1, wav_mixer2, 3); + +// SYNTH + +float freq = 300; +DETUNE_t synth(freq); + +AudioMixer4 synth_mixer; + +AudioConnection patchCord1(synth.sine3, 0, synth_mixer, 2); +AudioConnection patchCord2(synth.sine2, 0, synth_mixer, 1); +AudioConnection patchCord3(synth.sine1, 0, synth_mixer, 0); + +// MIX + +AudioMixer4 main_mixer_L; +AudioMixer4 main_mixer_R; + +AudioConnection patchCord12(synth_mixer, 0, main_mixer_L, 1); +AudioConnection patchCord13(synth_mixer, 0, main_mixer_R, 1); +AudioConnection patchCord14(wav_mixer1, 0, main_mixer_L, 0); +AudioConnection patchCord15(wav_mixer2, 0, main_mixer_R, 0); + +//!!!!-----!!! + +AudioConnection patchCordE1(wav_E, 0, main_mixer_L, 2); +AudioConnection patchCordE2(wav_E, 1, main_mixer_R, 2); +AudioConnection patchCordF1(wav_F, 0, main_mixer_L, 3); +AudioConnection patchCordF2(wav_F, 1, main_mixer_R, 3); + +//!!!!-----!!! + +AudioConnection patchCord16(main_mixer_R, 0, audioOutput, 1); +AudioConnection patchCord17(main_mixer_L, 0, audioOutput, 0); + +/*----------------------- + * STATES + ------------------------*/ + +SENSOR_t* synth_sensor = NULL; +int synth_PIN = -1; +bool gain_up = false; + +float synth_gain_v = 0; +float synth_gain_max = 0.7; +float synth_gain_interval_ms = 1500; +float synth_gain_increments_ms = 0.01; +long synth_last_increment = 0; + +bool sensor_touch[6] = {false, false, false, false, false, false}; + +void synth_toggle(bool p, int pin) { + if(synth_PIN == pin && !p) { + gain_up = false; + synth_gain(0); + synth_sensor = NULL; + synth_PIN = -1; + } else if(p && synth_PIN < 0) { + synth_PIN = pin; + if(pin == PIN_A) synth_sensor = &s_A; + else if(pin == PIN_B) synth_sensor = &s_B; + else if(pin == PIN_C) synth_sensor = &s_C; + else if(pin == PIN_D) synth_sensor = &s_D; + else if(pin == PIN_E) synth_sensor = &s_E; + else if(pin == PIN_F) synth_sensor = &s_F; + gain_up = true; + synth_gain(0.5); + } +} + +void random_wav(AudioPlaySdWav* wav, E_WORDS* e_words) { + int w = (int)random(0, MAX_WORD); + wav->play(words[e_words[w]]); +} + +/*----------------------- + * CALLBACK + ------------------------*/ + +void toggle_signal_cb(bool p, int pin) { + + SENSOR_t* sensor = NULL; + + switch(pin) { + case PIN_A: + if(p) wavplay_A.play(); + else wavplay_A.stop(); + sensor = &s_A; + sensor_touch[0] = p; + break; + case PIN_B: + if(p) wavplay_B.play(); + else wavplay_B.stop(); + sensor = &s_B; + sensor_touch[1] = p; + break; + case PIN_C: + if(p) wavplay_C.play(); + else wavplay_C.stop(); + sensor = &s_C; + sensor_touch[2] = p; + break; + case PIN_D: + if(p) wavplay_D.play(); + else wavplay_D.stop(); + sensor = &s_D; + sensor_touch[3] = p; + break; + case PIN_E: + if(p) wavplay_E.play(); + else wavplay_E.stop(); + sensor = &s_E; + sensor_touch[4] = p; + break; + case PIN_F: + if(p) wavplay_B.play(); + else wavplay_B.stop(); + sensor = &s_F; + sensor_touch[5] = p; + break; + } + + // state_synth(p, pin, sensor); + +} + +/*----------------------- + * SETUPS + ------------------------*/ + + +void setup() { + Serial.begin(57600); + + setup_audio(); + + setup_sensors(); + + synth_gain(0); + wav_gain(0.75); +} + +void setup_sensors() { + // baselines + s_A.baseline(50, 50); + s_B.baseline(50, 50); + s_C.baseline(50, 50); + s_D.baseline(50, 50); + s_E.baseline(50, 50); + s_F.baseline(50, 50); + + // callbacks + s_A.plug_toggle_cb(toggle_signal_cb); + s_B.plug_toggle_cb(toggle_signal_cb); + s_C.plug_toggle_cb(toggle_signal_cb); + s_D.plug_toggle_cb(toggle_signal_cb); + s_E.plug_toggle_cb(toggle_signal_cb); + s_F.plug_toggle_cb(toggle_signal_cb); +} + +void setup_audio() { + AudioMemory(8); + sgtl5000_1.enable(); + sgtl5000_1.volume(0.5); + SPI.setMOSI(SDCARD_MOSI_PIN); + SPI.setSCK(SDCARD_SCK_PIN); + if (!(SD.begin(SDCARD_CS_PIN))) { + while (1) { + Serial.println("Unable to access the SD card"); + delay(1000); + } + } +} + +/*----------------------- + * LOOP + ------------------------*/ + +void loop() { + + s_A.update(); + s_B.update(); + s_C.update(); + s_D.update(); + s_E.update(); + s_F.update(); + +// float synth_gain_max = 0.5; +// float synth_gain_interval_ms = 1500; +// float synth_gain_increments_ms = synth_gain_max / 1500; +// long synth_last_increment = -1; + + if(synth_PIN > 0) { + int d = synth_sensor->map_range_raw(0, freq); + synth.set_detune(d); + + // if(gain_up && synth_gain_v < synth_gain_max) { + // synth_gain_v += synth_gain_increments_ms; + // if(synth_gain_v > synth_gain_max) + // synth_gain_v = synth_gain_max; + // synth_gain(synth_gain_v); + + // } else if(!gain_up && synth_gain_v > 0) { + // synth_gain_v -= synth_gain_increments_ms; + // if(synth_gain_v < 0) { + // synth_gain_v = 0; + // synth_sensor = NULL; + // synth_PIN = -1; + // } + // synth_gain(synth_gain_v); + // } + } + + if(sensor_touch[0]) wavplay_A.update(); + if(sensor_touch[1]) wavplay_B.update(); + if(sensor_touch[2]) wavplay_C.update(); + if(sensor_touch[3]) wavplay_D.update(); + if(sensor_touch[4]) wavplay_E.update(); + if(sensor_touch[5]) wavplay_B.update(); + + serial_plot_range(0, 100); + // serial_plot(); +// serial_plot_base(); +// serial_plot_range(0, 100); + + delay(READ_DELAY); + +} + +/*----------------------- + * GAIN FUNCS + ------------------------*/ + +void synth_gain(float g){ + synth_mixer.gain(0, g); + synth_mixer.gain(1, g); + synth_mixer.gain(2, g); +} + +void wav_gain(float g){ + wav_mixer1.gain(0, g); + wav_mixer1.gain(1, g); + wav_mixer1.gain(2, g); + wav_mixer1.gain(3, g); + + wav_mixer2.gain(0, g); + wav_mixer2.gain(1, g); + wav_mixer2.gain(2, g); + wav_mixer2.gain(3, g); + + // shoudl add wav_e + f but whatever +} + +/*----------------------- + * PLOT FUNCS + ------------------------*/ + +void serial_plot_range(int min_v, int max_v) { + Serial.print(s_A.map_range(min_v, max_v)); Serial.print(" "); + Serial.print(s_B.map_range(min_v, max_v)); Serial.print(" "); + Serial.print(s_C.map_range(min_v, max_v)); Serial.print(" "); + Serial.print(s_D.map_range(min_v, max_v)); Serial.print(" "); + Serial.print(s_E.map_range(min_v, max_v)); Serial.print(" "); + Serial.print(s_F.map_range(min_v, max_v)); Serial.print(" "); + Serial.println(""); +} + +void serial_plot_base(){ + Serial.print(s_A.base); Serial.print(" "); + Serial.print(s_B.base); Serial.print(" "); + Serial.print(s_C.base); Serial.print(" "); + Serial.print(s_D.base); Serial.print(" "); + Serial.print(s_E.base); Serial.print(" "); + Serial.print(s_F.base); Serial.print(" "); + Serial.println(""); +} + +void serial_plot() { + Serial.print(s_A.v); Serial.print(" "); + Serial.print(s_B.v); Serial.print(" "); + Serial.print(s_C.v); Serial.print(" "); + Serial.print(s_D.v); Serial.print(" "); + Serial.print(s_E.v); Serial.print(" "); + Serial.print(s_F.v); Serial.print(" "); + Serial.println(""); +} + +void serial_plot_dv() { + Serial.print(s_A.dv); Serial.print(" "); + Serial.print(s_B.dv); Serial.print(" "); + Serial.print(s_C.dv); Serial.print(" "); + Serial.print(s_D.dv); Serial.print(" "); + Serial.print(s_E.dv); Serial.print(" "); + Serial.print(s_F.dv); Serial.print(" "); + Serial.println(""); +}