Compiling SuperCollider on Ubuntu Studio 3.04 beta 2 (and otherwise setting up audio stuff)

The list of required libraries has changed somewhat from different versions. This is what I did:

sudo apt-get install git cmake libsndfile1-dev libfftw3-dev  build-essential  libqt4-dev libqtwebkit-dev libasound2-dev libavahi-client-dev libicu-dev libreadline6-dev libxt-dev pkg-config subversion libcwiid1 libjack-jackd2-dev emacs gnome-alsamixer  libbluetooth-dev libcwiid-dev netatalk

git clone --recursive https://github.com/supercollider/supercollider.git

cd supercollider

mkdir build

cd build

cmake ..

make

If all that worked, then you should install it:

sudo make install

scide

If it starts, you’re all good!
Users may note that this version of Ubuntu Studio can compile in Supernova support, so that’s very exciting.
I’ve gone to a beta version of Ubuntu Studio because Jack was giving me a bit of trouble on my previous install, so we’ll see if this sorts it out.
Note in the apt-get part that emacs is extremely optional and netatalk allows me to mount apple mac file systems that are shared via apple talks, something I need to do with my laptop ensemble, but which not everyone will need. Gone-alsamixer is also optional and is a gnome app. It’s a gui mixer application which lets you set levels on your sound card. Mine was sending the ins straight to the outs, which is not what I wanted, so I could fix it this way or by writing and running a script. Being lazy, I thought the GUI would be a bit easier. There’s also a command line terminal application called alsamixer, if you like that retro 80’s computing feeling.
It can also be handy to sometimes kill pulse audio without it respawning over and over. Fortunately, it’s possible to do this:

sudo gedit /etc/pulse/client.conf

Add in these two lines:

autospawn = no
daemon-binary = /bin/true

I still want pulse to start by default when I login, though, so I’ve set it to start automatically. I found the application called Startup Applications and clicked add. For the name, I put pulseaudio. for the command, I put:

pulseaudio --start

Then I clicked the add button on that dialog screen and it’s added. When I want to kill pulseaudio, I will open a terminal and type:

pulseaudio --kill

and when I want it back again, I’ll type:

pulseaudio --start

(I have not yet had a killing and a restarting throw any of my applications into silent confusion, but I’m sure it will happen at some point.)
There’s more on this

Using Perl to Deal With Google Forms

This post is meant to be useful for people who have not previously used perl, as well as a reminder for more experienced folks.
Let’s suppose you were, say, trying to run an event and had asked people to submit proposals for workshops. Let’s say further you had not installed software to manage this, but had instead created a Google Form.
(Why would you do this? Unlike your ISP, they’re ‘free’ (in exchange for your data/ soul). They’re robust. They’re easy.)
At the end of your call, you have a spreadsheet full of entries. Yay! Ok, now what? That’s hard to read. Let’s output them as individual HTML files.
Ok, the next thing you’re going to want is a unique ID for each submission. The timestamp might work, but let’s say you decided to go through and add a column on the end called Unique ID and then hand typed sequential numbers through the whole spread sheet. (Please leave you better ways of handling this in the comments!)
The next step is to download your speadsheet in CSV format. This is a comma separated format that databases and spreadsheets use for information exchange. Let’s say you’ve saved your file as workshop.csv and your perl script is going to be saved to the save directory.

CPAN

You’re going to need to get some modules from CPAN. If, like me, you wandered away form perl for the last several years, this is a new but fantastic development. Google for more information. At the top of the file, when you see lines that look like “use Foo::Bar” or “require Baz::Bat”, Foo::Bar and Baz::Bat are the names of cpan modules you will need to install.
First of all, make sure you have CPAN installed.
Next, install a module that will make installing the next modules easier. Type: ‘sudo cpan App::cpanminus’ (without the quotes). Omit the ‘sudo’ is you don’t have root or administrative privileges on your computer (or you don’t know what those are) or if you’re on windows.
Then install the cpan modules that you’ll need:
sudo cpan Text::CSV::Encoded
sudo cpan HTML::Entities
sudo cpan URI::Find::Schemeless

Reading the csv file

The whole script is included below, but this is some of the part you’re going to need to change.
Let’s say this is what your spreadsheet headers look like:

