The purpose of this course is to show you how to
-- well, "show" I'm not sure is the right word --
is to enable you to make your own computer music applications, in the sense of designing electronic music instruments.
What that means, in a sense, is making your computer do what
a guitar or a drum set does when you do things to it,
so that the thing is running in real time.
It's making sound
and you walk up to it and do things to it,
and that changes the sound that it makes.
For instance, it might be silent until you start doing something and then it starts making noise.
Then you've got an instrument that does something that responds to how you're trying to get it to do things.
So this is a particular..
This thing, this idea of using computers to make computer music instruments is,
in some sense, sort of the trunk of the whole field of computer music, at least the way I see it.
Computer music grew out of, or maybe it's a part of,
the field which could be called electronic music, which started, depending on how you think of it, maybe in
the late 1800s -- maybe in 1948 when the first tape recorder music started getting made.
Well, you could put other kinds of dates on it.
And the whole field of electronic music is basically people inventing ways of making music with electronic gear
as opposed to acoustic instruments.
It wasn't obvious, at first, when computers showed up on the scene that computers would eventually, essentially,
supplant all of the other electronic musical instruments that exist, which means the tape recorder, the synthesizer, all that kind of good stuff.
But nowadays, everything that you could have found in an electronic music studio in the '50s, or '60s, or the '90s
is a piece of software on a screen on your computer with a couple of very important provisos.
Proviso number one is that a computer makes a rotten musical instrument in the sense that you can't strum it,
or whap it, or any of those good things that you can do with acoustic instruments.
I'm not going to do a whole lot of talking about designing hardware interfaces
for making computers that respond more naturally to musical impulses.
The reason I'm not going to talk about that is because it's its own subject.
And it's also a rather various subject.
Different people have completely different approaches to designing interfaces to computers.
It's such a wide, disorganized field that it's hard to figure out how to make a syllabus out of it in the first place.
So I'm just sort of going to ignore that and, to the extent that I need to actuate my computer
I'm going to be using keyboards, and a mouse, and the microphone.
So other than that aspect of just getting inputs into the computer, I think that
everything that you do now in electronic music, you at least can do on your computer.
So a couple of things about that, OK.
First off, what does making music with computers split up into as a set of things that you can do?
And my own taxonomy of what you do with computers to make them into computer instruments are that there are three
basic things that you might want to know how to do.
One is synthesize sounds.
What that means, at least what that means to me, is that you write down an algebraic equation
and it has a variable in it for time.
As time passes you just plug different numbers into the time slot,
and out comes a sinusoid or whatever it is that you told the equation to make, and then you get to hear it, right?
And if you came up studying mathematics like I did, this is paradise, right?
Any equation you can think of, you can listen to.
So that is synthesis, synthesizing sound.
That comes out of a long tradition of making stuff, like oscillators and filters that have
existed for at least 100 years for doing that, before computers really came on the computer music scene.
A second thing is what I think people usually call either processing or signal processing,
which is a misnomer because signal processing means many other things besides what it means to computer musicians.
But at least if you're in a room with computer musicians and when someone says signal processing,
what they tend to mean is something that takes a sound in and changes it into something else to go out.
The most ubiquitous example, I think, is sampling, where you take a microphone up to something and make a recording,
and then you have a button that you press that plays it back.
And the only transformation is that you heard it at a different time from when you recorded it.
That's a perfect transformation, right?
In chapter seven, I think it is, you will find all sorts of things to do with that particular kind of transformation.
OK. That's item number two.
One was synthesis.
Two is signal processing.
Three is analysis, the idea of taking a sound that goes in and boiling it down to a set of parameters
that describes what that sound is, or some aspect of what that sound is.
A very simple example of that is an envelope follower, which will tell you whether someone started playing an instrument or not
or more generally, tell you whether there seems to be sound coming into a microphone right now or not.
And you would use that, for instance, if you wanted to find out if someone was walking into a room so you could turn the lights on automatically.
Put up a microphone, hook it into an envelope follower, and then have it turn the lights on when the amplitude of the sound reaches a certain level.
So that's analysis.
That doesn't sound as interesting as synthesis or processing because there's no sound output, there's just sound input.
I hope you'll find out that there's a whole world of cool stuff you can do with that as well.
In terms of mental block-diagrams, if you want to think about what this all means:
Synthesis is, you have a box and it has an output.
But the input was something that isn't sound; the output is sound.
Analysis is, you have a box that has a sound input but not an output, and then
Processing is a thing where you have both input and output.
What I'm going to do to start with is start with synthesis because it's the easiest thing to get your computers to do.
Why? Because it's much easier to deal with speakers than it is to deal with microphones for reasons that I don't really understand very well.
But I want to give you some time to get used to how to get your microphones and your computers to be friends.
That might make it more appropriate to wait a few weeks before, or however many weeks we can afford to wait, before we start doing that kind of stuff...
And just to make the gesture, I didn't bring a microphone today, although there will be microphones in the room later on.
What do I have to tell you?
I have to tell you some organizational things about the course that are boring but that you need to know.
There's a website, and the website tells you all the boring stuff that you need to know about the course.
The website will somewhat change in time.
What it does now is it tells you, week by week, what I believe the topics to be that this course will consist of.
Most of the time I'm actually able to do what I was planning to do, but sometimes it has to change for one reason or another.
So this is not a guarantee that this is what we're going to manage to do, but hopefully it's what we'll do.
What you'll find is that as the quarter drags on there are going to be a certain number of assignments, which are things that you have to do with a computer that demonstrate that you have mastered one or another technique that is the topic of the week.
The first one of these is due a week from Thursday, that's to say Thursday of week two, and that is a tight deadline.
The assignment itself is very simple, I hope.
What that requires you to do is get software loaded onto your computer and figure out how to deal with the mechanisms for turning homework in, which you probably know better than I do.
But leave time to figure all this stuff out.
What this means is that you should be doing this right now so that when things start going wrong you can ask for help and you can try to figure out what to do to get things to work for you.
To that end, there are office hours.
Both Joe, the teaching assistant, and I will have office hours on Tuesdays because the homework is going to be due on Thursdays.
I think that's the most effective way of running it.
Joe will be here but I'm not sure in what room yet.
The room number, I think, might be changing, but he will be here from 2:00 to 3:00 on Tuesdays.
I will be here after classes on Tuesdays, which will be when I find everyone most exhausted.
Anyway, that's another possible way to find out what's going on.
The course has a textbook, sort of.
Again, the textbook is -- where did I put it?
The textbook is online, and it doesn't look like a book, but here's a PDF version and a PostScript version, and then there's a nice HTML version.
You can even download a nice tarball with the HTML version, and you can download all the examples that are described in the book, which are patches in PD.
Or you can download -- don't do this -- download all the figures in the book, which are also patches in PD, if you really want to laugh at what Pd can do.
It would be hard to do it quick.
So that is textbook, and what I'm going to try to do, although I've been-- Yeah?
Student: What's the website?
Oh. What's the website?
The URL is here.
That's the URL you want.
Although, you can get there very easily because you Google "Puckette" and then you see Courses, and then you see the first one is Music 171.
I didn't want to insult your intelligences by printing out the syllabus.
Well, actually, if you have trouble accessing the web, come see me and I'll print you out a copy.
But it won't help you so much because it's going to change.
On that subject, I want to not forget to say one thing, which is if you don't have easy access to a computer and/or the network, please come see me after class today so that we can figure out how to get that solved.
There are various things that we can do to try to get you to a computer.
I don't know what it's going to be yet because we'll just have to do it case by case.
The polls say that 99 percent of students now have computers, so I'm going to assume that you do until you tell me that you don't.
If you don't, do please come tell me because otherwise you will be in serious trouble, and it is fixable.
OK, so that's the course web page.
The next thing, this is what you know more about than I do.
The system for turning in assignments is WebCT, which probably all of you have suffered through.
Right? Yeah.
I last touched this in 2004, and it was a real bear
I think they've made it a little better now.
It's actually better than anything else that I've seen.
The reason it has to exist at all, as opposed to just having everyone put homework up on a wiki, is because legally we're not allowed to let other people see your homework assignments.
The whole thing is basically just to protect confidentiality, as far as I can tell.
There's no other reason to have all this infrastructure.
In fact, I would love it if one of you could try this
If one of you who actually is online, if you could actually go to WebCT and see if you can log in to the course
So this is the WebCT login
Actually, I think you do webct.ucsd.edu.
It's not going to do this for you what it does for me.
Student: It's not showing up.
It's not showing up?
In what sense?
Student: : After you log in it tells you what classes you have on WebCT
It's not on that page.
And you don't have 171 as one of your classes?
Student: Not yet.
OK. I was worried about that because I asked for the class roster and I got not a single student in it.
I have to call in to WebCT to ask them if there's something that I should have been doing that I haven't done yet, which is probably going to turn out to be the reason.
Sorry.
So this is not going to be an urgent issue until a week from Thursday when it's time to actually upload stuff because I'm not using WebCT to make stuff available to you.
I'm just using it to collect stuff.
So for this week, the thing that really is urgent is another thing that I hope some of you will try because maybe this will fail, too.
Which is see if you can download Pd and get it to run.
This is going to be a little bit less obvious because I'm going to have to show you some things before you can find out whether you're even successfully running PD.
So go back and say something I didn't say.
There is a software package that you will be using for the course which is Pure Data, or PD, and you get it from my website.
It will run on your computer, unless you have something really strange.
It will even run on your iPhone, but that version of it is not on my website for that one.
I'll tell you if you care.
You can run on Android, too.
So you can have a lot of fun with this, but right now we're just going to be using the standard one on the computer and making things easy.
So to do that, you do this.
Or there's several things you can do.
I'm going to show you what I normally do, but your mileage may vary.
The link is on the website, although you can also find this through my home page if you want to do that.
There's all this good stuff, and here is Pure Data.
You can be conservative and use version 42, which works, or you can have fun and use version 43, which sort of works.
But which does all sorts of new stuff.
There's one thing I know that doesn't work in 43 which you're not going to get for another week, so I will try to fix that by the time you get it.
Anyway, I'll tell you with this one I can, which is when I told you what the object is that doesn't work right.
Anyway, I'm going to be using 43. In fact let's just do this.
If you have a Macintosh that's more than six years old, you will want this funny version.
Otherwise, you will want one of these, Mac OSX.
Can I ask for a show of hands, this is just out of curiosity, well, actually it matters somewhat but mostly curiosity, how many of you have, as your primary computer, a Macintosh? Wow.
OK, how many of you have the primary computer of a PC running Windows software?
OK, so maybe 80 to 20, something like that.
How many of you are running something else?
One, two, three. Very good.
The reason I brought the Macintosh today -- actually there are two reasons -- the honest reason is that a Linux box doesn't have DVI out so I'm kind of stuck with it now on compatibility mode.
The other reason is that I want to look like you guys are looking today, but then by Thursday you're going to be watching me play with Linux instead of OSX.
All of the OSX lore, unless I decide really to punish you and bring the PC in.
We'll see.
No promises though.
We're going to be Macintosh today.
We're going to grab PD, the scary one, and I think...
I don't know what you do with these things.
Let's just tell it... I know.
I usually save it, and then I get into a shell, and then I type TAR, space, XZF, space, blah, blah.
You probably don't want to know how to do that so I'm going to try to pretend I'm a regular computer user.
One of you is trying this, right, so that you can see if it's actually working?
What did it do?
Student: I don't know.
I think I just...
I thought it opened?
Student: No, your window just froze.
See I just did that.
It already did that to somebody already.
Student: It's in the new Balance folder, I think.
What is that?
It probably threw it either on the desktop or in the home drive.
Oh, I'm running PD.
Oh, look.
It looks like I've got all this good stuff and now I don't know which of these is the one I just downloaded.
Student: Right there.
Let's get maybe this one.
Student: Left hand side, left hand side.
This must be it right here.
All right, this is the one that I had to start with today.
Sorry, I don't think it will hurt you to have more than one.
Then you just do this.
That's the easy part and then maybe this will happen, maybe not.
One thing that I've noticed, the first time you do this on any computer, sometimes it seems to take 30 seconds for Pd to start up.
So if you click it and it does nothing for 30 seconds, I don't know what that is, but that's Steve Jobs doing that for you.
Student: Will Pd Extended work?
Yes. Oh, thank you.
Another thing that you can do, which will be more fun, is go get Pd Extended as opposed to Pd PD.
In fact, it's so much fun I'm going to do this for you, too.
The problem is I've forgotten where the...
Oh, so we just do...
Get in the browser, and then we say, Pd Extended.
PD Extended, Pure Data downloads, Pd community site.
I don't know what the difference is between that and that.
This is the redoubtable Hans-Christoph Steiner, who is a person who aggregates-- well, does many, many things for Pd including actually spearheading PD's Release 43. But he's also making the so-called Pd Extended installers.
For those of you who know what's going on with Pd and/or Macs, they have various kinds of objects in them.
PD itself ships with a couple hundred objects, and Pd Extended ships maybe with a couple thousand objects in it.
So you have lots and lots and lots more stuff to play with in Pd Extended, if you can figure out where to find it.
Once in a while I actually reach...
You know, I don't want to make a Butterworth filter.
They've got Butterworth filters in it.
So there are things which you care about which you can get in Pd Extended that are sometimes really worth getting.
The other thing about that is when you want to make graphics, Pd has an extension called GEM, the Graphics Environment for Multimedia, which will allow you to make graphics and also to shoot video and analyze it.
Basically do with video the same things that Pd will do with audio.
It's not really part of this course, but Pd Extended has that.
You can go make movies or whatever you want to do with it.
I'll show you a little bit of that just as a teaser in week 10 when we're reaching out a little bit in the subject.
So, Pd Extended.
The last time I did this it was very easy, so I'm hoping this will still be here.
So download Pd 42. This is the one that works.
PD Extended 43 is up there somewhere, too.
So if you want Pd Extended in its natural state, you can do that.
But anyway, I think what I do is click this, and it says, "Go to virtual online application." 239 00:00:00,-40 --> 00:00:00,-40 Oh, yes.
I want to open it with...
Oh, it's a disc.
I'll say something interesting for 38 seconds.
Actually I sort of know this is going to work because I already have one of these things.
It worked the first time.
Meanwhile, nothing will happen until... Now it's doing a clean-up. ...
All right, we're done.
So disc images are things you click on like anything else in that.
New? OK, I'll leave.
And ta-da, we have a disc that consists of, well, no one.
As it starts, you can ignore it.
It's quick when I do it directly.
So this is the Pd Extended application and I didn't do that, I just did this.
Why? Because you don't really want to throw stuff into your applications folder.
I won't explain all the reasons you shouldn't mess with your applications folder.
You'll have to guess.
Then it takes too long to do runs.
This is all the stuff that it either loaded or didn't load, and that's good.
But now we're running Pd Extended.
More about that later if you want to find out about that.
Let's get out of here now and get back to being vanilla.
Take that, get rid of it, take that, get rid of it.
Get rid of this.
It's all free so you can throw it away any time you want.
So, next step.
Now you've downloaded PD.
Has anyone actually done this?
So, next step is, see if it's working for you.
Of course, it should start when you click it and it should also make sound when you ask it to make sound.
Actually, that's the real step that means you're doing computer music.
To do that, to find out whether that's happening, there are two places that you should think about looking.
I always go to the impatient place first.
The impatient place is, go to Media and say "test audio and midi" and up comes a Pd patch.
This is a Pd document, first one you've seen so far I guess, and this has indicators that say whether sound was coming in to your computer.
These are numbers and decibels which you learned about in musical acoustics last quarter.
These are in decibels with 100 being full blast.
I don't have a microphone so this is the noise level on the audio input device in my computer.
There's nothing plugged in.
So, I have a signal-to-noise ratio of, compute that and it's...
Student: Four minus.
So the loudest signal I could get would be 100 here and I'm looking at 28. So the signal-to-noise ratio is 100 minus 28, which is 72. Which, there's not audio hardware supplied.
That's bad.
Now the other thing that you want to know...
OK so, but sound is coming in.
I like to seeing that better than I like seeing zero.
What I really like seeing is one or two, which means I've got decent audio hardware.
Now I can make sound, which is to say I can ask the test tone to go on, and this is in decibels too, again, with 100 being full blast.
So a good place to start is 60.
Now you hear a nice A440. Or here's 80.
I always do 60 first because you never really know where the speakers are set.
While I was...
Yeah, there it was.
Now, what I didn't show you was, before most of you came in, I connected my computer to the audio system in this room along with the projector.
So what you're hearing now is the computer's line output... talking to my stereo.
And any of you who has a stereo can do the same thing, and that's a better way.
That or headphones would be a better way to operate than using the little speakers that are on the computer. ... Yeah?
Student: Did you say the lower the number the better?
Well here, yeah.
If there's nothing plugged in, the lower the number the better.
But if you have a laptop, your laptop might have a microphone.
So you might not just be looking at the electrical noise level on your equipment, but you might actually be looking at sound.
If that's the case, then when you say things that number goes, up.
Then you get really happy because you got audio and then you can start making cool processing actions.
I'll say that this will happen to you, the first audio process you actually make will suffer from horrible feedback if you're using the microphone with speakers on the...
Yeah, like that.
Because the mike is very close to the speaker, right?
And so the sound comes out of the speaker and back through, like that.
If you want to control that, plug in a pair of headphones, which usually will mute the microphones.
Then you can listen to what it's doing and the microphone will work properly, I think.
Depends on, you know, your mileage may vary.
The other thing, just telling you about this, I want to just tell you the basics about getting started.
When you do this... and that happens, it's great.
But it's possible to do this and not have the sound coming out.
Then there are things that you might want to do to figure out why, whether you have sound or not, and that all is here, under PD.
So this window popped up when I set the test audio and midi.
By the way, this will be possible to do but not useful.
I could have two of these up at once and they'll be fighting each other.
So don't do that.
So then in PD, that was in media, audio and midi.
In PD, you get preferences which have audio settings.
We're not going to talk about midi today.
And audio settings are what sample rate we're running at and a magical number, which I should tell you about, and what audio devices, and what number of channels.
Now I can do things that will cause everything to break.
Let's have eight channels about right here.
All of a sudden, nothing happens.
Maybe, I hope, I have an error message.
I have lots of error messages.
It didn't even give me the proper error message so I can't do it.
So this is the "can't do it" mode.
You don't see anything here and you don't hear anything coming out.
That just means that your audio device didn't get opened.
That could happen for all sorts of reasons, which are hard to disambiguate.
But in that case it was me asking for something impossible like that.
Also if I ask for megahertz out, I don't think it's going to agree.
Can't do that.
So you have to ask for something reasonable.
And the standard CD sample rate is 44K1.
Now we're back to being happy with the input now.
The other thing that can go wrong is you could...
You can't make it not be happy right now.
You can have this thing dialed in on a device that is no longer plugged into your computer.
You buy a USB audio device, you plug it in, you tell Pd to use it.
Then you unplug the device, it no longer exists, Pd starts up, you can't find it.
Then you see here it's just a little circle which has nothing in it.
You just have to click on that and select the thing that you really want.
The other thing that I want to tell you is this number here, the delay, this is the spooky setting that matters but which is hard to figure out how to deal with.
This is a number which is 80 milliseconds or up, if you're using Bill Gates' software.
Or it's 20 to 30 if you're using whatever his name is, Bill Jobs', Steven Jobs' thing.
Or you can get it down to about 10 on Linux.
This is the amount of time that passes between when sound comes in the machine and when it comes back out.
And if you try to make this too low, Pd shouldn't be showing you errors, which I'll see if I can find here.
Do you hear that?
Let's see here.
I'm running 43. On 42 you would see a red light saying digital IO errors.
I'm trying to resize the window.
It's too big for this stuff.
Can't do it. ... No, it's not there.
All right. Never mind.
I don't know where you see the error.
You just hear the error.
Here it is.
And that's because I asked for a delay that is smaller than my hardware can provide.
Oh, I did a 15 and now it's cleaned.
But now let's see if we can do 15 to 1.
So the smaller that number is, the faster the tablet.
That matters because you don't want to do something to your computer and then wait a second before you hear the output.
You want it to happen as -- Well, you want to have it happen with a small enough delay that it sounds like it's happening at the same time.
Which, depending on your musical chops and which instrument you play, might vary between five and 30 milliseconds.
What this means is that Macintosh latency's 15 to 20 milliseconds, maybe, or 25, are barely acceptable and the Window's latencies that you get are basically unacceptable.
And I can tell you that that's only the built-in audio hardware on those devices.
I have seen Windows boxes get very little latency by professional audio hardware you put on it.
So if you're a real gear-head and want to buy the gear, you can gear your way out of the problem.
Although you can also just take this, plug it into your machine, and turn it into Linux, which is what I would do.
Sorry to belabor all this, but this is important because you have like eight days, nine days to get this all happening and be turning in homework.
So I want to make this as painless as humanly possible.
Questions about all this?
I know I've forgotten things.
... Yeah?
Student: So what you're telling me is that the latency...
Which one's the latency?
Like between Windows and Mac, is it the hardware on there or the processing speed?
No, it's certainly not the hardware because you can fix the problems by loading Linux on the same hardware.
I can't even generalize and tell you something that's really true in every possible case, but in some sense the audio...
Well, audio systems consist of layers of stuff on top of stuff-- the driver and the API and the Pd itself --
and they all have various amounts of buffering they do, buffering meaning the amount of memory that they allocate in order to deal with being on time with everything.
So when you write something to a computer's audio output, you don't just write the next sample that has to go out.
You write several or many milliseconds in advance so that the audio hardware can be throwing them out while you're off thinking about email or something.
So that then, when you get back to writing a sample, you're still ahead of what it's doing.
So there is a first in/first out buffer sitting in your audio output driver.
It's throwing stuff out here, and you're preparing stuff for it to throw out, and you're staying ahead.
But you're stopping every once in a while because the OS is not treating you right and it is still reading.
If it reads something before you wrote it, then you will hear bad noise.
In fact you'll exactly this kind of bad sound now.
In general, you'll hear this sort of bad noise I'm just giving you.
This is a paradigmatic sound.
So why would one operating system or one audio application program interface require more buffering than another?
You have make enough buffering to deal with whatever your operating system can do for you, in terms of calling you back in short periods of time, and that is in OS.
But also, different writers of audio software are sometimes more or less conservative in the way they design these things.
So in truth, Windows is overdesigned.
It could be a great deal racier, maybe one time in a million, fail.
They can't fail one time in a million because they'll get phone calls.
So they just make the buffer real long so the phone doesn't ring.
So, there's that.
Now I can start doing stuff, I think.
Are there questions before I actually start doing stuff?
So do, please, before Thursday, get this downloaded and running so that you're not discovering that you can't do your homework next weekend or something.
So next thing is this, what is this thing good for?
So what I am going to do is make a patch that makes a sound.
Then I'm going to go back and do some theory, simply because I think it might be better to see the thing happen first and then make a theory out of it.
So what I am doing also is I'm simultaneously surreptitiously teaching you how to use pure data.
The real content, of course, isn't Pure Data.
It's the technique of audio synthesis processing and analysis, which in fact you could do in software packages other than PD.
If you want to know about lots of possible software packages, I know them all.
I can tell you all sorts of stuff you can do with a computer, in some other context.
I am going to just select a ridiculous font to start with.
The basic thing you do is you put stuff on the screen so there's this nice menu I can click.
What I am going to do today is going to be limited to two kinds of things that you can put down.
One is going to be objects.
Of course, that really means 200 different things because I have to type in what kind of objects they're going to be.
So that's going to be where I live most of the time.
The other thing is I'm going to need a button later on.
So first off, I'm going to make an object.
It shows up and I can...
Here's the thing.
This has a dotted outline that says that there's nobody in there right now.
In fact, if I tell it, let's be some object that doesn't exist, it'll still say, "Nah, there's nobody there."
In fact, it even got mad at me.
Now I'll just ask it to do something it knows how to do.
There's an oscillator, and oscillators take as an argument...
So I'm going to ask it to play A.
So you've had musical acoustics and you all know that 440 hertz is A above middle C, right?
That's one of those physical constants, like the speed of light, that people just don't touch.
You just have that.
Now we're going to say what amplitude we want.
So I'm going to put in another object.
I'm doing this in the slow way now.
I'll show you the fast way later.
Put another object and put it down here.
Then I'm going to type times tilde, I should say, and ask it, let's only be a tenth of a hold for the blast sine wave.
I'm going to crack the book in a moment and show you in waveforms what we're talking about here.
But for right now just talking over this, this is putting out a full blast 440 hertz sine wave.
By the way, you might know this intuitively, but these things are inputs up here and this is an output.
I'm going to hook the output of the oscillator to the input of times 0.1.
What that is going to do is it's going to take the amplitude of this and reduce it from full blast to a tenth of full blast.
What's full blast?
100. Then I'm going to say put another object and this one is going to be -- this is kind of not well named -- it's going to be the digital analogue convertor.
That's the person in your computer who takes those numbers and turns them into voltages.
Now I'm going to say...
Oh, wow, it just worked.
Take the output of this thing and put it into speakers.
That's to say make it available to the audio output of my computer, which by the way is connected to the speaker.
Now how do I make it shut up?
There's this control here which says whether you're computing DSP or not.
DSP, I don't know if that's a good name, is digital signal processing, and that turns the network on and off.
That's the fastest way to get silence if something's happening too loud.
That's important so there's a key accelerator: The slash turns it on and period turns it off.
Oh, command slash is on and command period is off, which you can think of as mute.
It's not really mute, but you can think of it that way for now.
Now the other thing that I should have mentioned is that when you start PD, this thing is turned off.
The reason it was on just now is not because I surreptitiously turned it on, but because the test tones, which I've already had out, automatically turns the DSP on so that it can make noise.
As a result, I was using the fact that DSP was still running, even though I'd closed the test tone.
So this thing stays on regardless of whether I have the patches open or shut.
I can close this patch and it won't change the status of whether DSP was running or not.
So this is more software.
No, this is half software and half theory now.
DSP running, what that means is every object whose name ends in a tilde, if DSP is running, is computing 44,100 numbers per second.
Or a number of numbers per second equal to the sample rate, I should say.
But 44K1 in and out.
What that means is that when this is turned on, this output contains a stream of numbers, one every 44,100th of a second.
Let's say one every 22 microseconds.
And furthermore, each of one these things is doing that.
It's using all of its inputs.
It's receiving inputs at the same rate.
If nothing is connected to one of these inputs, the input is...
All right, that's a complexity.
If nothing is coming to an input that expects audio, the input is zero.
I'm going to have to repeat in several different ways distinctions between these streams of audio and things which happen sporadically, which sometimes we call "control" or "not audio."
But what you're seeing right now is connections between the audio output of the oscillator and the audio input.
And what you have to know is this input expects audio and this input expects not audio.
It expects messages, which I will tell you about later.
So this network is -- I should say, these connections are like carrying numbers when it's turned on and they're not carrying numbers when it's turned off.
This input actually does expect an audio.
It expects this audio signal.
For instance, if I have this on I can break this.
To cut a connection, select the connection, which turns it blue, then hit command X.
So if you want to try the other output, do that, or both.
You can have fan out if you want.
While we're at it, you can have fan in.
What's the interval between this frequency and that frequency?
Any takers?
What's the ratio between those two numbers?
Three to two.
And that's what interval on the piano or musical scale?
Yes, a fifth.
Ta-da, mathematics turned into music! So the reason I did that was not to tell you what a fifth was, but just to show that you can hook two people into an audio input and it will just add them for you.
Over here, here's another thing you can do to demonstrate psychoacoustics effects.
All right, so I'm going to shut this up and talk a little bit more.
Is this all clear, what I've done so far?
To do this, basically you do what you do with a computer, which is you sort of flail with stuff and find out what it does.
But let me do a little bit of the flailing for you so that you can expect things to happen when they do.
The most confusing thing that will happen is this.
You will reach to move something, like this, and it will move.
And you will be happy.
Then you will release it and then you will click it again.
Then you won't be able to move it anymore.
It won't move.
Now I'm editing the text.
What do you do?
Well, if you're in this state, which is editing the text, and if you want to move the thing, deselect it and then move it.
This is second nature to me, but everyone has to do this the first time and it will confuse you for a second.
So you can immediately move something that's not selected, but when you select something, when you release the mouse, the text is selected for you to edit the text, which is more than likely what you're going to want to be doing.
But in case you really just wanted to move the thing, then you have to deselect it so that you can move it after you deselect it.
Also, you can select something by clicking on it, which selects the text, or you can select something as part of a region, and that doesn't select the text.
That just selects the objects.
Then you can move things.
Am I going too slow?
... Yeah.
So also, you can select a single thing as a group using the group selector thing, and again, it just selects the object.
Next thing is this.
I want to show you what this actually really is, and to do that I have to introduce two new objects.
While I'm at it, I'm going to tell you there is, of course, a key-accelerator for putting an object and it's "command-1", and then I can say "print."
This is object number four.
So I believe in the first week you're going to see about 10 kinds of objects.
What I try to do is limit it to five a day.
First day is going to be iffy because we're already up to four.
But theoretically, we will not be learning lots of objects all at once, but they will be coming out at a steady rate.
So right now, we've seen the oscillator, OSC tilde, we've seen the multiplier, we've seen the output, and now we've seen print tilde.
What I'm going to do is I'm going to show you what the oscillator is doing by hooking it up to the print.
Now logically, the first thing that you would expect this to do would be to print out 44,100 numbers a second, but it turns out that that would choke any computer in the world to try to print that stuff.
Plus you wouldn't want to see it.
So instead of doing that, what it does is it waits until you tell it to please print the next glob of data, and it prints it globs at a time.
So now what we're going to do is we're going to put the bang under it, which is a button.
Oh, let me do that slower.
So put, I've been putting objects, but I'm going to put this thing down now.
And it is a thing which...
And now I have to let out more of the truth.
I'm being very careful, trying to let out bits of truth very slowly.
So see now that this line that I connected is only one pixel wide, instead of two pixels wide, where this one is.
In other words, these are nice dark lines here, but this is a lighter line.
That is to tell you that this is not carrying an audio signal, but is for control.
It's for sending messages.
Messages are things which happen at specific times, as opposed to signals or audio signals, which are happening continuously.
The message that this thing sends out is: Every time you click on it, out comes a message.
The message just tells it to do their thing.
In this case, it says do you print, please?
What has happened?
Oh, because I have this turned off.
Now I'm going to turn it on.
And now it prints out.
Every time I whack it, it prints out a new collection of data.
So print tilde's job is every time you ask it to, it will print you out the next block of data.
So there's built-in knowledge about what Pd is doing here, which is that Pd doesn't actually really just compute one audio sample at a time.
It computes them in batches of, by default, 64 samples.
And let's see if we can get this thing shut off.
It should make a nice space with these numbers printed out.
So this is 64 consecutive numbers of a sinusoid, which is to say, a sine wave, which is the thing coming out of OSC tilde.
This is basically the first and most truthful tool at your disposal for finding out what's going on inside of a patch that's doing audio.
It's clunky and stupid, because this amounts to about 1.45 milliseconds of sound.
So looking at this wouldn't actually tell you much about what really is coming down in there.
But if you tried to see it, it would be too much data.
Anyway, you can see that good things are true about this thing.
What's the maximum amplitude?
It's about one.
Here's an almost one right there.
So what you're looking at is just numbers, but if you graphed them you would see a rising and falling part of a sinusoid.
Now let me get you to the book and show you what this is in a picture.
You can make Pd make pictures, but I don't want to teach you how to do that yet because there's too much detail involved.
So I'm just going to provide data off of them .
Where was I?
Don't want to do that.
I want to do this. ... Yeah.
All right, good.
So I told you there's a textbook.
This is the textbook.
You can buy this if you want to spend, I think it's $79, and they did a good job of printing it.
But you don't need to buy it because you can just look at it on the web, which is more convenient.
But if you want to read it in a hammock, you can buy it.
You can spend $80 and buy the thing, or print it out.
But don't tell them I told you to print it out.
I'm skipping some stuff, which maybe I should go back to, but here's a picture of what a digitized audio sample looks like in graph language.
There are two pictures here because this is what you want, in some sense.
What you want to make the speaker cone do is to move like that.
The speaker cones live in continuous time wher time isn't split up into trenches of 22 microseconds a hit.
So the computer's representation of this, however, is split up into screen time and therefore if you graph it, it would look something like that.
This audio signal has a frequency and an amplitude.
This is in fact exactly what would come out if you gave the appropriate frequency to an OSC tilde object.
It varies between positive one and negative one.
That has no units.
That's an arbitrary scale.
But I should tell you that if you put something that's more than one or less than minus one at your audio output, that's to say if you feed something that's out of that range to DAC tilde, then your computer will not be able to play it correctly.
It will click.
So this is the full audio range of your computer's audio output.
How does Pd know that?
PD just asks the computer, what range do you want to feed your DAC in?
And it normalizes that to one.
The frequency that you would do this at is manifested in how many of these samples it takes for the thing to make an entire cycle.
This is all acoustics, right?
In fact, what this is if you give it an equation is one of these things.
It's an amplitude times the cosine -- you could use sine, but I'm using cosine here -- of the frequency times the sample number plus a phase.
So if you take one of these things and graph it, you will see something like what you saw graphed down there.
Furthermore, you can change the numbers a, which is the amplitude, or omega, which is the frequency, or phi, which is the initial phase, and you can change the way that it looks in one way or another.
n is the sample number, and that is the horizontal axis here.
I'm insulting your upper intelligence here.
This is all it is though.
All you do is you do this and say we'll change that equation and we get all confused.
I've done this for 30 years and it never gets old.
So what is omega here?
Well omega was enough so that after 20 samples the thing comes around and cycles.
So omega is two pi over 20. Omega is the frequency out there.
So N is the number of the sample and this is the thing which controls the frequency, but it's the physical frequency of the thing as an array of numbers.
It's not a heard frequency, and you can convert that to the frequency-frequency by a simple formula.
The frequency you hear is the omega, is the angular frequency is what that's called.
Time and sample rate divided by two pi, and that's how you make a sinusoid.
So if you want it to be louder, change A.
Or -- and here's why, for this I have to go back to the patch -- if someone gives you a sinusoid and if you want to change its amplitude, all you have to do is multiply it by the ratio of the two amplitudes.
That is, multiply it by the gain you want, gain meaning the difference between the two amplitudes.
So what that means is what is coming out of this equation, what's coming out of this oscillator right now.
Omega is two pi times 440 divided by 44,100, whatever that number is, and a is one.
The amplitude of the output of this thing is one.
So what this is really putting out is the cosine of omega times the n, and forget the phase for now.
Time is just passing and we don't know what the phase is right now.
But if we want to change this amplitude, if I gave you just cosine of omega, if you said, "No, I want 0.1 times the cosine of omega,"
in other words, I want something with an amplitude of 0.1 instead of one, then the solution is to multiply the thing by 0.1. That multiplies it this way.
It changes the amplitude.
It doesn't do this.
That would be...
... Yeah?
Student: So if you were in your print command, like your oscillators, then just having them separate, would that, instead of going all the way to one and down to negative one, would it just go up to 0.1 and down to negative 0.1?
Yeah.
Thank you, because I actually meant to do that but didn't.
So I think what you're asking is, "What if I just print the output of this?" Right?
Student: Right. Yeah.
OK, good.
So it'll do that, and I forgot to turn...
Oh, so nothing happened because the audio is turned off.
So I'll turn audio on and it will say, "Oh, I need to print something." ... Yeah, there.
Now what we see is kind of ugly.
I'm sorry the spaces aren't worked right.
But what you see is something that's going up to about 0.1. It is 0.9998, instead of one.
So these numbers are these numbers divided by 10. Except that I asked it a different time and so actually they are like them but they're not exactly the same as those divided by 10, some of the phase.
Is that all clear?
Now without anything besides those things, what have we got?
We'll do those two.
I'm going to raise the total count of objects to five, but not in a very interesting way.
I just need an adder.
Now what I'm going to do is I'm going to take the oscillator and have it be zero plus 440. Let me check if that gives us the same thing. ... Yeah.
So this is stupid.
There's zero coming in here and we're adding 440 to it, so it comes out here as 440 volts, if this were an analog synthesizer, 440 volt signal.
The oscillator then is giving us a signal that's plus or minus one volt, but it's changing 440 times a second.
The reason I did that is so that I can do this, take another oscillator, or get another oscillator.
Oh, I'm doing this without telling you what I'm doing.
I'm selecting this object without selecting the text and I'm hitting command D, which duplicates it.
It duplicates it and leaves it selected without the text selected, so that's very convenient for me to move it.
This one I'm going to say six.
And by the way, the machine did sample it, too.
Look at this from a different perspective.
Come on.
... Yeah, by the way, let's multiply that by something.
No, let's not yet.
Let's just leave it.
See what we get.
Anyone want to guess what this is going to sound like?
All right, I'll show you.
So it's the oscillator on that.
Oh, I can just connect it and show you.
There is the sinusoid and here is the sinusoid.
Its frequency is changing once a second.
It's going up to...
OK, so here's an oscillator and it's going at six cycles per second, and what's its amplitude?
Student: One.
One, right.
So then when we add 440, out comes not the 440 volts, but a varying voltage which varies from 339 to 441. That variation repeats six times per second because this thing is happening at six cycles per second.
But in fact, to make this an easier thing to hear, I will say let's multiply that by five.
This can be ugly, but we're going to do it.
This will be quite audible.
Not quite as ugly as I want it to be.
So now we're varying between 435 and 445 hertz.
Now of course, since it's a computer, you can tell it to do anything you want.
It sounds like it's doing two pitches at once, to me anyway.
But I'm in a weird place because I'm getting an echo from the speaker sounding.
OK, let's do this.
Or, no...
OK, let's not do that.
So it's a computer, it'll do anything you tell it to, if it was a good idea or not.
It doesn't matter to it.
And furthermore, it won't hurt you because what comes out won't be more than outside the range of the DAC.
So as long as you don't crank your stereo or your headphones, you won't injure yourself doing this.
I think that what's going on here is it changes its speed to vibrato.
I need it more to make this obvious.
I'm sorry, this is ugly now.
So this is just how fast it's going, once per second, twice per second and so on.
You know what I didn't tell you?
When you start typing in an object like this, it doesn't immediately change it to the new object.
It only does that when you click off of it to deselect the text.
And furthermore, if you do something bad like this and then it would say, oh, I couldn't create that.
Then it prints the dotted line to tell me the object would be bad.
But it kept the connection so that I don't have to remake a connection when I fix the problem.
The problem here is that OSC tilde has a name that only works when there's no space in its interior.
For those of you who are computer scientists, space is "the delimiter."
That is essentially the only delimiter that you have to deal with.
So don't try to make an object if its name has a space in it.
Student: So just a question about the setup. So the amplitude for the OSC tilde is one, right?
Right.
Student: And we times it by 30?
Right.
Student: So that makes the amplitude for the 440 between 410 and 470. Is that right?
Right, and that's changing three times a second.
Then that's becoming the frequency for the oscillator.
I didn't tell you something important.
Frequently, objects will give you the choice of specifying their input or connecting to their input to set it.
Here I've said "oscillator" which means we're just going to take a signal and specify what our frequency's going to be.
But here I'm saying "oscillator" but I know what the frequency is.
It's three, so I'm just going to keep it on.
There's another way in too, which is that you can change these in messages, but I'm not going to try to tell you that.
Student: Is there a map of all the names of the outputs that we learned?
If you really want to see it, you say Help.
Right-click on it and you can get help and help within a patch, which tells you everything you want to know about it.
OK, so that was help.
So if you want to have multiplier help, you do that.
Then if you right-click on the canvas and say help -- the canvas meaning the document but not any of the objects in the document -- then you will get this lovely patch that someone else made.
It will tell you everything in this very carefully organized order.
But this will only be the first 200 objects, which are the ones that you get before you get Pd Extended.
More than one...
That's funny.
I didn't see any specific examples but I'm just about sure that there are two copies of this thing here.
Never mind, I'm sorry.
There really is this much stuff.
Well, sorry, it's just what it is.
Maybe there are more than 200 objects now.
So that will tell you everything that you might need to know.
If we're doing 10 a week, at the end of the 10 weeks you'll know 100 of those objects.
You don't need to know them all.
I know them all, but you're not me.
Basically, with about 100 of them, you can do a whole lot of stuff.
And then there will be an occasional thing that you can't do with those 100 that will require that you find another one out and thereabouts.
So what happens is that there will be a period of intense learning objects, like 10 a week.
After a while, you won't need 10 new objects, there won't be any more and things will calm down.
Other questions? ... Yeah?
Student: How do you get the print thing to work again?
So oh, yeah, there's a thing I didn't tell you, which is fundamental.
The patch can be in two different...
The interface of the patch can be in two different states, which are sometimes called run mode or edit mode.
If I try to click this thing now, I'm just editing the patch, and that doesn't click on it.
It just moved it, right?
So what I have to do is put myself into run mode, which I do here.
Let's get out of edit mode.
Now edit mode is no longer... Whoops! It is still on.
Well, this is version 43. You tend to get what you pay for.
Anyway, the indication is what the cursor looks like.
So right now what you see is an arrow.
And if I do that again, you will see an arrow again.
Like now.
Now it's just being happy.
You cannot get out of edit mode.
That's cool.
OK, well, I'm expecting to see stuff like this because we're in pre-release.
Student: Does the shortcut work, Apple-E?
Oh, the shortcut works great.
So the shortcut, you just hit DSP, command E, or Apple E.
And then it goes back and forth between modes, except that this is a thing that Hans has driven, and just torn hair out of his head over it.
You don't actually see the new state until you move the cursor.
Because some smart person at Apple thought you would never have the cursor change unless you reached it, unless you changed wherever the cursor is.
So what you have to do is change the mode, but then you have to jiggle the cursor to see that you are in the other mode.
Isn't that horrible?
That's only on Macintosh, so only 80 percent of you are going to have this trouble like we're having today.
Student: 90 percent.
So anyway, we're just moving to make sure this is what you think it is.
When you're in the run mode, which is not edit mode, you can click this thing and get it to do its thing.
And of course, sorry, we also have to turn on audio.
Of course, there's a reason why I'm not on audio.
Let's see.
Let's just do this.
So now we can turn the thing on but not hear it.
Now we're running so I can do this.
But if I can get back into edit mode, like this, then I can click it all I want.
Although, sometimes you can hold the command key down and click it.
And it will say, it's as if you were in run mode.
So the command key operates as a sort of shift into run mode thing, if you can remember that.
I never remember it, so I just toggle the mode.
Other questions?
Did that answer yours?
Student: Yes.
... Yeah?
Student: I just want to make sure I understand print and DAC tilde.
Print within run mode, when you click it, it creates a graphical mathematical representation of that patch, is that right?
Well, not even graphical.
It just prints the numbers out.
Student: All right. And then the DAC tilde, then the time is...?
OK, so the dac~, that takes whatever the signal is... and puts it there.
So it causes it to appear as an audio output.
So this is, print the values out so I can see them, and this is, play them so I can hear them.
Student: Is that abbreviated for something?
DAC? It's digital-to-analog converter, and that used to be what people called it.
There actually is a DAC in your machine, but people never seem to use that term anymore.
So, yeah.
... Yeah?
Student: It only prints the first 64 though, right?
It only prints the next 64, until you whack it.
Of course, if you really wanted to...
No, never mind. ... I could ask it to print more.
... Yeah?
Student: Do you have a limit in the inputs and outputs?
You mean as to amplitude or the number of includes or....?
Student: Just how many things you can enter.
Oh, no.
Student: You can have more inputs than objects?
Yeah. Oh, wait. Add more than just an object, meaning...
I think what your question was, was how many other things could I run into this...
Student: Right.
...into these fixed objects.
But I can do that and you'd never have to stop.
But could I make the object itself have more inputs?
Each object has its own schematics about what its inputs and outputs mean.
Some of them actually do have variable numbers, but you won't see those for a couple of weeks.
Other questions?
These are good questions, by the way.
... Yeah?
Student: You said that the right input was an input for messages?
So if you try to put an input, like with an audio, to that, it won't work?
Yeah.
Student: You have to keep it to the left.
Yeah. So for these particular objects, the right input is... Yeah, OK.
So we'll get there, because there'll be other things where there will be more than one audio input.
Sometimes you'll want to multiply two audio signals or something like that.
And I'd be scared to tell you that right now.
I'll tell you about that on Thursday.
Student: Is this only one channel right now? Like, left only?
I've only been using the left side, mostly.
When I'm working at home, I use both sides...
because it irritates me to hear every sound out of just one side of the thing.
You know, it's just what you like.
... Yeah?
Student: So there's no spaces unless you put a number in there? You just have the space to put the number?
Right.
Student: Because otherwise you just get the domino effect.
Right. ... Yeah.
One way I can have it fail is to add a space right in one.
So I'd be looking for an object named OSC and I didn't see one.
The other thing I could do wrong would be to not put a space there and so it would look for an object named "osc~3" which doesn't exist.
Student: Are there any defaults if you don't put a number in there?
Yeah, zero.
You can add zero to something, you could multiply by zero.
But if you don't fill that number in, then the other inlet becomes an audio inlet.
Then you can run an audio signal in there instead.
I wasn't going to tell you that.
If I just want to just multiply by something else, then I just don't say what multiplies by this thing and then it becomes an audio input.
Then you can be multiplying two of the audio signals.
That's really for next time, but that's the thing you would do.
... Yeah?
Student: Why does the print object not have two inlets? Why don't you have a data inlet on the right?
... Yeah, isn't that stupid?
Inputs to objects can have various functionalities, and one of the particular things that you can send an input is an audio signal.
But there are other things you can send as an audio signal input as well.
Of course if a thing had two different audio signal inputs, then we'd have to have two different inlets in order to be able to disambiguate them.
But if it takes two things that are different, like the message in an audio signal, then you get away with these in the same inlet.
If there was less clutter on the screen, you'd just combine them.
That's the simple answer.
Other questions?
Go look at the homework assignment.
I don't know if my machine is going to be able to play it.
But it's going to be to do this.
Firefox...
I don't know if I bookmarked it.
And somewhere down here...
You get your assignment here, which is to do this.
Now I don't know if this is going to play correctly, so...
It's lame.
All it is, is just a musical fourth that gets louder and softer.
It's checking whether you can control amplitudes and frequencies, and understand the difference between them.
And it's checking whether you can actually get around the oscillator, and the multiplier, and the adder.
Basically what this amounts to is understanding oscillators, frequencies and amplitudes -- and being able to kick Pd on -- which is probably going to be the hard part.
Student: When we turn in homework we'll be turning in all of this?
Oh. To turn the homework in, just upload the patch you made.
And I will give you more details about how the patch should act in order to conserve the TA's sanity.
There should be a clear way to turn it on, that sort of thing.
But more about that next time.