{"id":1977,"date":"2010-09-27T15:22:57","date_gmt":"2010-09-27T22:22:57","guid":{"rendered":"http:\/\/tahnee.org\/wordpress\/?p=1977"},"modified":"2010-09-27T15:26:11","modified_gmt":"2010-09-27T22:26:11","slug":"car-alarm-in","status":"publish","type":"post","link":"http:\/\/tahnee.org\/wordpress\/2010\/09\/27\/car-alarm-in\/","title":{"rendered":"Car Alarm in =>"},"content":{"rendered":"<p>So I&#8217;m taking this Beginning Object-Oriented Programming class this semester with the hopes of getting into the beginning robot-music-making-cool-awesome class next Fall. Music tech school? Yes please! Here&#8217;s the ChucK code for anyone who happens to need a car alarm. (And yes, I&#8217;m still drawing, just not uploading much&#8230;. yet!) \ud83d\ude00<br \/>\nI&#8217;d totally attach an audio file if I knew how. Right now we&#8217;re working directly in miniAudicle, so if you download that then you can hear the car alarm in all its glory \ud83d\ude1b<\/p>\n<p>\/\/===========================================\/\/<br \/>\n\/\/ Author: Tahnee Gehm                       \/\/<br \/>\n\/\/ Assignment: 1 &#8220;Hello, ChucK. Make sound!&#8221; \/\/<br \/>\n\/\/ Date: September 17, 2010                  \/\/<br \/>\n\/\/===========================================\/\/<\/p>\n<p>&lt;&lt;&lt;&#8220;Tahnee Gehm &#8211; Assignment 1&#8221;&gt;&gt;&gt;;<\/p>\n<p>\/\/START 1<br \/>\nTriOsc a =&gt; dac;<br \/>\n.1 =&gt; a.gain;<br \/>\nint freqa;<br \/>\n1300 =&gt; freqa; \/\/Starting frequency here<br \/>\nint checka;<br \/>\n0 =&gt; checka; \/\/making sub-counter exist<br \/>\nfor (0 =&gt; int asound; asound &lt; 1; 0 == asound) {          freqa =&gt; a.freq;<br \/>\nfreqa &#8211;; \/\/lowering sound<br \/>\n.0007::second =&gt; now; \/\/in these increments<\/p>\n<p>if(freqa &lt;500)     {         1300 =&gt; freqa; \/\/if below 500, reset high<br \/>\nchecka ++; \/\/add 1 to sub-counter in loop<br \/>\n\/\/&lt;&lt;&gt;&gt;;<br \/>\nif (checka &gt; 7)<br \/>\n{<br \/>\n0 =&gt; a.gain;<br \/>\n1 =&gt; asound; \/\/sub counter affects main counter, ends loop<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n\/\/END 1<\/p>\n<p>\/\/START 2<\/p>\n<p>SinOsc b =&gt; dac;<br \/>\n0 =&gt; int bcounter;<br \/>\nwhile (bcounter &lt; 16) \/\/Loops all the for statements 16 times {     float gainb;     .2 =&gt; gainb; \/\/shhhhhh, don&#8217;t blow out your eardrums<br \/>\ngainb =&gt; b.gain;<br \/>\nint freqb;<br \/>\n1500 =&gt; freqb; \/\/starting high<\/p>\n<p>for (0 =&gt; int countb_a; countb_a &lt; 1000; countb_a == 0)     {         freqb++; \/\/increase frequency         freqb =&gt; b.freq;<br \/>\n\/\/&lt;&lt;&gt;&gt;;<br \/>\n.00015::second =&gt; now;<br \/>\ncountb_a++; \/\/sends to part b_b<br \/>\n}<br \/>\nfor (0 =&gt; int countb_b; countb_b &lt; 1000; countb_b == 0)     {         freqb&#8211;; \/\/decrease frequency         freqb =&gt; b.freq;<br \/>\n\/\/&lt;&lt;&gt;&gt;;<br \/>\n.00015::second =&gt; now;<br \/>\ncountb_b++; \/\/ends to part b_a; rinse\/repeat<br \/>\n}<br \/>\nbcounter ++;\/\/for statements have gone through once; add 1 to counter<br \/>\n}<\/p>\n<p>0 =&gt; b.gain;<\/p>\n<p>\/\/END 2<\/p>\n<p>&lt;&lt;&lt;&#8220;Turn off your @#$^&amp;* car alarm!&#8221;&gt;&gt;&gt;;<\/p>\n<p>\/\/START 3<br \/>\nTriOsc c =&gt; dac;<br \/>\n.2 =&gt; c.gain;<br \/>\nint freqc;<br \/>\n1000 =&gt; freqc;<\/p>\n<p>for (0 =&gt; int csound; csound &lt; 16; csound == 0) {     freqc &#8211;; \/\/lowering frequenC (pun intended)     freqc =&gt; c.freq;<br \/>\n\/\/&lt;&lt;&gt;&gt;;<br \/>\n.00025::second =&gt; now;<br \/>\nif (freqc == 200)<br \/>\n{<br \/>\n1000 =&gt; freqc;<br \/>\ncsound ++; \/\/add to main counter<br \/>\n}<br \/>\nif (csound == 16)<br \/>\n{<br \/>\n0 =&gt; c.gain; \/\/silence after loop ends<br \/>\n}<br \/>\n}<\/p>\n<p>\/\/END 3<\/p>\n<p>\/\/START 4<br \/>\nSqrOsc d =&gt; dac;<br \/>\nSawOsc dd =&gt; dac; \/\/extra buzz, closer to &#8220;authentic&#8221;<br \/>\n.05 =&gt; d.gain;<br \/>\n.05 =&gt; dd.gain;<br \/>\nfor (0 =&gt; int dsound; dsound &lt; 4; dsound == 0) {     420 =&gt; d.freq;<br \/>\n420 =&gt; dd.freq;<br \/>\n.8::second =&gt; now; \/\/starting frequency<br \/>\n650 =&gt; d.freq;<br \/>\n650 =&gt; dd.freq;<br \/>\n.8::second =&gt; now; \/\/ending frequency; ping-pong effect<br \/>\ndsound ++; \/\/add to main counter<br \/>\n\/\/&lt;&lt;&gt;&gt;;<br \/>\nif (dsound == 4)<br \/>\n{<br \/>\n0 =&gt; d.gain;<br \/>\n0 =&gt; dd.gain; \/\/silence when main counter is maxed out<br \/>\n}<br \/>\n}<\/p>\n<p>\/\/END 4<\/p>\n<p>&lt;&lt;&lt;&#8220;I SAID TURN OFF THAT !#@$^% CAR ALARM!&#8221;&gt;&gt;&gt;;<br \/>\n\/\/har har har<\/p>\n<p>\/\/START 5<br \/>\nSqrOsc e =&gt; dac;<br \/>\n.2 =&gt; e.gain;<\/p>\n<p>int freqe;<br \/>\n200 =&gt; freqe;<\/p>\n<p>for (0 =&gt; int countf; countf &lt; 2; 0 == countf) {     freqe ++;     freqe =&gt; e.freq;<br \/>\n\/\/&lt;&lt;&gt;&gt;;<br \/>\n.006::second =&gt; now;<br \/>\nif (500 == freqe)<br \/>\n{<br \/>\n0 =&gt; e.gain;\/\/brief pause<br \/>\n.3::second =&gt; now;<br \/>\n.2 =&gt; e.gain;<br \/>\n200 =&gt; freqe;<br \/>\ncountf ++;<br \/>\n}<br \/>\nif (countf == 2) \/\/when counter ends&#8230;<br \/>\n{<br \/>\n0 =&gt; e.gain; \/\/&#8230;shhhh<br \/>\n}<br \/>\n}<\/p>\n<p>\/\/END 5<\/p>\n<p>\/\/START 6<br \/>\nSawOsc f =&gt; dac;<br \/>\nTriOsc ff =&gt; dac; \/\/added buzzzzzz<\/p>\n<p>220 =&gt; f.freq;<br \/>\n220 =&gt; ff.freq;<br \/>\n.2 =&gt; float gainf;<br \/>\nint countf; \/\/sub-counter<br \/>\n0 =&gt; countf;<br \/>\nfor (0 =&gt; int soundf; soundf &lt; 1; 0 == soundf) {     .2 =&gt; gainf;<br \/>\ngainf =&gt; f.gain;<br \/>\ngainf =&gt; ff.gain;<br \/>\ncountf ++;<br \/>\n\/\/&lt;&lt;&gt;&gt;;<br \/>\n.25::second =&gt; now;<\/p>\n<p>0 =&gt; gainf;<br \/>\ngainf =&gt; f.gain;<br \/>\ngainf =&gt; ff.gain;<br \/>\n.25::second =&gt; now;<\/p>\n<p>if (countf &gt; 7)<br \/>\n{<br \/>\n1 =&gt; soundf; \/\/end main counter<br \/>\n}<br \/>\n}<br \/>\n\/\/END 6<\/p>\n<p>\/\/RE-START A, BUT AS G<br \/>\nTriOsc g =&gt; dac;<br \/>\n.1 =&gt; g.gain;<br \/>\nint freqg;<br \/>\n1300 =&gt; freqg;<br \/>\nint checkg;<br \/>\n0 =&gt; checkg;<br \/>\nfor (0 =&gt; int gsound; gsound &lt; 1; 0 == gsound) {     freqg =&gt; g.freq;<br \/>\nfreqg &#8211;;<\/p>\n<p>.0007::second =&gt; now;<\/p>\n<p>if(freqg &lt;500)     {         1300 =&gt; freqg;<br \/>\ncheckg ++;<br \/>\n\/\/&lt;&lt;&gt;&gt;;<br \/>\nif (checkg &gt; 4)<br \/>\n{<br \/>\n0 =&gt; g.gain;<br \/>\n1 =&gt; gsound;<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n\/\/END A<\/p>\n<p>\/\/Okay, I&#8217;ll turn it off&#8230;<\/p>\n<p>SqrOsc h =&gt; dac;<br \/>\nfloat gainh;<br \/>\nint freqh;<br \/>\n800 =&gt; freqh; \/\/starts pretty high<\/p>\n<p>for (0 =&gt; int hclock; hclock &lt;2; hclock == 0) {     .1 =&gt; gainh; \/\/Working with Sqr; trying to not annoy neighbors<br \/>\ngainh =&gt; h.gain;<\/p>\n<p>freqh ++;<br \/>\nfreqh =&gt; h.freq;<br \/>\n\/\/&lt;&lt;&gt;&gt;;<br \/>\n.0004::second =&gt; now;<\/p>\n<p>if (freqh &gt; 1000) \/\/gets high enough&#8211;<br \/>\n{<br \/>\nhclock ++;<br \/>\n0 =&gt; h.gain; \/\/brief pause<br \/>\n.2::second =&gt; now;<br \/>\n800 =&gt; freqh; \/\/re-set freq, will loop ++<br \/>\n.1 =&gt; gainh; \/\/once maxed out, everything ends<br \/>\n}<br \/>\n}<br \/>\n\/\/Car alarm off!<br \/>\n&lt;&lt;&lt;&#8220;Car alarm turned off. Happy?&#8221;&gt;&gt;&gt;;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I&#8217;m taking this Beginning Object-Oriented Programming class this semester with the hopes of getting into the beginning robot-music-making-cool-awesome class next Fall. Music tech school? Yes please! Here&#8217;s the ChucK code for anyone who happens to need a car alarm. (And yes, I&#8217;m still drawing, just not uploading much&#8230;. yet!)<br \/>\nI&#8217;d totally attach an audio file if I knew how. Right now we&#8217;re working directly in miniAudicle, so if you download that then you can hear the car alarm in all its glory. <a href=\"http:\/\/tahnee.org\/wordpress\/2010\/09\/27\/car-alarm-in\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[9],"tags":[1421,1426,1422,958,1423,1424,228,1427,1425,1142],"_links":{"self":[{"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/posts\/1977"}],"collection":[{"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/comments?post=1977"}],"version-history":[{"count":4,"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/posts\/1977\/revisions"}],"predecessor-version":[{"id":1981,"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/posts\/1977\/revisions\/1981"}],"wp:attachment":[{"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/media?parent=1977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/categories?post=1977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tahnee.org\/wordpress\/wp-json\/wp\/v2\/tags?post=1977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}