Timestamp Your name Contact email Link to your website Experience level required to participate in workshop Proposed workshop duration Outline of the workshop aims and content Biography Required Resources. Unique ID

Ok, so how the script is going to work is that we’re going to go submission by submission, reading the database and outputting an HTML file. Each of those table columns has a different piece of data for each submission. Let’s save them in variables. We can start by declaring them, and then by using them.

my ($time, $name, $email, $website, $experience, $duration, $outline, $biography
    $resources, $id);

In Perl, variable names for regular variables (scalar variables) start with $. In that line, we’ve named all the variables we’re going to use to read database data.
Ok, we’re reading the csv file in a loop. The loop takes a submission from a file and puts it into an array. The array indexes start with 0. We’re going to read from the array into our variables. That will look like this:

$time = $fileds[0];
$name = $fields[1];
$email = fields [2];
$website = $fields[3];
...

If we carry on, we’ll get all of the database fields.

Formatting Our Data

But we don’t just want to read them in, we want them to format correctly for HTML. There are some subroutines declared at the top of the file. Those subroutines do a few things: One prepares special characters (like accents) to be encoded properly into HTML and they look for things that look like URLS and convert them into links. Another breaks up paragraphs properly. The third one helps out the other two.
Which one we use depends on how we’re going to present the data. For example, we might use the name as a header, not as a paragraph, so we would just use the encoding/link finding one for that. But the biography is likely to be a paragraph or two, so for that one, we want to break up the paragraphs properly. The encoding/link finding subroutine is called ‘prepare_str’ and the paragraph finding one is called ‘htmlify’. You will only ever need to use one of these for any variable.
Let’s change our above example so that in addition to reading from the csv file, we also prepare the data correctly for output:

$name = prepare_str($fields[1]);
...
$biography = htmlify($fields[7]);
...

Which of those routines you pick has to do with whether the data coming in is broken into paragraphs.

Outputting your HTML file

open FILE, ">$id.html" or next;

I’ve decided to just name the files after the unique id. Since this is different for every entry, I don’t need to worry about accidentally trying to create two files with the same name. (If I tried to use the submitter’s name to create the files, I’d need to first check if a file with that name already existed, in case the same person had made multiple submissions).
In perl, you can put your variables right inside a string and it will substitute appropriately. If the submission has the id 666, then the script will translate from “$id.html” to “666.html”.
Perl has a nifty feature that lets you output multiple lines of of text to a file from right in the program. You don’t need to worry about watching out for special characters like quotes, and you can put your variables directly into the string. However, this does mean that if you want to output a $ or a @ you’ll need to type in $ and @ for them.

     print FILE <<END;

That starts the longer text section. It continues until it gets to a line that looks like:

END

Let’s say we just want to print out a header, the person’s name and their biography. We’ll use their name as a section heading. That would look like:

     print FILE <<END;
<html>
<body>
<h1>$name</h1>
$biography
</body>
</html>
END

You could stick in that section anything else you might want to stick in your html file, including style sheet stuff, extra text, extra links, whatever you want.

The Whole Script

#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV::Encoded;
use HTML::Entities;
require URI::Find::Schemeless;

my ($file, $csv, @fields, $io, $row, $output);
my ($id, $name, $email, $website, $experience, $duration, $outline, $bio, $tech);

$file = 'workshop.csv';

sub makelink
{
my $str;
($str) = @_;
chomp($str);
if ($str !~ /^http/i) {
$str = "<a href="http://$str">$str</a>";
} else {
$str = "<a href="$str">$str</a>";
}
return $str;
}

sub htmlify
{
my $str;
($str) = @_;
chomp($str);
$str = prepare_str($str);

$str = "<p>$str</p>";
$str =~ s/n/</p>n<p>/g;
return $str;
}

sub prepare_str
{
my ($str, $finder);
($str) = @_;
chomp($str);

$str = encode_entities($str);

$finder = URI::Find::Schemeless->new(&makelink);
$finder->find($str);

return $str;
}

$csv = Text::CSV::Encoded->new({encoding => undef, binary =>1, eol => $/ });

open $io, "

How to do page numbers and a table of contents in NeoOffice

