Sotoday I'd liketotellyouthestoryofourjourneythroughthelowsandhighsofWebaudioonrequested a cipherBrainwavesinthebrowser.
Sothisisstoryoff.
DiscoveryisaboutfindingoutwhattheWebcanoffer.
It's a storyofexplorationaboutpushingtheboundariesofWebtechnologies.
Thiobenefittomake a difference, andlast, it's Well, it's a storyhas a reallycooldemoattheend.
So, uh, staytuned.
Butbefore I cantellyouthatstory, I havetotellyouthisone.
Somyname's Bradymore.
I'm a fullstackdeveloperatanAustralianmedicaltechnologystartupcalledCIAsoCIAprovidedestroyers, largestepilepsymanagementanddiagnosticservice.
Infact, thetaglineofourcorporatewebsiteisiflipstickdiagnosismadeeasynow, I didn't knowanythingaboutepilepsybefore I startedworkingatCIAonand I guessthat's kindoftruefor a lotofpeople.
Soletmegiveyousomeofthefacts.
Soepilepsyis a chronicconditionthateffectsoversixmillionpeopleworldwide.
Justlikethesetohelpprovide a diagnosisAttheservicethatweofferedtosee, lookslikethispatientcomestoclinicsweretogetconnectedwithhiselectrodestomonitortheirbrainwavesoverthenextsevendays.
Butiftheseareveryrareeventshappeningonce a monthorevenonce a year, it's notguaranteethatwillcapturethatduringthesevendaysgettingwanteditsomoreoftenthey'relookingforsomething a bitsmaller.
They'relookingforsomethinglike a needleinthehaystack.
Well, inepilepsy, there's somethingcalledthecharacteristicsignalofepilepsy, whichiscalled a spikeway.
Sowhat?
Theselittlespikesandlittlewaves, um, thataroundhalf a secondlongeachandso, while a patientmightonlyhave a seizureonce a month, theymighthavedozensoftheselittlespikewaveseveryday.
Andsoit's theseneedlein a haystacksaidthatscientistslookingforInfact, you'relookingat a wholekindofrun.
A littlespikewavesrightthere.
Okay, that's great.
Butwhatdoes a Webdeveloper I havetodowithit?
I mentionedbeforethatourclinicalteamgetsthisdaughterandthentheystartreviewingit.
Butit's notthefullstory.
Likeeverysecondcompanythesedays, wehaveourowncloudplatform, andit's a platformforsecuremanagementstoriesandreviewoffmedicaldata.
Sooneofthepowerfulthingsaboutthisplatformisthatallows a clinicalteamtouploadthis E e g brainwavedataandthenreviewitanywhereatanytimeorthrough a browser.
Andsoit's thisdotofyouthatareclinicalteamusestoreviewthesesevendaysworthofdataandtolabeleventsandtoeventuallydeliver a diagnosis.
OneofthebigchallengesingettingUSscientiststomovefromtraditionaloneofthebigchallengesthatwefacesincePlatformisgetting a neurophysiologist, astheycalledtomovefromtraditionaldesktopbasedsoftwareinto a cloudplatform.
Now, uh, theyoftenneurophysiologistoftenflickthroughEdie, not a veryquickly.
They'regoingfourpages a second.
Soflick, flickflickthatislookingveryquicklythroughthisbecauseifyouwanttogetthroughlotsofdata, youdon't besending a lotoftimeoneachpage.
Don't havetowrite, uh, butremember a coupleofslidesbackwithfilteringwithoutfiltering.
That's that's kindofnightanddayrightthere.
Sothat's a bitof a nogo.
I mean, I would'vebeenhappywithit, butsocouldwewriteourownfilthyinfluencestation?
Well, it's kindof a maybe, andbecauseofstufflikethisandandthisandallthisstuff.
So I trainedas a particlephysicist, notanelectricalengineer, so I don't knowtoomuchredfiltering, but I'vebeentoldthatthere's a bitofsubtletiesinvolvedinimplementing a filterondhe.
Well, when I wasfirsthavingtouseWebaudio, theMozilladevelopingEricorIndiandockswereinvaluableandactuallyjustlearnedatthisconferencethatmanyofthesedocksarewrittenbyliveGSisveryown.
Ruth.
Sobigshot.
That's theroofforhelpingyoulearnthis.
Butletmetakeyouthroughsomeofthebasicconcepthere.
SohowdoyouusetheWebortwolater?
I hadactuallyuseittoprocessthisdata, orfirstyoucreateanaudiocontext.
ThisiskindofthecanvaswhereeverythinghappensInsidethisaudiocontext, youcreate a bunchofnodes, oneofwhichbeingyourinputnote.
Sothismightbein a Sillascope, orthismightbelikeyou'refeedingmicrophoneintothere.
Next, youcanmake a bunchof a fixednodessoyoucoulddothingslike a riverorcompressionpanningandmanymore.
Allthingsthatyouknowgreatlywithaudio.
Maybedon't putreverbonthe e e g Justjustmayyoucouldalso.
Next, wehavetosetupoursourcenotesprettystraightforward, create a buffersourceandnotethatthesemethodsareallcomingofftheaudiocontextsoyoucanactuallycreatenodesintheWebaudiowithoutactuallybeingattachedtoitscontext.
Nextup, weneedtocreateinPhyllisAudioBuffa.
Sofirstup, we'regoingtocreate a buffer, hasgotthenumberofchannelssampleseparated.
Wewantgotoloopoverourchannelsandthenforeachchannel, I'm goingtokindofgetthechannelbuffathat I justcreated.
There's about 200 linesofcodetherethatuseslikecomplexnumbersandpolesandtransformsandactuallyimporteditfromMattLabCoat, oneofourcolleagueswroteintoJavaScript.
Butnowthisisfullofdatainsteadofemptiesbeforeandforsomereason, thischannelbuffa, isreturnsattackedarrayratherthan a regulararray.
Now, thewaytoconvertfrom a typetorayto a regularRayisgotostack, overflowandtypeout a waytoconvertfromattackto a to a regularrayandcopypastethecodetheytellyourightthere.
Youmightnotseeitwhenyou'reflickingthroughfourpages a second, finally, kindofthebigthebigoneisthetimetakentogeneratethesefilterssoclearlythebikewouldfilteris a bigwinnerhere, taking 10 millisecondsversusthe 100 millisecondsfortheway I feeltonight.