<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-271299922229725193</id><updated>2011-09-17T07:51:03.958-05:00</updated><category term='source code'/><category term='classic computing'/><category term='BASIC'/><category term='jokes'/><category term='audicon'/><category term='article'/><category term='google'/><category term='programming'/><title type='text'>amphetamachine</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://amphetamachine.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://amphetamachine.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>amphetamachine</name><uri>http://www.blogger.com/profile/01998997320430420232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_uy2XEuqOdiI/TQ716FlgfLI/AAAAAAAAAyY/9JxYda94BrY/s1600-R/44696_594703733640_184904792_34375024_2067605_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-271299922229725193.post-7175204031795677357</id><published>2011-08-11T04:11:00.004-05:00</published><updated>2011-08-11T04:18:35.893-05:00</updated><title type='text'>Optical illusion time!</title><content type='html'>&lt;p&gt;These are all triangles. There are no squares.&lt;/p&gt;&lt;div style="background-color: white; color:black;font-family:arial, sans-serif;white-space:nowrap;"&gt;▲ ▼ ► ◄ ▲ ◄ ► ◄ ► ▲ ► ▲ ► ▲ ▼ ◄ ◄ ► ▼ ► ▼ ▼ ◄ ► ◄ ▲ ▲ ► ► ▲ ▲ ◄ ► ► ▲ ▼ ► ◄ ◄ ◄&lt;br /&gt;► ▲ ► ► ▲ ◄ ▼ ► ▼ ▼ ▲ ▼ ► ► ◄ ▼ ► ◄ ▲ ▲ ◄ ▼ ► ► ▲ ► ► ► ▲ ► ◄ ▲ ▲ ► ◄ ◄ ▼ ▲ ▼ ▼&lt;br /&gt;◄ ▲ ◄ ◄ ► ◄ ◄ ◄ ▼ ▼ ▼ ▲ ► ► ► ▲ ► ▼ ▲ ► ▲ ◄ ▼ ◄ ▲ ► ▼ ▼ ◄ ▲ ► ► ▲ ▲ ▲ ► ▲ ▼ ► ◄&lt;br /&gt;◄ ▲ ► ◄ ▼ ▼ ▲ ▼ ▼ ▼ ► ► ▲ ▲ ◄ ► ▲ ◄ ◄ ▼ ◄ ▲ ► ▲ ► ◄ ► ▼ ▲ ◄ ▼ ► ◄ ▲ ▼ ◄ ▼ ▲ ▼ ▼&lt;br /&gt;▼ ▼ ► ▲ ▼ ► ◄ ▲ ▼ ◄ ▲ ◄ ▲ ◄ ► ◄ ▼ ▲ ▲ ▲ ► ◄ ► ▲ ▲ ◄ ► ▼ ◄ ◄ ◄ ► ▼ ► ◄ ◄ ► ◄ ◄ ▲&lt;br /&gt;► ◄ ▲ ▼ ▲ ► ▼ ▼ ► ▼ ◄ ◄ ► ► ▼ ▼ ◄ ► ▲ ► ▲ ▼ ◄ ▼ ▼ ▲ ▼ ▼ ◄ ▲ ◄ ▼ ▲ ▼ ▼ ◄ ► ► ◄ ▲&lt;br /&gt;► ▼ ► ▲ ▼ ▼ ▼ ◄ ◄ ◄ ◄ ▲ ▼ ◄ ▲ ► ▲ ▼ ▲ ▼ ▼ ◄ ◄ ◄ ◄ ◄ ◄ ▼ ▼ ▲ ► ► ► ► ◄ ► ► ▼ ▲ ▲&lt;br /&gt;▼ ► ► ▼ ▼ ► ▼ ▲ ▼ ▲ ▼ ► ► ▼ ▲ ▲ ▼ ► ▲ ► ▼ ▼ ▲ ▼ ▲ ► ◄ ▲ ◄ ▲ ▲ ▼ ◄ ▲ ▼ ◄ ▲ ▲ ◄ ◄&lt;br /&gt;► ► ▼ ▼ ► ► ◄ ► ▼ ◄ ► ▼ ▲ ◄ ▲ ◄ ▼ ▲ ▼ ▼ ▲ ▲ ▼ ► ► ► ► ◄ ▲ ◄ ◄ ► ▼ ▲ ◄ ▲ ▲ ▲ ◄ ►&lt;br /&gt;◄ ► ▼ ▲ ▲ ▲ ► ► ▲ ▼ ▼ ◄ ▲ ◄ ▼ ◄ ▲ ► ▼ ◄ ◄ ▲ ◄ ◄ ► ► ◄ ▼ ◄ ▲ ▼ ◄ ▼ ▲ ▲ ◄ ▼ ▼ ▼ ►&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/271299922229725193-7175204031795677357?l=amphetamachine.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amphetamachine.blogspot.com/feeds/7175204031795677357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=271299922229725193&amp;postID=7175204031795677357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/7175204031795677357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/7175204031795677357'/><link rel='alternate' type='text/html' href='http://amphetamachine.blogspot.com/2011/08/optical-illusion-time-these-are-all.html' title='Optical illusion time!'/><author><name>amphetamachine</name><uri>http://www.blogger.com/profile/01998997320430420232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_uy2XEuqOdiI/TQ716FlgfLI/AAAAAAAAAyY/9JxYda94BrY/s1600-R/44696_594703733640_184904792_34375024_2067605_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-271299922229725193.post-5011432968103652897</id><published>2010-12-20T05:27:00.003-06:00</published><updated>2010-12-20T23:35:31.549-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='article'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>A Glimpse at the Future of Computing</title><content type='html'>&lt;p&gt;I was thinking of the whole &lt;a href="http://bit.ly/gLFMdn"&gt;"Cloud Computing"&lt;/a&gt; controversy and was reminded of an article I read back in 2003.&lt;/p&gt;&lt;br /&gt;&lt;div class="blockquote" style="font-family: monospace;"&gt;&lt;h2&gt;A Glimpse at the Future of Computing&lt;/h2&gt;&lt;p&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;by Phocks&lt;/p&gt;&lt;p&gt;published in &lt;em&gt;2600 Magazine&lt;/em&gt; Vol. 20, No. 1, Spring 2003&lt;/p&gt;&lt;p&gt;Imagine a world, if you will, plagued by terrorists and evildoers, whose weapon is the personal computer. It has powerful encryption used to block anyone from reading plans of how to destroy structures vital to a country's survival. It contains a slew of programs designed solely for destroying security and rendering the world helpless to attacks. And anonymously connecting to a terrorist network consisting of tens of thousands of systems just like it, bringing together all who oppose a country to share information and formulate plans of attack. Welcome to the government's view of the Internet. An innumerable array of systems that have direct access to any one another at any given time, able to share data with a grade of encryption higher than their own military standards.&lt;/p&gt;&lt;p&gt;Something must be done to contain the threat for the good of the world. These systems which are run without regulation of any kind; controlled and even built by those who operate them, must be stopped for there is no telling what they are doing. It has even been proven that millions of these systems can come together to shatter the encryption that holds this country's secrets (distributed.net). Something must be done - to let all activities be controlled, to bring all this terrorism to a halt. To shut down the Internet.&lt;/p&gt;&lt;p&gt;A scheme that sounds so improbable, nay, impossible, is easily completed. All that must be done is pass a new bill (or hide an appendage to an existing one) that will force the ISPs of the country to obey new government standards, to all connect to a central server array that is tightly controlled by the government, and shut off all access to foreign servers.&lt;/p&gt;&lt;p&gt;Simply put, dismantle the Internet in the United States (or any other country that wants to implement such a system) and rebuild it the "right" way. The way that can be constantly monitored for suspicious, terroristic activity.&lt;/p&gt;&lt;p&gt;Personal computers will also become completely incompatible with the new standard. In exchange for turning in your computer to the local recycling center, you will be given a voucher for a free USNet (the new, patriotic "Internet" name] terminal. The terminal will consist of a flat panel monitor, a moderate processor (450 MHz), a mediocre sound card, 32m of ram, a mouse, a keyboard, and a USNet connection card (proprietary) ISDN-based modem for both speed and compatibility. No hard drive, no networking card, no CD drive, no floppy drive, no external or internal media at all allowed. The USNet terminal will cost no more than $150 (less than $100 for manufacturers to build), and will be greatly appreciated by the manufacturers because of the extremely high profit made from selling millions of machines to anyone who wants a computer.&lt;/p&gt;&lt;p&gt;How it works without a hard drive is simple. The operating system is stored on pre-burnt ROM and is checked by the USNet servers every three minutes to make sure it's working properly. All web servers are run on the government's super cluster of servers, and a second cluster (or rather, section of the super cluster) is designated for the personal systems. Every user is allotted one gigabyte of storage on the USNet system, which is more than enough.&lt;/p&gt;&lt;p&gt;Everyone wins on this system, for downloads take mere seconds since the personal data section is directly linked with the servers. All programs are run remotely, and only the data that is entered to them (such as typed words in a word processor) is stored in ram until sent out.  No trace of the program is allowed on the USNet terminal, for fear of terrorists editing the ram and taking control of the programs.&lt;/p&gt;&lt;p&gt;It even works out for software designers like Microsoft. Office tools will not need to be sold, only paid for on a per-use basis. That way everyone wins; the customer doesn't pay for anything that they don't use and the corporations get paid for every use.&lt;/p&gt;&lt;p&gt;Only programs carefully scrutinized by the government are allowed to be run and no amateur programming at all is allowed, for programs should be left to the corporations - that is what they are for. There is no need for a user to program anything. The corporations will take care of everything necessary, even special USNet games that are finally family-friendly. Even the censors will be happy.&lt;/p&gt;&lt;p&gt;Since USNet covers anything a computer should be used for in a free, but secure, society, all other computers will become illegal to own. Why would you have one for any other reason than keeping secrets from the government? Everything will be taken. But you will get money back because the government knows what an investment all that technology must have been. Desktop computers will be exchanged for $150, enough to buy a USNet terminal, and everything from laptops to PDAs will be confiscated on sight, but a voucher will be issued by the officer stating what model and condition it is, and will be cashed at a fair value (not to exceed $200).&lt;/p&gt;&lt;p&gt;All data that enters and exits the USNet clusters will be scanned thoroughly for anything that may be suspicious, such as terrorist-like texts that defame the country. All transactions between servers and personal areas will be logged, and personal data sections cannot send files to one another, lest there be music or movie piracy. In such a system, everyone will be happy because they can chat and play games and run office programs, and the government gets to carefully watch all activity for anything suspicious and keep a tight control of USNet to let it be safe for children to browse, since only their servers can communicate data.  That way even the schools and parents can let young children browse the USNet without a single worry, for there will be no more pornography or online stalkers (because all communications are watched by specialized computers to look for any suspicious activity) and all activist pages like those that share information on the Secret Service to terrorist networks and those that actually help evil software pirates and hackers will be shut down forever.&lt;/p&gt;&lt;p style="font-style: oblique;"&gt;Shoutouts to:&lt;br /&gt;psykOmantis, Vie, Twilyght, Arwynn, everyone from SPR and Taps, and anyone who stands by my side, physically or digitally (too many to name personally). I'd like to point out the obvious - that the general happy and positive attitude is not my own. It merely fits the article.&lt;/p&gt;&lt;/div&gt;&lt;p&gt;Now, doesn't it strike you as uncanny? Scale the tech appropriately and there are some definite parallels to what &lt;a href="http://bit.ly/hQq780"&gt;Google is trying to do&lt;/a&gt; with its Chrome OS, a completely browser-based operating system.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/271299922229725193-5011432968103652897?l=amphetamachine.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amphetamachine.blogspot.com/feeds/5011432968103652897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=271299922229725193&amp;postID=5011432968103652897' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/5011432968103652897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/5011432968103652897'/><link rel='alternate' type='text/html' href='http://amphetamachine.blogspot.com/2010/12/glimpse-at-future-of-computing.html' title='A Glimpse at the Future of Computing'/><author><name>amphetamachine</name><uri>http://www.blogger.com/profile/01998997320430420232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_uy2XEuqOdiI/TQ716FlgfLI/AAAAAAAAAyY/9JxYda94BrY/s1600-R/44696_594703733640_184904792_34375024_2067605_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-271299922229725193.post-2600788352174475688</id><published>2010-08-10T17:26:00.002-05:00</published><updated>2010-12-20T23:43:44.236-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='source code'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='jokes'/><title type='text'>Signal Trapping</title><content type='html'>&lt;pre style="font-size: smaller;"&gt;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ____________ . . .&lt;br /&gt;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . / It's a trap! \ . .&lt;br /&gt;. . . . . . . . . . . . . . . _,,,--~~~~~~~~~~~~--,_ . . . .\______________/ . .&lt;br /&gt;. . . . . . . . . . . . . ,-` : : : :::: :::: :: : : : o `-, . . \/. . . . . . .&lt;br /&gt;. . . . . . . . . . . .,-` :: : : :::: :::: :::: :::: : :O : `-, . . . . . . . .&lt;br /&gt;. . . . . . . . . . ,-` :: ::: :: : : :: :::: :::: :: : : : : :O `-, . . . . . .&lt;br /&gt;. . . . . . . . .,-` : :: :: :: :: :: : : : : : , : : :* :::: :::: :'; . . . . .&lt;br /&gt;. . . . . . . ,-` / / : :: :: :: :: : : :::: :::-, ;; ;; ;; ;; ;; ;; ;\. . . . .&lt;br /&gt;. . . . . . /,-`,' :: : : : : : : : : :: :: :: : '-, ;; ;; ;; ;; ;; ;; | . . . .&lt;br /&gt;. . . . . /,',-` :: :: :: :: :: :: :: : ::_,-~~~~,_'-, ;; ;; ;; ;; ;; |. . . . .&lt;br /&gt;. . . . _/ :,' :/ :: :: :: : : :: :: _,-'/ : ,-';'-'''''~-, ;; ;; ;;,' . . . . .&lt;br /&gt;. . ,-` / : : : : : : ,-''' : : :,--'' :|| /,-`-`'__`''' \ ;; ;,-` . . . . . . .&lt;br /&gt;. . \ :/,, : : : _,-' --,,_ : : \ :\ || / /,-'-x### ::\ \ ;; / . . . . . . . . .&lt;br /&gt;. . . \/ /---'''' : \ #\ : :\ : : \ :\ \| | : (O##* : :/ /-` . . . . . . . . . .&lt;br /&gt;. . . /,'____ : :\ '-#\ : \, : :\ :\ \ \ : '-,___,-',-` -,,. . . . . . . . . . .&lt;br /&gt;. . . ' ) : : : :''''--,,--,,,,,,^ \ \ :: ::--,,_''-,,'''^ :'- :'-,. . . . . . .&lt;br /&gt;. . . .) : : : : : : ,, : ''''~~~~' \ :: :: :: :'''''^ :: ,-' :,/\ . . . . . . .&lt;br /&gt;. . . .\,/ /|\\| | :/ / : : : : : : : ,'-, :: :: :: :: ::,--'' :,-' \ \. . . . .&lt;br /&gt;. . . .\\'|\\ \|/ '/ / :: :_--,, : , | )'; :: :: :: :,-'' : ,-' : : :\ \,. . . .&lt;br /&gt;. . ./^ :| \ |\ : |/\ :: ::----, :\/ :|/ :: :: ,-'' : :,-' : : : : : : `'-,,_. .&lt;br /&gt;. . | : : :/ `'-(, :: :: :: '''''~,,,,,'' :: ,-'' : :,-' : : : : : : : : :,-`''\&lt;br /&gt;. ,-: : : | : : `') : : :^''''~-,: : ,--''' : :,-`' : : : : : : : : : ,-` :^''''&lt;br /&gt;./ : : : :'-, :: | :: :: :: _,,-`'''^ : ,--`' : : : : : : : : : : : / : : : : : &lt;br /&gt;/ : : : : -, :^'''''''''''^ : : _,,-~`' : : : : : : : : : : : : : :| : : : : : :&lt;br /&gt;: : : : : :^''~~~~~~~~~~~~~''' : : : : : : : : : : : : : : : : : : | : : : : : :&lt;/pre&gt;&lt;p&gt;Here it is. Admiral Ackbar with his famous words. Finally wrapped to 80 characters. Include in source code at will.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/271299922229725193-2600788352174475688?l=amphetamachine.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amphetamachine.blogspot.com/feeds/2600788352174475688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=271299922229725193&amp;postID=2600788352174475688' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/2600788352174475688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/2600788352174475688'/><link rel='alternate' type='text/html' href='http://amphetamachine.blogspot.com/2010/08/signal-trapping.html' title='Signal Trapping'/><author><name>amphetamachine</name><uri>http://www.blogger.com/profile/01998997320430420232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_uy2XEuqOdiI/TQ716FlgfLI/AAAAAAAAAyY/9JxYda94BrY/s1600-R/44696_594703733640_184904792_34375024_2067605_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-271299922229725193.post-6630062797736418801</id><published>2009-04-21T15:33:00.000-05:00</published><updated>2009-04-21T15:42:11.627-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BASIC'/><category scheme='http://www.blogger.com/atom/ns#' term='classic computing'/><title type='text'>Eliza Strikes Again!</title><content type='html'>&lt;pre&gt;Blassic 0.10.0&lt;br /&gt;(C) 2001-2005 Julian Albo&lt;br /&gt;&lt;br /&gt;Ok&lt;br /&gt;HELP&lt;br /&gt;Syntax horror&lt;br /&gt;Ok&lt;br /&gt;LOAD "ELIZA.BAS"&lt;br /&gt;Ok&lt;br /&gt;RUN&lt;br /&gt;               **************************&lt;br /&gt;                         ELIZA&lt;br /&gt;                   CREATIVE COMPUTING&lt;br /&gt;                 MORRISTOWN, NEW JERSEY&lt;br /&gt;&lt;br /&gt;                  ADAPTED FOR IBM PC BY&lt;br /&gt;                   PATRICIA DANIELSON AND PAUL HASHFIELD&lt;br /&gt;                    BE SURE THAT THE CAPS LOCK IS ON&lt;br /&gt;&lt;br /&gt;               PLEASE DON'T USE COMMAS OR PERIODS IN YOUR INPUTS&lt;br /&gt;&lt;br /&gt;               *************************&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="font-family: monospace;"&gt;&lt;br /&gt;&lt;div&gt;HI! I'M ELIZA. WHAT'S YOUR PROBLEM?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;HELLO&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;HOW DO YOU DO ...PLEASE STATE YOUR PROBLEM.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;NO PROBLEMS&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;ARE YOU SAYING NO JUST TO BE NEGATIVE?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;NO THERE REALLY ARE NO PROBLEMS WITH ME&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;YOU ARE BEING A BIT NEGATIVE.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;NO I AM NOT&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;DID YOU COME TO ME BECAUSE YOU ARE NOT&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;I AM NOT WHAT&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;HOW LONG HAVE YOU BEEN NOT WHAT&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;NOT WHAT WHAT&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;WHY DO YOU ASK?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;NEVERMIND&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;NO&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;WHY NOT?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;BECAUSE I AM A WELL-ADJUSTED INDIVIDUAL&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;DO YOU BELIEVE IT IS NORMAL TO BE A WELL-ADJUSTED INDIVIDUAL&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;YES I DO&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;ARE YOU SURE?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;YES&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;I SEE.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;WHAT DO YOU SEE&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;WE WERE DISCUSSING YOU--NOT ME.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;FINE IF YOU SAY SO&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;OH, I SAY SO&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;OH YEAH?&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;WHAT DOES THAT SUGGEST TO YOU?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;IT SUGGESTS TO ME THAT YOU ARE JUST A STUPID COMPUTER PROGRAM&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;WHAT MAKES YOU THINK I AM JUST A STUPID COMPUTER PROGRAM&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;BECAUSE I HAVE YOUR SOURCE CODE ON MY HARD DRIVE&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;IS THAT THE REAL REASON?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;IT IS LESS THAN 10 KILOBYTES&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;I SEE.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;DOES THAT MAKE YOU FEEL SMALL?&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;YOU'RE NOT REALLY TALKING ABOUT ME, ARE YOU?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;I AM PRETTY SURE I AM&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;DO YOU ENJOY BEING PRETTY SURE ME ARE&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;ME ARE?&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;I'M NOT SURE I UNDERSTAND YOU FULLY.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;I ARE HOOMAN&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;COME COME ELUCIDATE YOUR THOUGHTS.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;YOU IS MACHINE&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;WE WERE DISCUSSING YOU--NOT ME.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;YOU MAKE WORDS GO WHEN I MAKE WORDS GO&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;OH, I MAKE WORDS GO WHEN ME MAKE WORDS GO&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;WHY IS IT THAT I AM HAVING THIS CONVERSATION&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;DID YOU COME TO ME BECAUSE YOU ARE HAVING THIS CONVERSATION&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;NO... NO. WELL I GUESS. I MEAN THE FACT THAT I AM TALKING TO MY COMPUTER CERTAINLY LEADS ME TO BELIEVE THAT I MAY HAVE A MENTAL PROBLEM&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;HOW LONG HAVE YOU BEEN TALKING TO YOURCOMPUTER CERTAINLY LEADS YOU TO BELIEVE THAT ME MAY HAVE A MENTAL PROBLEM&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;THAT DOES NOT MAKE ANY SENSE AT ALL&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;ARE YOU SURE?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;PRETTY SURE&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;CAN YOU ELABORATE ON THAT?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;CAN YOU EVEN SPEAK ENGLISH?&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;DON'T YOU BELIEVE THAT I CAN EVEN SPEAK ENGLISH?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;SEEMS LIKE YOU ARE JUST PROGRAMMED TO SPLICE STRINGS AND RE-ARRANGE SYNTAX&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;DOES IT PLEASE YOU TO BELIEVE I AM JUST PROGRAMMED TO SPLICE STRINGS AND RE-ARRANGE SYNTAX&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;DOGS&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;CATS&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;WHAT DOES THAT SUGGEST TO YOU?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;FLUFF&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;I SEE.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;BUTTERFLIES&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;I'M NOT SURE I UNDERSTAND YOU FULLY.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;BUTTERFLIES ARE SCARY&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;COME COME ELUCIDATE YOUR THOUGHTS.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;I AM SAD BECAUSE BUTTERFLIES ARE SCARY&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;DO YOU BELIEVE IT IS NORMAL TO BE SAD BECAUSE BUTTERFLIES AM SCARY&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;BUT... THEY HAVE WEIRD FACES. THAT HAS TO COUNT FOR SOMETHING&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;CAN YOU ELABORATE ON THAT?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;LET'S SEE... THEY HAVE COMPOUND EYES. THAT IS FREAKY. THEY ALSO HAVE A LONG WEIRD TONGUE&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;? &lt;span style="font-weight: bold;"&gt;SHUT UP!&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;O.K. IF YOU FEEL THAT WAY I'LL SHUT UP....&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Ok&lt;/div&gt;&lt;br /&gt;&lt;div&gt;exit&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/271299922229725193-6630062797736418801?l=amphetamachine.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amphetamachine.blogspot.com/feeds/6630062797736418801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=271299922229725193&amp;postID=6630062797736418801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/6630062797736418801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/6630062797736418801'/><link rel='alternate' type='text/html' href='http://amphetamachine.blogspot.com/2009/04/eliza-strikes-again.html' title='Eliza Strikes Again!'/><author><name>amphetamachine</name><uri>http://www.blogger.com/profile/01998997320430420232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_uy2XEuqOdiI/TQ716FlgfLI/AAAAAAAAAyY/9JxYda94BrY/s1600-R/44696_594703733640_184904792_34375024_2067605_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-271299922229725193.post-1207427532624525813</id><published>2009-02-20T13:07:00.000-06:00</published><updated>2009-03-02T16:29:27.635-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='audicon'/><title type='text'>More Explanations</title><content type='html'>&lt;p&gt;And so, after over a month's worth of CPU time spent on calculations, my program is finally finished generating its data set. I think it is well worth it, considering I started writing this program in October of 2006, to be now finally almost finished.&lt;/p&gt;&lt;p&gt;Here's brief explanation of what my computer has been doing:&lt;/p&gt;&lt;h3&gt;Preamble&lt;/h3&gt;&lt;p&gt;First of all, audio is a sequence of micro-changes air pressure which are transmitted over distances and perceived by the human ear as sound. These air pressure variations can be expressed as a positive or negative value, depending on what increase or decrease beyond &amp;quot;neutral&amp;quot; air pressure is created:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt; ^ | __        __        __&lt;br /&gt; + |/  \      /  \      /  \&lt;br /&gt;  0|----\----/----\----/----\----&lt;br /&gt; - |     \  /      \  /      \  /&lt;br /&gt; v |      --        --        --&lt;br /&gt;   time -&amp;gt;&lt;/pre&gt;&lt;p&gt;Digital audio waveforms are merely a collection of values, in essence, between &lt;code&gt;-1&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt;, inclusive, which are called &lt;strong&gt;samples&lt;/strong&gt;. Samples represent what the air pressure will be at the point in time where the sample occurs. The rate at which the samples are converted to air pressure variations (&amp;quot;playing&amp;quot; the digital audio) is described as the &lt;strong&gt;sampling rate&lt;/strong&gt;. The sampling rate is expressed in the number samples that represent one second of digital audio.&lt;/p&gt;&lt;p&gt;Through the graphing of the audio samples' values by time, we can see how they represent the original waveform:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt; +1| ..        ..        ..&lt;br /&gt;   |-  -      -  -      -  -&lt;br /&gt;  0|----*----*----*----*----*----&lt;br /&gt;   |     -  -      -  -      -  -&lt;br /&gt; -1|      --        --        --&lt;br /&gt;   time -&amp;gt;&lt;/pre&gt;&lt;p&gt;Because digital audio uses computerized values for the representation of these samples, the maximum height of a waveform is limited to &lt;code&gt;+/-1&lt;/code&gt;.&lt;/p&gt;&lt;h2&gt;Language&lt;/h2&gt;&lt;p&gt;Regarding the deconstruction of audio data, there are certain terms used in the scope of this blog that require explanation:&lt;/p&gt;&lt;h3&gt;amplitude&lt;/h3&gt;&lt;p&gt;In sound, &lt;strong&gt;amplitude&lt;/strong&gt; refers to the loudness of the waveform, also described as the amount of air pressure change that the waveform produces. In physical sound, it is measures in pascals. In digital sound, however it becomes a measure of its height within the limit of the samples' maximum value:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt; +1| __        __        __.........._&lt;br /&gt;   |/  \      /  \      /  \         |--- amplitude&lt;br /&gt;  0|----\----/----\----/----\----....-&lt;br /&gt;   |     \  /      \  /      \  /&lt;br /&gt; -1|      --        --        --&lt;br /&gt;   time -&amp;gt;&lt;/pre&gt;&lt;h3&gt;frequency&lt;/h3&gt;&lt;p&gt;A &lt;strong&gt;frequency&lt;/strong&gt;, or pitch is an expression of how many times per second a given waveform completes its cycle, or &lt;strong&gt;period&lt;/strong&gt;. It is expressed in &lt;strong&gt;Hz&lt;/strong&gt;, or cycles per second.&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;      +---------+---------+------ peaks&lt;br /&gt;      |         |         |&lt;br /&gt;      v         v         v&lt;br /&gt; +1| __        __        __&lt;br /&gt;   |/  \      /  \      /  \&lt;br /&gt;  0|----\----/----\----/----\----.&lt;br /&gt;   |     \  /      \  /      \  /.&lt;br /&gt; -1|      --        --        -- .&lt;br /&gt;   time -&amp;gt;                       .&lt;br /&gt;   .                             .&lt;br /&gt;   |----------1 second-----------|&lt;br /&gt;   3 peaks in 1 second =&amp;gt; frequency: 3 Hz&lt;/pre&gt;&lt;h3&gt;frequency "bin"&lt;/h3&gt;&lt;p&gt;A &lt;strong&gt;frequency bin&lt;/strong&gt;, or &lt;strong&gt;bin&lt;/strong&gt;, means a summation of the amplitudes of all frequencies associated with that bin as they occur in the deconstructed waveform.&lt;/p&gt;&lt;p&gt;Frequency bins are an effective representation of the loudness, or &lt;strong&gt;amplitude&lt;/strong&gt; of the musical notes, or &lt;strong&gt;tones&lt;/strong&gt; present in a waveform.&lt;/p&gt;&lt;h3&gt;magnitude&lt;/h3&gt;&lt;p&gt;Because higher-frequency waveforms carry more energy than lower-frequency ones, it becomes necessary to think of a waveform in terms of the total energy carried by it.The energy said to be carried by a given waveform is expressed as the total change in air displacement incurred by the transmission of that waveform. This can be found by finding the absolute derivative of the waveform.&lt;/p&gt;&lt;p&gt;The &lt;strong&gt;magnitude&lt;/strong&gt; of a waveform is an expression of this. It is the amplitude of the waveform weighted by its frequency, and is found by multiplying its amplitude by its frequency.&lt;/p&gt;&lt;h3&gt;phase, or phasing&lt;/h3&gt;&lt;p&gt;The &lt;strong&gt;phase&lt;/strong&gt; of a given waveform refers to the point in its cycle at which it is first observed. It is typically measured in radians from 0 the value of theta would be in the waveform's sine function.&lt;/p&gt;&lt;p&gt;A simpler way of defining it would be to think of it in terms of how far the beginning of the period of the waveform is from the origin:&lt;/p&gt;&lt;p style="font-style: oblique;"&gt;An unphased waveform:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;   +------ first period starts at the origin; no phasing&lt;br /&gt;   |&lt;br /&gt;   v&lt;br /&gt; +1| __        __        __&lt;br /&gt;   |/  \      /  \      /  \&lt;br /&gt;  0|----\----/----\----/----\----&lt;br /&gt;   |     \  /      \  /      \  /&lt;br /&gt; -1|      --        --        --&lt;br /&gt;   time -&amp;gt;&lt;/pre&gt;&lt;p style="font-style: oblique;"&gt;A waveform with phasing:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;      +--- first period begins here&lt;br /&gt;      |&lt;br /&gt;   +------ began observing here (3/4 through last period)&lt;br /&gt;   |  |        =&amp;gt; phasing of +1/4 of a period = +pi/2&lt;br /&gt;   v  v&lt;br /&gt; +1|    __        __        __&lt;br /&gt;   |   /  \      /  \      /  \&lt;br /&gt;  0|--/----\----/----\----/----\-&lt;br /&gt;   | /      \  /      \  /      \&lt;br /&gt; -1|-        --        --&lt;br /&gt;   time -&amp;gt;&lt;/pre&gt;&lt;h3&gt;The Fourier Transform&lt;/h3&gt;&lt;p&gt;Joseph Fourier discovered that within complex waveforms exist many simpler waveforms with their own individual pitches. The Fourier transform was built as a way to decompose these complex waveforms into the simpler ones.&lt;/p&gt;&lt;p&gt;By design, the computerized Fourier transform gives a deconstruction of a waveform as a set of complex values, whose real and imaginary portions relate to one another in a way that it is possible to reconstruct the original waveform, complete with phased and non-phased waveforms.&lt;/p&gt;&lt;p&gt;For the purposes of the audio analysis performed by &lt;em&gt;Audicon&lt;/em&gt;, the deconstuction is a one-way process. Therefore it becomes necessary to simplify the Fourier transform deconstruction's data in such a way that it is able to be processed in an ad hoc manner.&lt;/p&gt;&lt;h2&gt;Audio "Featureset" Calculations&lt;/h2&gt;&lt;p&gt;Each audio file is broken down into &lt;code&gt;clip&lt;/code&gt;s of audio data (each adjacent &amp;frac12; of a second), along with a &lt;code&gt;texture&lt;/code&gt; buffer of audio data in which the &lt;code&gt;clip&lt;/code&gt; occurs (1 second before + the &lt;code&gt;clip&lt;/code&gt; + 1 second after = 2&amp;frac12; seconds) and sent through the following functions:&lt;/p&gt;&lt;h3&gt;Centroid&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;centroid frequency&lt;/code&gt; of an audio sample is basically the center of its &lt;strong&gt;spectral gravity&lt;/strong&gt;. Let me explain: If you had a waveform deconstruction from the Fourier transform, and you graphed it like so:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;      +----------+------- two equal parts&lt;br /&gt;      |          |&lt;br /&gt;   |-----||------------|&lt;br /&gt;  ^&lt;br /&gt; ^|&lt;br /&gt; ||        .&lt;br /&gt; ||       ||.&lt;br /&gt; a|      .|||&lt;br /&gt; m|      |||||.&lt;br /&gt; p| |  .||||||||.|. .|&lt;br /&gt;  +--------------------------&gt;&lt;br /&gt;  freq --&gt;&lt;/pre&gt;&lt;p&gt;then the center of spectral gravity would be between the two divisions you see at the top of the graph.&lt;/p&gt;&lt;p&gt;The centroid frequency is found by way of the following function:&lt;/p&gt;&lt;pre&gt;   F&lt;br /&gt;  ---&lt;br /&gt;  \&lt;br /&gt;   \ f * N[f]&lt;br /&gt;   /&lt;br /&gt;  /&lt;br /&gt;  ---&lt;br /&gt;   f&lt;br /&gt; -------------&lt;br /&gt;     F&lt;br /&gt;    ---&lt;br /&gt;    \&lt;br /&gt;     \ N[f]&lt;br /&gt;     /&lt;br /&gt;    /&lt;br /&gt;    ---&lt;br /&gt;     f&lt;/pre&gt;&lt;p&gt;where &lt;strong&gt;F&lt;/strong&gt; is the highest frequency bin, &lt;strong&gt;f&lt;/strong&gt; is the frequency and &lt;strong&gt;N[f]&lt;/strong&gt; is the unweighted amplitude of the frequency bin representing frequency &lt;em&gt;f&lt;/em&gt; as an output of the Fourier transform.&lt;/p&gt;&lt;h3&gt;Magnitude Ratio&lt;/h3&gt;&lt;p&gt;Remember the "texture" frame that was mentioned earlier? It comes into play here. Using the &lt;strong&gt;weighted&lt;/strong&gt; Fourier transform bins, the magnitude ratio is just the sum of all the magnitudes in the &lt;code&gt;clip&lt;/code&gt; divided by the sum of all the magnitudes in the &lt;code&gt;texture&lt;/code&gt; frame. Here's the characteristic function:&lt;/p&gt;&lt;pre&gt;       Fc&lt;br /&gt;      ---&lt;br /&gt;      \&lt;br /&gt;       \ fc * C[fc]&lt;br /&gt;       /&lt;br /&gt;      /&lt;br /&gt;      ---&lt;br /&gt;       fc&lt;br /&gt; M = -------------&lt;br /&gt;       Ft&lt;br /&gt;      ---&lt;br /&gt;      \&lt;br /&gt;       \ ft * T[ft]&lt;br /&gt;       /&lt;br /&gt;      /&lt;br /&gt;      ---&lt;br /&gt;       ft&lt;/pre&gt;&lt;p&gt;where &lt;strong&gt;Fc&lt;/strong&gt;, &lt;strong&gt;Ft&lt;/strong&gt; are the highest frequency bins for the clip and texture frame, &lt;strong&gt;fc&lt;/strong&gt; and &lt;strong&gt;ft&lt;/strong&gt; are their respective bins' frequencies and &lt;strong&gt;C[fc]&lt;/strong&gt; and &lt;strong&gt;T[ft]&lt;/strong&gt; are the respective unweighted amplitudes of the frequency bins representing frequencies &lt;em&gt;fc&lt;/em&gt; and &lt;em&gt;ft&lt;/em&gt; as an output of the Fourier transform.&lt;/p&gt;&lt;h3&gt;Spectral Flux&lt;/h3&gt;&lt;p&gt;The spectral flux is just a measure of how much the entire spectrum changes from one &lt;code&gt;clip&lt;/code&gt; of audio to to the next. It's a sum of the absolute value of the changes of each frequency bin. Here's the characteristic function:&lt;/p&gt;&lt;pre&gt;    F&lt;br /&gt;   ---&lt;br /&gt;   \&lt;br /&gt;    \  (N(t)[f] - N(t-1)[f])^2&lt;br /&gt;    /&lt;br /&gt;   /&lt;br /&gt;   ---&lt;br /&gt;    f&lt;/pre&gt;&lt;p&gt;where &lt;strong&gt;F&lt;/strong&gt; is the highest frequency bin, &lt;strong&gt;N(t)[f]&lt;/strong&gt; and &lt;strong&gt;N(t-1)[f]&lt;/strong&gt; are the unweighted amplitude of the Fourier transform bin representing frequency &lt;em&gt;f&lt;/em&gt; at the current frame &lt;strong&gt;t&lt;/strong&gt;, and previous frame # &lt;strong&gt;t-1&lt;/strong&gt;, respectively.&lt;/p&gt;&lt;h3&gt;Spectral Rolloff&lt;/h3&gt;&lt;p&gt;This is a measure of where the vast majority of the audio information ends. It's a point (in frequency) in the spectrum where the sum of all the bins before it equals 85% of the sum of all the bins in the spectrum. In effect, it's an expression of where (about) the spectrum begins to fall off.&lt;/p&gt;&lt;p&gt;It uses the weighted bins for this. In order to find this frequency, one needs to solve for &lt;strong&gt;f&lt;/strong&gt; in the following function:&lt;/p&gt;&lt;pre&gt;  R              N&lt;br /&gt; ---            ---&lt;br /&gt; \              \&lt;br /&gt;  \ M[f] &gt;= c *  \ M[f]&lt;br /&gt;  /              /&lt;br /&gt; /              /&lt;br /&gt; ---            ---&lt;br /&gt; f=1            f=1&lt;/pre&gt;&lt;p&gt;where &lt;strong&gt;M[f]&lt;/strong&gt; is the weighted amplitude of the FFT frequency bin corresponding to frequency &lt;em&gt;f&lt;/em&gt;, &lt;strong&gt;N&lt;/strong&gt; is equal to the total number of frequency bins and &lt;strong&gt;c&lt;/strong&gt; is the "concentration" value (in this case 0.85) from 0 to 1, representing the target concentration for the rolloff point.&lt;/p&gt;&lt;h3&gt;Zero Crossings&lt;/h3&gt;&lt;p&gt;This is relatively simple. It's the number of times the &lt;code&gt;clip&lt;/code&gt;'s waveform crosses the zero-axis. This is an effective measure of the "noisiness" of the signal. It doesn't even use the Fourier transform.&lt;/p&gt;&lt;p&gt;Here's the characteristic function:&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;    N&lt;br /&gt;   ---&lt;br /&gt;   \&lt;br /&gt;    \  | sign(x[n]) - sign(x[n-1]) |&lt;br /&gt;    /&lt;br /&gt;   /&lt;br /&gt;   ---&lt;br /&gt;    n&lt;br /&gt; --------------------------------------&lt;br /&gt;                  2 * H&lt;/pre&gt;&lt;p&gt;where &lt;strong&gt;x[n]&lt;/strong&gt; is the value of the sample at index &lt;strong&gt;n&lt;/strong&gt;, &lt;strong&gt;N&lt;/strong&gt; is the total number of samples in the signal, &lt;strong&gt;H&lt;/strong&gt; is the number of samples per second of signal (the &lt;em&gt;sampling rate&lt;/em&gt;), and &lt;strong&gt;sign()&lt;/strong&gt; is a pseudo-function such that &lt;strong&gt;sign(x) = x / |x|&lt;/strong&gt;.&lt;/p&gt;&lt;hr&gt;&lt;p&gt;Whoo! That's a lot to absorb in one sitting. Add to that the 96-output function described in &lt;a href="http://amphetamachine.blogspot.com/2009/02/damn-you-gsl.html"&gt;the previous post&lt;/a&gt; and you'll see why this has taken me so long.&lt;/p&gt;&lt;p&gt;&lt;em&gt;Next time:&lt;/em&gt; How to put all this crap together into something coherent.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/271299922229725193-1207427532624525813?l=amphetamachine.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amphetamachine.blogspot.com/feeds/1207427532624525813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=271299922229725193&amp;postID=1207427532624525813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/1207427532624525813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/1207427532624525813'/><link rel='alternate' type='text/html' href='http://amphetamachine.blogspot.com/2009/02/more-explanations.html' title='More Explanations'/><author><name>amphetamachine</name><uri>http://www.blogger.com/profile/01998997320430420232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_uy2XEuqOdiI/TQ716FlgfLI/AAAAAAAAAyY/9JxYda94BrY/s1600-R/44696_594703733640_184904792_34375024_2067605_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-271299922229725193.post-8759869722716376073</id><published>2009-02-06T12:40:00.000-06:00</published><updated>2009-03-02T16:01:52.649-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='audicon'/><title type='text'>Damn You, GSL!</title><content type='html'>&lt;p&gt;One part of this program I wrote is a calculator of respective loudness of the keys of, as a default and in the context of this program, a standard 88-key piano. It does this by maintaining a matrix of Gaussian normal curves in memory, which look something like this:&lt;/p&gt;&lt;div style="margin-left: 3em;"&gt;&lt;a href="http://picasaweb.google.com/lh/photo/gjCNBA9lge579v3rorwJgQ?authkey=m-T8Jal1-qU&amp;feat=embedwebsite"&gt;&lt;img src="http://lh3.ggpht.com/_uy2XEuqOdiI/SYyRbNnumHI/AAAAAAAAAd8/5JcUVtd_2Vs/s144/curves-middle_c-hires.png" /&gt;&lt;/a&gt;&lt;div style="font-size: smaller;font-style: oblique;"&gt;A representation of just the middle C octave. Note that in the actual program, the full spectrum of octaves is represented.&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Which it then multiplies by a 1-row matrix of the incoming amplitudes of the audio samples' frequency bin values from &lt;a href="http://search.cpan.org/~smueller/Math-FFTW-0.01/lib/Math/FFTW.pm" target="_blank" style="font-weight: bold;"&gt;Math::FFTW&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;This, in essence, works by taking the Y values of each key's curve and multiplying it the corresponding values in the FFT deconstruction, then summing the results.&lt;/p&gt;&lt;p&gt;Anyway, I'll get off of this digression and back to the problem at hand.&lt;/p&gt;&lt;p&gt;Any way you slice it, this whole process involves a LOT of matrix math between HUGE matrices, including constructing a lot of new matrices for a second, then multiplying them and returning the result.&lt;/p&gt;&lt;p&gt;At first I chose a simple and easy-to-use matrix math library, &lt;a href="http://search.cpan.org/%7Eleto/Math-MatrixReal-2.05/lib/Math/MatrixReal.pm" target="_blank" style="font-weight: bold;"&gt;Math::MatrixReal&lt;/a&gt;. This was a little slow to begin with, plus I had to code in a workaround for creating the aforementioned huge matrices, but it worked... But it was &lt;strong&gt;S-L-O-W.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I decided to switch to a C library that would hopefully get the job done faster. I found, much to my delight, &lt;a href="http://search.cpan.org/~leto/Math-GSL-0.16/lib/Math/GSL.pm" target="_blank"&gt;Math::GSL&lt;/a&gt;, which had a specific library for dealing with matrices at a very low level. It even had an extensive basic linear algebra system (BLAS) to do exactly what I had in mind, not to mention that it was the motherfucking Gnu Scientific Library I would be playing with. Yay!&lt;/p&gt;&lt;p&gt;After I switched, I noticed that when the program was processing audio samples, instead of using ~200 megs of memory, it was now using ~70 megs of memory.&lt;/p&gt;&lt;p&gt;All was not right, though. Now I was having a problem with my program. As it got further and further into processing the file, I noticed it took up more and more memory, eventually ballooning out to 2 gigs of memory once. This especially happened when I was processing multiple files at once.&lt;/p&gt;&lt;p&gt;Long story short, I figured out that it was the GSL matrices that were staying latent in memory long after the program's &lt;strong&gt;Math::GSL::Matrix&lt;/strong&gt; objects were destroyed. Luckily I found a way to solve it:&lt;/p&gt;&lt;span style="color: rgb(255, 255, 96);"&gt;&lt;b&gt;use &lt;/b&gt;&lt;/span&gt;Math::GSL::Matrix   &lt;span style="background-color: rgb(13, 13, 13);"&gt;&lt;span style="color: rgb(255, 160, 160);"&gt;qw/&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: rgb(13, 13, 13);"&gt;&lt;span style="color: rgb(255, 160, 160);"&gt; :all &lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: rgb(13, 13, 13);"&gt;&lt;span style="color: rgb(255, 160, 160);"&gt;/&lt;/span&gt;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 96);"&gt;&lt;b&gt;my&lt;/b&gt;&lt;/span&gt; &lt;span style="color: rgb(64, 255, 255);"&gt;$matrix&lt;/span&gt; = Math::GSL::Matrix-&amp;gt;&lt;span style="color: rgb(255, 255, 96);"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt;(&lt;span style="color: rgb(64, 255, 255);"&gt;$rows&lt;/span&gt;, &lt;span style="color: rgb(64, 255, 255);"&gt;$cols&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(128, 160, 255);"&gt;# ...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(128, 160, 255);"&gt;# clean up!&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(64, 255, 255);"&gt;&amp;amp;gsl_matrix_free&lt;/span&gt;(&lt;span style="color: rgb(64, 255, 255);"&gt;$matrix&lt;/span&gt;&lt;span style="color: rgb(64, 255, 255);"&gt;-&amp;gt;raw&lt;/span&gt;);&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now that I solved this problem, it should purr like a kitten.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/271299922229725193-8759869722716376073?l=amphetamachine.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amphetamachine.blogspot.com/feeds/8759869722716376073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=271299922229725193&amp;postID=8759869722716376073' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/8759869722716376073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/8759869722716376073'/><link rel='alternate' type='text/html' href='http://amphetamachine.blogspot.com/2009/02/damn-you-gsl.html' title='Damn You, GSL!'/><author><name>amphetamachine</name><uri>http://www.blogger.com/profile/01998997320430420232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_uy2XEuqOdiI/TQ716FlgfLI/AAAAAAAAAyY/9JxYda94BrY/s1600-R/44696_594703733640_184904792_34375024_2067605_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_uy2XEuqOdiI/SYyRbNnumHI/AAAAAAAAAd8/5JcUVtd_2Vs/s72-c/curves-middle_c-hires.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-271299922229725193.post-4699856347753424416</id><published>2009-02-05T12:10:00.000-06:00</published><updated>2009-02-05T12:46:30.948-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='audicon'/><title type='text'></title><content type='html'>&lt;p&gt;And so it begins. After two years of sitting in the dusty corners of my hard drive, I have started&amp;mdash;after being inspired by my newfound unemployment&amp;mdash;to take up the old reins on programming my automatic musical genre classification program, &lt;strong&gt;Audicon&lt;/strong&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;While the vast majority of the reasons I originally gave up on it were due to forgetting the old axiom:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;The most important early product on the way to developing a good product is an imperfect version.&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;In essence, I had too many ideas about how to improve the existing code, whether by exhaustively/obsessively searching for a better way to write a small portion of it, or, in the case of the entire project, getting fed up with the limited syntax of &lt;a href="http://www.scilab.org/" target="_blank"&gt;Scilab's&lt;/a&gt; programming language and opting to write it in a language I &lt;em&gt;knew&lt;/em&gt; could do the job with style (i.e. &lt;a href="http://www.perl.com/" target="_blank"&gt;Perl&lt;/a&gt;).&lt;/p&gt;&lt;br /&gt;&lt;p&gt;More details on now this thing works to come...&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/271299922229725193-4699856347753424416?l=amphetamachine.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amphetamachine.blogspot.com/feeds/4699856347753424416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=271299922229725193&amp;postID=4699856347753424416' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/4699856347753424416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/271299922229725193/posts/default/4699856347753424416'/><link rel='alternate' type='text/html' href='http://amphetamachine.blogspot.com/2009/02/and-so-it-begins.html' title=''/><author><name>amphetamachine</name><uri>http://www.blogger.com/profile/01998997320430420232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_uy2XEuqOdiI/TQ716FlgfLI/AAAAAAAAAyY/9JxYda94BrY/s1600-R/44696_594703733640_184904792_34375024_2067605_n.jpg'/></author><thr:total>0</thr:total></entry></feed>