This may also apply to Open Office.
Go to the format menu and select styles and formatting. a window or something will come up. one of the tabs on it is for page types. Duplicate the default type and call it something else. Then, go to the start of your document at the very top of the page and under insert, select manual break. A window will open that will have a drop down menu of the page types. Change it from [none] to the page type you just created. At the bottom of the window, in the second little box from the left, it lists page type. so when you’re on your new blank page, it should say default and when you go to the second page, it should say the name of your new type of page.
Next, go to the first page of your text and go to the insert menu and select footer and it will have next to that your two page types. Check the one that describes the main body of your text. It will hopefully make you a footer, which it will then stick your cursor in. then under the insert menu, go to fields and the page number. The popup will have something asking about style, make sure it’s set to 1 2 3, etc. and it will have something about starting with a specific page number. set that to 1.
Then go back to that first empty, still blank page and insert two manual breaks so you have three blank pages at the start of your document. Go the middle of those pages and go to the insert menu and then select indexes and tables and then indexes and tables and then table of contents
You’re nearly there. Go back to the styles and formatting window and go to the paragraph styles tag. Right click on the one called heading1 and select modify. It will give you a window asking about spacing, fonts, etc. Set it to look like every heading you’ve used for your chapter titles. If they’re 14 point centred times new roman, then make it like that. then go to heading2 and modify it so it looks like your subheadings you’ve used for chapter sections and keep doing this for all the heading levels you’ve used.
Now, lastly, go through your text and highlight all your headings. So at the starts of chapter 1, highlight your title “why i’m awesome” (or whatever you called it) and then, in the styles and formatting window, double click on the heading 1. This will switch that title to have the heading 1 formatting, which, if you did it right, will look the same as it did before. Then go to your subheading and select it and double click on heading2 in the styles and formatting window. Go through your entire document changing your heading to use the heading1, heading2, etc. When you’ve got everything, go back up to your table of contents page and right click on the table of contents. A menu will pop up and one of the options will be to update the table of contents. Do that and it should list all fo your headings and subheadings. If you’re missing some of them, then you forgot to change it in the document.
And of course, the best way to do this is to use the headings and stuff from when you first start writing your document, so keep that in mind for next time.

Semaphores are awesomesauce

Imagine, if you will, that you are a programmer and somebody has asked you to write an application that counts cars in intersections. You have webcams mounted on top of the traffic lights and it sends you a message when it sees a car. You have saved somewhere a count of all the cars so far. So, when it tells you it sees a car, you go find that number, add one to it and write down the new number. There is more than one camera in the intersections, though and while some cars are travelling north, others are travelling south at the same time. What if two cameras see different cars at the same time?

  1. Camera one sees a car and the programme listening to it goes and finds the count of cars so far, which is 75.
  2. Camera two sees a car and the programme listening to it goes and finds the count of cars so far, which is 75.
  3. Camera one’s programme adds one to the total and gets 76.
  4. Camera two’s programme adds one to the total and gets 76.
  5. Camera one’s programme saves it’s new total.
  6. Camera two’s programme saves it’s new total.
  7. You go to look how many cars have been through the intersection and the number recorded is 76.

Camera one and camera two are operating separately from each other at the same time. They are sperate threads. when two of them are trying to change the same resource at the same time, you get something called a race condition. Will the first thread finish before the second thread clobbers it’s changes? The race is on!
Fortunately, there is a solution to this problem: semaphores! Lets’ say you are trying to update your traffic count with SuperCollider:

(
 var traffic_count, camera1, camera2, semaphore, action;

 traffic_count = 0;
 semaphore = Semaphore.new(1);

 camera1 = TrafficCounterCamera(north);
 camera2 = TrafficCounterCamera(south);

 action = { // this will be called when a car is seen
  Task({
   semaphore.wait; // only one thread can get past this point at a time
   traffic_count = traffic_count +1;
   semaphore.signal; // relinquish control of the semaphore
   traffic_count.postln;
  }).play;
 };

 camera1.action = action;
 camera2.action = action;
)

You need to make a new Semaphore before you use it. By default, they allow one thread through at a time, but you can change the argument to 2 or 3 or whatever number you want.
When your code encounters a semaphore.wait, the thread will pause and wait until it’s turn to procede. Only one thread will be allowed past that line at a time. If both cameras update at the exact same time, one of them will have to wait until the other says it’s good to go ahead.
semaphore.signal is how that thread says it’s good to go ahead. The code in between those lines can only be accessed by a single thread at a time. the traffic_count.postln line is outside the seamphore because it’s not making a change to anything, so it’s safe to read it outside of the semaphore.
So when you have two seperate threads trying to change something at the same time, semaphors can help you out! This sort of situation can arrive with GUI objects, or with OSC messages, HID objects or anything with an action method.
Be thread-safe!

