ThoseintrothemesthatyouheardmeplaytherewerebacktothefutureondheGodfatherontheywerereplicatedusingmyPCkeyboardisitisaninputon a squarewaveforanoutput.
No, thatmightnotmeananythingtoyourightnow, butBytheendofthisvideo, you'llhave a goodunderstanding.
I shouldsaynowthatthisvideoisisreallyaimedatthebeginner, perhapsbothinsoundsynthesisandforprogramming, although I willthrowinsomeprogrammingtrickstomakesurewegotthemoreadvancedprogrammerstokeepthemontheirtoes.
Let's startwiththeverybasics.
Hereis a sinewave.
Youcanthinkof a sinewaveasbeingairmovingbackwardsandforwardstogeneratesound.
Now, thebasicformulafor a sinewaveisamplitudetime.
SignoffthefrequencyTimestime, thesameway I gotonthescreenhereisnotcenteredaroundzero.
It's actuallyoffset 0.5 because I'm goingtouseThisis a visualizationtoolanditwillmakethings a littlebitclearer.
Resulttounderstandonfrequencyishowmanytimeswesee a peakwithin a giventimeinterval.
Soif I increasethewecouldseeherewecouldseewegetmorepeaks.
Let's takethistimeperiodhere 0 to 5.
As I increasethefrequencyweSeymourpeaksandas I decreaseit, weseefewerand I canchangetheamplitude.
Sorememberamplitudewasloudness.
We'regoingfrom 0 to 1.
I wouldjustliketotakethismomenttopointouthowexcellentthisTulisthisisDesmond, stopcalm, whichis a freegraphingandmathematicaltoolforeducationalpurposes.
That's because I'vealreadywrittensomecode, whichinterfaceswiththesoundhardworkandthat's availabletodownloadbeloworfromtheoneloancodeddotcomwebsitetokeepitsimple.
I'm goingtocreate a Win 30 toconsoleapplication, andwe'llcallitsoundssynthesizer.
I wantedtobeanemptyprojectthatgenerateslotsofstuff I'm notgoingtouse, andwe'llkeepitas a consulproject.
Sowe'renotgoingtobotherwithWindows.
GuYs o r controlsEverythingwillbehandledjust a thecommandprompt, andthisis a nicewayandtomakeiteasyforpeopletolearn, I likeconsulprogramsbecausethey'relimitedintheiraccessandtheirabilitiestodisplayinformation.
Thisfocusesyoutothinkreallyaboutwhatyou'redoing, creatinganemptyprojectthatwillcreate a sourcefile c++, and I'm goingtocallthatonemadeallofthecode I'm goingtoincludefordownloadandinthisvideoiswrittentobeaccessible.
Now I willgointowhatthisfunctionisdoingjustyet, butit's a nicewayofvisualizingwhathappensasweasweapplymorebitstorepresentthenumbersthatrepresentthesinewave.
So a CZweincreasethenumberofbitswecanseethattheapproximationtothesinewavebecomesmoreandmoreaccurate.
Sowiththissignwaveonebits, youreallyonlyget a choiceoftopbottom, topbottom, topbottombecauseyou'vegotonebit.
Whenweexplorehowthenoisemakerutilityworks, thiswillbecomeveryapparent, butultimatelythatwe'retryingtoreducethedelaybetweenhitting a keyonthekeyboardonhearingsound.
Nowwhen I pressedthe a key, wecanseeit's a bithigher.
Andindeed, if I moveupthefull 12 semitonesofinactive, it's anoctavehigherthantheoriginalnote.
Butweplayedbefore.
Let's takeourbasiconoffswitchhereandturnitinto a pianolikekeyboard, right?
I'm goingtoleavethislittlebitofmagicherefor a bitof a mentalexerciseforyou, butit's notthatdifficulttoworkoutwhat's goingon.
I haveeffectivelymappedthekeyboardskeyboardkeystothepianokeysinthewaythatzedherewouldbe a s wouldbe a sharp X wouldbe B c wouldbe C F wouldbe C sharp V wouldbe a d g wouldbe d sharp.
Bewouldbe e n wouldbe f j wouldbe J shop.
J.
J wouldbe J Chefforanyway, what I'm tryingtogettoisitItactuallymodelsoutthewhiteandblackkeyson a pianoon.
We'vegotouramplitudeontimeonifwechoose a differentcolorfor a sinewaveAsoursinewavestartsandbusiness, itbecomes a signawayfor a littlebit, andthenweswitchitoff.
Well, insteadofcarryingon, being a nicesinewavewe'veactuallygotis a verticalstop.
Well, ifwerememberthestartofthevideo, themoveupanddownmovementofthesinewaveisreflectedbythein N outmovementoffthespeakercoat.
Sowemightunfortunatelystart r sinewavedownhereandcarryononthesamesituationapplieswhereisweshouldhavehad a nicesinewaveradiantsothespeakercanaccommodatethatandproducethefrequency.
Whatweactuallygetis a veryharshcrackingapart, andthisisactually a veryhighfrequency.