Ardour: Copying Gain Envelopes

Ok, let’s say you’ve got a project in Ardour and you’ve carefully drawn a bunch of gain changes using the Draw Gain Automation tool – which is one of the buttons on the upper left. You listen to your project and are forced to conclude that one of your tracks needs to be re-recorded or re-rendered. Alas and woe! However, there is a way to get your automation points onto the new track. Alas, it’s a bit tricky.
One of the great advantages of Ardour over other DAWs is that you can actually figure out what’s going on with the data files. If you open up a ProTools project in a text editor, you get gibberish, but if you open up a .ardour file, you get a human-readable XML file. I bring this up because you cannot select your gain change points in the Ardour GUI and move them to a new track. But you can move them if you’re willing to modify your .ardour file. Here’s how:

  1. Make a backup of the file in case something goes wrong.
  2. Open the file in the text editor of your choice – ideally one that you might use to write code
  3. Your tracks have names. Let’s say the track you want to copy is called “SourceTrack.” Search in the .ardour file for “SourceTrack.” You’ll find it many times, but one of those times, will have an XML node called <Envelope> a couple of lines below.
  4. Copy everything starting at <Envelope> and ending at </Envelope&gt, including those two lines.
  5. Ok, let’s say the track you want to copy to is called “DestinationTrack.” Search for that. If you drew some gain automation points on it already, look for the <Envelope> below it. If you have not drawn any gain automation, then look for <Envelope default=”yes”/>
  6. Blow away the <Envelope default=”yes”/> or the pre-existing envelope with the code you copied.
  7. The length of the envelope must match the length of the region. You can find the region’s length 2 or 3 lines above the envelope. It will say “length=” and then a number. Get that number and copy it.
  8. The envelope values are pairs of durations and amplitudes. If the length of DestinationTrack is longer than SoureTrack, then add a point at the end with the length you just copied. If it’s shorter, remove points with durations past the length you just copied. Then add a point with the length you copied.
  9. Scroll up to the very top of the file. The second line will end with “id-counter=” and then a number. Copy that number.
  10. Now replace the the number at id-counter with the number you copied +1. If you copied “123,” then replace it with “124.”
  11. Scroll back down to the envelop your just added to DestinationTrack. It has a property “id=” and then a number. Replace the number there with the one you copied from the top of the file. If the one at the top of the file was “123,” then you should have “id=123” in the Envelope of DestinationTrack and “id-counter=124” at the top of the file.
  12. Save the file and then open it with Ardour to see if it worked.

Well, it’s easier than re-drawing every point, but it’s still a bit of a pain. If you think you might end up wanting to cut and paste automations, then you can start by using tha gain automation track instead of drawing gain enveloped directly on top of the audio. Click the ‘a’ button to show automation tracks. I prefer to draw directly over the waveform so I can really see what’s going on, but I must admit that transferring the points is a real pain.
Thanks to las, who was in the IRC channel on freenode and was able to tell me how to do this.

Boycotting

I can see from my facebook newsfeed that a lot of my USian friends are boycotting BP. BP ignored a lot of safety stuff, had a history of infractions and there’s been a huge disaster as a result. This kind of reminds me of the previous, then-largest spill in US history, when the Exxon Valdez crashed in Alaska. They also failed to follow safety regulations or best practices. Their filed statement about what to do in case of spill was similarly bogus (it assumed that all spills would take place in perfect weather on the summer solstice). Angry consumers also wanted to launch a boycott.
It turns out that it’s really hard to boycott oil from any particular refinery or source. Oil is fungible and the gas station closest to your house might have a particular brand on it, but they’re probably selling oil from many different refineries, including competitors. If nobody wants to buy BP gas at the BP station, the price of that gas will fall and Shell will buy it and start selling it from their own stations. You can hurt BP’s retail brand, but you can’t touch their refineries and wells unless you cut your overall gas consumption.
I’m not going to talk about car travel, because that’s too obvious. But we heat our houses with natural gas or diesel fuel, which is also a petroleum product. We heat our water with natural gas. Taking shorter or cooler showers is a way to stop throwing so much money at BP.
Also, we can be secondary consumers of petroleum. If I buy produce that’s flown on an airplane, I’m paying for the jet fuel that brought it to me. So to keep money form BP, I could try to buy more locally grown produce. I could try to get local stuff in general, or just buy less stuff, and thus give less money to BP.
Plastic is a petroleum product. Reusable shopping bags and reusable water bottles will keep money from BP.
A lot of electricity is generated from natural gas (including some which comes from plants that are supposed to be solar. They make up for cloudy days with gas), so turning stuff of at night, etc keep money from BP.
Now, obviously, because oil is fungible, these same steps keep money from other oil companies too. But, really, every oil company is up to no good someplace in the world. Shell is not currently causing problems in the US, but they’re doing all kind of bad things in Africa. Exxon (now branded Valero) hasn’t spilled anything in the US recently, but the Alaskan coast still hasn’t recovered – and neither have the workers who tried to clean up the spill without being provided proper safety equipment. Basically, there’s no such thing as a good oil company. And BP is the one that’s currently causing problems in the US, but every oil company is causing problems for somebody somewhere. Oil is dirty and toxic and often under places of great natural beauty or places where people inconveniently live (but can be removed from with armed violence). Countries that we might not want to be best buddies with sell us a lot of oil. And burning it causes stronger hurricanes and will eventually melt the world’s coral reefs.
So boycotting BP is a good start, but if we want to get serious about this and ensure real change that prevents stuff like this from happening in the future, we need to think bigger. Many countries require relief wells to be drilled at the same time as regular wells. Congress could pass a law requiring that if we ask them to. They could legislate that best practices be followed. And the US uses more petroleum per person than any other country – totalling a quarter of the world’s oil. That makes us vulnerable to spills and foreign powers. BP is just a tiny piece of a much larger problem that spans an entire industry and the way our lives are organised. If we want to fight them, we need to stop requiring so much of what they sell.

Freenet

This the latest on my series on how to use the internet without government interference – now a pressing issue in the UK, China and Australia and probably coming soon to a country near you.

What is Freenet?

Freenet is is free software which lets you anonymously share files, browse and publish “freesites” (web sites accessible only through Freenet) and chat on forums, without fear of censorship.
It is a proper dark cloud. If you want to share material online and you don’t want to be identifiable as the source, this is the software for you.
You would want to use this if you were a member of an outlawed opposition political party or if you wanted to post other material that might get you in trouble because it’s against censorship laws. This frees you from having to rely on foreign servers who might comply with requests from your government to remove material or reveal your identity. There s no takedown order on Freenet.
You can also use freenet as a way to share data with friends and collaborators without the source of that data being easily traceable. And it offers peer-to-peer website hosting – so it scales automatically to meet demand. Which, oddly, means it’s free web hosting.
If some of this seems dodgy, remember that you should have a right to anonymity and know also, that Google has decided to fund some development on the project, which could be taken to further confirm that it’s a an entirely legit use of the internet.
Note that running a node helps out others who are using the project, even if you’re not actively using it yourself.

How to use it

I’m on a mac, so I can write up what I did. They have windows documentation on their website as well as general documentation.
First, I downloaded the installer. Then I ran it. After it installed, it opened in my web browser and then told me I should use a second web browser to connect. I normally use Chrome, but for my second browser, I use Camino because it’s lightweight, but configurable. However, I need to remember to clear the cache when I’m done.
There are some questions, I went with the defaults and with “normal.” Then I got to the home page, which is at http://127.0.0.1:8888/. This page is on my own computer. At the bottom are buttons to shut down the freenet application which is also running on my computer or to restart it.
If you have shut down freenet (or rebooted) and want to start it again, go to the freenet folder and run StartFreenet.command by double click on it. That should work.
Ok, so when I got to the home page I clicked on the Ultimate FreeNet Index. And I noticed that it’s slow. And also, the content looks very 1999 (the simplicity makes it load faster) and it’s a teeny bit dull.
Alas, well, defeating censorship isn’t always glamorous. If you want this to be more secure (and to share interesting content with people you know), you should find your friends on here. You would add them at http://127.0.0.1:8888/addfriends/. At the bottom of that page is your reference link. Share that (securely!) with your friends and they would put it in the box above. There’s some documentation on how to do that on this page.
Once you have friends on it, you can send them messages and files securely, from the friends page, so it’s good for just trading stuff around. Check it out. If you want to be my friend, let me know. It’s not exactly social networking, but it’s still cool.

How to run Tor – the short version

Windows Users

  1. Download Tor
  2. Install it
  3. Install Torbutton
  4. Configure it to be a relay

Mac Users

  1. Download Tor
  2. Install it
  3. Install Torbutton
  4. Configure it to be a relay

Why

  • It protects you from your ISP or government spying on your data.
  • It allows other people to get around national firewalls, like the one in China or the one the UK is about to build
  • It promotes free speech and access to information in oppressed areas

Read more . . .

The Digital Economy Bill and Tor

The DEB is a soon to be new law and will be a very bad thing in the UK, but it just passed the House of Commons with virtually no debate. Explaining what it’s all about is a bit beyond me, so just click the link to read what it says, then come back here.
There’s two parts of it that seem especially troubling. One is that it seems to mandate the construction of a national firewall in the manner of the Great Firewall of China, in order to prevent people from breaking copyright. Of course, kiddiepron will also get on the list posthaste. And then terrorism. And then. And then. And then. Since the Apple iTunes store is incredibly profitable, the internet is clearly not destroying the ability of copyright holders to make money. Indeed, I do not believe that copyright is as much a motivator as is blocking access to websites such as wikileaks. That’s the website that has the leaked video of American troops killing a milling group of civilians and Reuters reporters. They leak incriminating documents from governments and corporations. Of course, the internal memos of corporations ordering baby seals to be clubbed to death or whatever are all copyrighted and certainly posted without permission. The US government has been actively trying to figure out how to shut down the site [PDF]. Brits just won’t be allowed to look at it.
The other troubling bit is the provision that people accused of doing forbidden things, like downloading the Colbert Report from bittorrent, will have their internet access cut off. This is at the same time that UK government services are increasingly moving online. Get your net cut off, and you cannot access government services. Is this really the appropriate punishment for a copyright violation? Note also that there’s no trial, no defence, just accusations. So if they get confused and think that your legal Creative Commons music might be a copyright violation, you get cut off whether you violated copyright or not.
Cafés and other locations will be unable to provide free wireless because they’d get cut off for having naughty patrons. Indeed, the era of free public wifi has probably just been legislated away. T-Mobile can still charge you for access, because they know who you are, but the café down the street can’t do that. The fact that this makes it much more expensive for people to get online is great for internet companies and crap for everybody else, especially people with limited resources.
The question that I have is how anybody would even know what you were doing with your internet connection anyway. There are two answers that I can think of: One is that media companies might put up “bait” files on firesharing services and watch who downloads them. The other, frankly more likely, method is for ISPs to spy on data. And if they can spy looking for people breaking copyright, they can also look for peadophiles and terrorists and anybody who is doing anything remotely unusual and you think you’ll be ok because you’re a politically centrist white middle class native-born citizen who never pirates anything, but maybe your kids do, or your computer caught a virus which caused it to do something naughty without your knowing about it or maybe you are just mistaken accused – you have no opportunity to defend yourself.

Tor

There are some programmes that can help. In this post, I’ll talk about Tor, which you should run. Go download it. It doesn’t matter what country you’re in, running Tor is a public service. This program routes network traffic around in funny ways (via peer to peer) so that somebody looking at your network traffic can’t tell what you’re doing. Also, if you live in a place like China (or soon to be the UK) it will find a way for you to get to the site you want. It defeats this kind of firewall.
How it works is that when a user tries to look at a webpage, they don’t connect to that webpage directly. Instead, they ask the Tor network for the web page. The request goes from person to person in the Tor network until it gets to somebody running an exit node. The exit node then asks for the page and sends the data back through the Tor network, from person to person, until it gets to the user. The users in between are helping the end user maintain their privacy. This can help bloggers in China, people who want freedom in Iran and other people engaging in prohibited political speech. Alas, it also helps people who are actually up to no good. But, I mean, you don’t want the post office to open and read everybody’s mail. You don’t want the government to know about every single movie you watch. Privacy protects good guys and it protects bad guys and it protects people who just want to quietly live their lives without intrusion.
Perhaps you, dear reader, live in some place with a government that respects your privacy. Good for you! You can help out people in other countries by running a Tor node, even if you don’t use it yourself. I’ve been doing this for years. I don’t notice the loss of bandwidth and I hope that I’m helping somebody in a repressive country get access to information. The major downside of Tor is that it’s kind of slow. But more nodes makes it run faster. And more exit nodes are a good thing. I just took mine down because I don’t want to get my access turned off due to the DEB, but if you live in the States or someplace that has due process of law, you should run an exit node. That’s the point at which traffic leaves the Tor network and goes to the regular network. So if somebody in China wants to read this very blog post (which is blocked there), an exit node in Texas might go ask blogspot.com for this page.

Installing and Configuring Tor

I use a Mac, but it should be similar on other systems. First, download it. Open the disk image and drag the Vidalia application to the /Applications folder. Don’t put it anyplace else. Then open it. A window will open. Click the icon that says “Set up Relaying.” A new window will open. It has tabs on it. You want to be on the “Sharing” tab. There are three options there. If you want to run an exit node, pick either “Relay traffic for the Tor network” or “Help censored users reach the Tor network.” If you do not wish to run an exit node, pick “Relay traffic for the Tor network.”
Some new tabs will open. First click on “Bandwidth Limits.” How fast is your internet connection? Pick something that seems right. Then click on the “Exit Policies” tab. If you do not wish to run an exit node, uncheck every box. Those boxes are the sort of data you’re allowing to exit, so if you have “Websites” checked, people who are looking for this blog post might exit from you. If you have “Instant Messaging (IM)” checked, people who are chatting on AIM or whatever might have their data getting onto AIM from you.
If you are running an exit node and somebody does something naughty and your country respects the rule of law, they cannot prove that it was you that asked for the naughty data, so you ought to be ok. I’ve been running an exit node for the last three years with no problems at all. Most traffic going through Tor is entirely innocent.
Now set Tor to start up automatically when you log in. You can do this by right clicking on the icon in the dock. On my mac, you put down two fingers on the trackpad, as if you were scrolling, and then click on it. A menu pops up. Go to opens and then Open at login. If you don’t have the two-fingers-means-right-click thing, I’m not sure how you do this. Somebody leave a comment?
You may also wish to install Torbutton for Firefox, something which is covered in the next section.

Using Tor

One way to make the Tor network more secure is to put a lot of traffic on it. If the only stuff that’s going by on it is stuff that people want to hide, then it’s somewhat easier for governments to figure out who has something to hide. So it’s for the best if a bunch of mundane stuff goes by. Boring stuff that nobody would ever want to snoop on. Then the really snoop-worthy stuff (like this very blog post in some countries) can get through undetected. However, the thing about bouncing traffic around from node to node is that it’s slow. Try it out and see if you want to deal with the slowness.
The easiest way to turn your own use of it on and off is through Tor button. There’s a script in the install package/ on the disk image called “Install Torbutton for Firefox.” If you have firefox this is very easy. Just install it and then you get a little bit of text on the lower right hand corner of the browser window. When it’s red and says “Tor Disabled”, you are browsing the web in the normal way – not through the Tor network. Your relay is still running. If you want to use Tor to browse the web and do other things, click on that text. It will turn green and say “Tor Enabled.” Your network traffic is now going through Tor. Try connecting to www.google.com. It will load the Google web page for whatever country your exit node is in. I just got German Google. Try searching for something and then clicking one of the links. You may notice that it’s slower than you’re used to. If you decide it’s too slow, just click on the green “Tor Enabled” text to turn it back off and browse the web normally. Your Tor node will still be running and helping other people, you just won’t be using it yourself.
During the time that you have enabled Tor with firefox, it’s enabled for all web browsing on your system. That means that if you enable Tor with firefox and then use the Chrome web browser, you will still be going through Tor. You can use firefox to turn Tor on, then quit firefox and it will still be on. If you want to turn it off, you can re-start firefox and click the green text in the lower right hand corner, or you can reboot your computer.

Using Camino as your stealth browser

Ideally, it would be cool if you could have one browser program that used it and another that didn’t, so you could use one for things that you want private or don’t mind slowness and the other for things you want to go faster. If you are a new user or are not a geek, you may wish stop reading now. Otherwise, this is how I got Camino to be my Tor browser while leaving other browsers untouched. Camino doesn’t have a pron mode, but it’s an ok browser for this – it’s more lightweight than firefox but fairly configurable.
When I opened the preferences for Vidalia, under general, there is a section on proxies. The proxy it lists is not privoxy, which is the one that is/was used by Tor button, but is something called polipo. On my system, it did not actually start because the conf file listed there conflicts with privoxy, which runs on port 8118. Polpio’s conf file tells it to run on that port, but the normal default port for polpio is 8123. I changed the conf file to reflect this and the polpio now starts for me. If this isn’t a problem for you, don’t change this.
Camino can be configured to use different proxy settings than the rest of the system. By opening the hidden preferences , which you do by typing “about:config” in the address bar. The settings in the link above did not fuly work for me, but I found a very helpful document elsewhere. I’ve got:
camino.use_system_proxy_settings set to false. network.proxy.autoconfig_url is set to http://127.0.0.1:8123/ . network.proxy.http is set to 127.0.0.1 and network.proxy.http is set to 8123. network.proxy.type is set to 1. Probably all the network.proxy.* and and network.proxy.*_port should be set to 127.0.0.1 and 8123 (or 8118 if you did not change the port for polpio), except for SOCKS which should be set to port 9050. For more information on web browsers, see here and to read more about Tor on OS X, look at this page.

How To Data Bend

I got email asking me how to do data bending for audio. (If you want to know how to do it with images, check out Hello Catfood’s posts.) Databending means taking one kind of data and using it as another kind of data. For example, playing an image file as a sound. Or processing an audio file with an image program and then returning it to it’s audio format. This post will focus on how to open non-audio files as if they were audio.
There are two different programs I’ve used for databending. One is Sound Hack, which is free, but mac-only and the other is Audacity, which is also free and cross-platform. For mac users, I suggest running 1.2.6 instead of the beta version.

Data Files

Opening data files with either Sound Hack or Audacity is easy. A data file is a file used by an application, for example a text file created by Word or Open Office or an image file or anything you might find in your Documents folder. With Sound Hack, under the File menu, select “Open Any” and pick a file. The go to the Hack menu and select “Header Change.” You can try a few different headers and listen to them until you pick one that you like. Once you’ve found a good one, go to the File menu and select “Save a Copy.” That will open a new dialog. At the top is the file name. Add a “.aiff” (without the quotes) to the end of the file name, no matter what you decide to name it. At the bottom, make sure to set the Format to “Audio IFF” and the Encoding to “16 bit linear.” I’ve found that Sound Hack does not save reliably into other formats.
To open a data file with Audacity, under the Project menu, select “Import Raw Data.” Pick the file you want to open. A dialog will pop up asking what header you want. I usually go with the default values, but you can try playing around with that. You can then modify the file with Audacity, using the Effects or whatever. When you think you’re done, first go to Preferences and then go to the File Format tab. Make sure that the format you want (Aiff, WAV, etc) is selected. Then, go to the File menu and “Export As” that file type.

Applications

You can also open applications as audio, but this is a bit weird on the mac. Go to the finder and find the application you want to open. Control-click on it. (by holding down the control key as you click). In the menu that pops up, select, “Show Package Contents” A new window should open with a folder in it called Contents. Open that folder, and you should find some stuff in it including a subfolder called MacOS. In that folder, you’ll find, probably, a file with the same name as the program. Like in Garage Band, under Contents/MacOS/ there’s a file called GarageBand and two other files, all of which may be interesting. Control-click on the file and select “Open With”. Then select “Other . . .”. A new dialog will open. In the Bottom part of the window, change the menu from “Recommended Applications” to “All Applications”. (Do NOT check the box under that!) Then find Audacity or Sound Hack, select it and click the Open button. If you use Sound Hack, you can try out different headers, by doing a Header Change under the Hack menu. Save these files is the same as described above.

Examples

I haven’t used this technique for years, but if you’re searching for examples of how it sounds, I’ve got some pieces. My supervisor, Scott Wilson, also uses this on his CD Muellmusik, in the track Photo Shopped Music. Other examples abound. You’ll find that if you do this a bit, you’ll not only be able to recognize other people doing it, but also sometimes be able to recognize what kind of file they’re using. Stochastic Synthesis also sounds quite a lot like data bending.