*** MUS171 #02 01 06 Miller: This is the stuff that's in store for today.(Indicating the pd patch on the screen.) @0015 What I want to do is several things at once. I need you to just look at the practical aspects of running and surviving .pd. @0030 How many of you are trying to run pd and not succeeding? Three. OK. One of you emailed me, I forgot who, and didn't have - four - didn't have sound coming out. @0045 Student: I figured that out. Miller: Oh. OK. Student: It was weird. It didn't show me any numbers though with the outputs. But when I did the test tone after a little bit of a restart on the computer, it came up. It was kind of strange. Miller: Something like that's @0060 been happening to me today, it hasn't happened before, which is that I had to try twice to get it to run. Student: I use the version 43 instead of 42 because that looks more familiar from the one we looked at in class. Miller: @0075 I think I'm running 42 right now. I'll tell you one thing that doesn't work in 43 in case you run the 43. This is something I still can't figure out how to fix. @0090 Anyone else for whom it's not working, can you tell me what symptoms you're getting? Student: It wouldn't allow me to put in objects. Miller: It wouldn't allow you to put in objects? Student: On the clip menu everything was greyed out. Miller: @0105 Maybe you're looking at .pd's window here and trying to do put, and for that you need to be actually talking to a real document. @0120 I didn't actually say this but this is pd's print-out window (which exists mostly when pd is actually runnng.) You can have this but it won't be doing anything until you have some number of patches open, @0135 and you can have one or more patches open and they're all running, all at the same time. Furthermore, they can talk to each other, so you should be aware of that possibility. Other problems? Student: I can @0150 get single sign-wave to play. When I try to put in another oscillator I have to get crazy. I can clip and then it's just gone. Miller: I think I might know @0165 what happened to you and that's something that I'm going to try and address today. It could be that what they're doing was numerically outside of the range of the possible values that you can convert, and there were ways that you could do that that would cause it to make silence. @0180 And that's a "gotcha" that I want to try to help you avoid today if I can succeed. Other issues? Student: I'm just having problems downloading pd on my computer. Miller: PC? @0195 Yeah. PC. Miller: I got a PC today and I'm not sure if I'll have the same problems as you, but if you see me doing something that you're not doing, that might help. Otherwise, see me after class today. Student: @0210 Do you know when a 64-bit version of pd is coming for Ubuntu? Miller: Ubuntu? @0225 The last I heard, someone had a machine and they were going to compile it on but no one knew when it was really going to work. You might have to compile it yourself. @0240 OK, so, next matter. @0255 I have another thing to sort of just check on which is, in class didn't exist as far as WebCT was concerned on Tuesday, but that should be fixed now. Is it decently clear how you would upload assignments? @0270 I have one slight comment to make which is that it's possible to get confused downloading patches on the web. I actually don't know if I'm on the network, so I don't know if I can show you this, but I can @0285 tell you this: If you see a patch on the web such as, for instance, the patch that I saved from Tuesday which is on the website for the course. You could click it and it will download you a nice patch, @0300 or you can click it and you will see this bizarre text in your browser. If you click and see the text in your browser that's because pd patches are, in fact, text files, and if your browser sees that it's text, it might just decide to show you @0315 the text instead of saving it to another file. This is not a problem. Just save it as a file anyway and make sure it ends in ".pd" and then tell your computer the ".pd" things are your puredata documents -- and then you're happy again. @0330 I regularly get e-mail "I tried to download this patch and I just saw gibberish on my screen." OK; patches are gibberish and you just saw your patch. If you're curious, by the way, you get to look and see what patches are. They're just text files and they just have @0345 gibberish in them that describes how you can make a patch. And, furthermore, those of you who get too excitable too late at night, if you learn what those messages are you can generate those messages from pd and you can make patches that @0360 build themselves. I'm not going to show you how to do that, though. I'll have to figure that out, or, everyone on the web is doing it. Just so I can shut this window down, @0375 I'm going to put this up as a sort of review for today. What I want to show you now are two other objects ... Wait, I forgot something. I actually gave you six objects last time because there was also the push-button. @0390 This is my resume from last time and what we're doing this time is another control @0405 which is a number box. It suddenly means now that you can make wonderful analog synthesis type sounds. Arrays which are graphs which you can do this with. @0420 These things are functional objects which I will grab and use as needed as we get through today's stuff. Today's stuff is mostly going to be figuring out what went wrong with last time's stuff. @0435 So now what I'm going to do is, watch this, it's ctl-alt-backspace, that is equivalent of, "save as." I am going to give @0450 myself a new file name so that I can make a new check point. This will be built and I will try it, @0465 I will try to save these things before I erase major portions so that you can see, in a progression, what happened as we went through a day. Now, review, @0480 let me just make the patches of last time very quickly and show you how you can see what they're doing and then @0495 go on from there. So oscillator 440 Hertz please, and then I will say, oh... If you have an object @0510 selected and if you hit the key accelerator for making a new object, it doesn't just make a new object but it makes a new object and connects it the previous one. It doesn't matter to you now, but late at night when your make hundreds, and hundreds @0525 of objects. You will get to like this feature, most people like it. You're going to multiply by 0.1, a tenth, and then I am going to send this out to the digital analog converter. [tone] Miller: @0540 I am going to turn the beep off, this is the cooler "hello world" patch. Now, what I am going to do, is show you not just how to print stuff but how to graph it. @0555 To print stuff, which is from last time is a print object, which is a print-tilde by the way, because it prints with a single input. Now, I am going to talk to this 0.1 thing and then I am going to make it a push button. @0570 This is the thing that I forgot to tell you first the first seventy minutes of the other class. It is that you're not going to get very far just @0585 trying to click this button like this because I am in edit mode and I want to get into run mode, and then I can click it and have stuff happen. Except, nothing happens because DSP is off. @0600 These are the numbers correspond to one 64-sample buffer of digital sound and my apology about the horrible format. Now, another thing that you might wish to be able to do is see it, as in a oscilloscope @0615 or as in a sound editor. I am going to introduce that because I am going to be using it to go back and make sure everyone understands about amplitudes, frequencies and modulation again. Even what the word modulation means, so to do that ...@0630 (New materials start now.) There is a wonderful object, called an "array" which you can get down here. (on the menu). This is unfortunate, there is a thing (also on the menu) called "graph" @0645 which is a rectangle that you can throw arrays inside. This is a array which is the thing you throw inside the rectangle, which more like the thing that you want, because "graph" will just give you a empty rectangle and idea @0660 how to stick an array inside it. (Well, there are ways; I am not going to tell you yet.) So ... get an array like this. -- And it immediately says "I want to know all this nonsense about the array." The important nonsense is, @0675 "What is its name going to be?" I am not going to tell you yet all about pd's naming -- how pd treats names is a subject all to itself. But, I am just going to use a name for now. @0690 In fact "array1" sounds good to me right now. And a size: this is the number of points that the array is going to have, so that number would be, for instance, at our sample rate if I want a whole second of sound I would have to @0705 ask for 44,100 points here. As a general thing, pd doesn't know much about sound. It does know that a second of sound require say 44k1 points -- @0720 anyway that number could change because the sample rate of the computer might change while pd is running. It doesn't make sense to ask for a array to hold a second of sound. So, you have to go on and tell it numerically how much sound you want in the array. In the same spirit, that you had to tell the oscillator @0735 how many cycles per second it had to vibrate in order to make you a nice A440. Well, what I call A440 is just a concert A4. So here I don't want 44,100 points, I want a 1,000 points @0750 just for now. This is aesthetics but I prefer points to polygons. "Polygons" means it draws little segments between the points, and points means it just draws the points. So I am going to choose "points" because @0765 it's me and that is my preference. And I am going to say "OK." And it says OK and it draws me a thing. So, I am not in edit mode, so lets get in edit mode and look around. It says "Hi my name is array one and @0780 my values are all zero" By default these values range from -1 to 1, which the same range as audio is, which is a good thing. For instance @0795 it is a good thing because I can now use that to graph what's coming out of this network and show you what it looks like as an audio signal. Let me do it wrong again, in the same way as I did the other thing wrong. @0810 I am going to need another push button and I am going to need an object whose name is "tabwrite~." That's an ugly name but it fits in a series @0825 with a bunch of other names so it has to be named the way it is. Then I am going to say "What table," that's to say array we are going to write to. Nomenclature: in computer music arrays were called tables, @0840 this has been true since 1958 and there is confusion in pd as to whether something should be called a table to be true to its computer music roots or to be called array which is what the thing really is, which is just bunch of things all the same type. @0855 The name kind of flops, back and forth, between things that say table or tabwrite~ and a things that say "array." I apologize -- you never know what's going to happen if you develop something for 20 years. @0870 Now, I am going to listen to this thing by connecting it here. Notice again, as I mentioned last time: These are skinny wires that hold or carry messages and these are fat wires which carry signals -- and those are different animals: Signals are happening all the time, @0885 and messages are happening only sporadically. Now I'm going to click this forgetting that I have to lock the patch. So I'll lock the patch, then I'll click it, and nothing happens. Why? Student: DSP is off. Miller: DSP is off! Go up here, @0900 turn on DSP. That's why I left this thing on the screen. Then, ta-da -- [tone] We are looking at the network output . OK, so now DSP is off @0915 but we just wrote into the array. In the same spirit as for the print~ object, this thing has an audio input but what it does is something that it does sporadically, that's to say when you want it to do it. You have to send it a message ("trigger," @0930 if you like) to say "do your thing." "Doing your thing" amounts to commencing to record the audio signal that is coming in and continuing to record until you reach the end @0945 of the array, at which point you stop. It doesn't loop around. You can make it loop around, but by default it just does it once. Student: What was the shortcut for DSP again? Miller: What? Student: What was the shortcut for turning it on? Miller: Oh, the shortcut @0960 for DSP. I don't even know if this is documented. Ctrl-slash turns DSP on [tones] and Ctrl-. turns it off. "ctrl-." is fairly standard Macintosh language, and the slash is just next to the dot. Yeah? Student: How did you get the array to look like that? Miller: @0975 To look like that? Student: Yeah, you did it by writing the top. When I turn my DSP on it didn't do that. Miller: Yes, OK. I did two things. One is, I clicked the tab, I clicked this button. I did that while I was @0990 out of edit mode. Student: Oh, OK. Miller: In fact if I do it again... Oh, nothing happened because DSP is still off. We'll turn DSP on. Student: OK. So I was just in edit mode. [tone] Miller: @1005 OK. With DSP on, each time I click it it'll make a new recording. You know what, I should really... It's all right. Do it the easy way. Yeah? Student: How do you edit array1? Miller: @1020 How do you edit array1 ... Student: if I want to change its size. Miller: Oh, I see, if you want to change the size. Right. OK. I was going to forget to say this and, @1035 by the way, this is very confusing. If you have more than a one button mouse, left click. If you have a Macintosh that only gives you one button, I think you command-click, or option-click. I forget. @1050 It gives you properties or open or help and do properties. Open means, "hi, I'm a sub-patch and I only contain this." [student laughter] Miller: That's good for other things. Properties is going to @1065 do this: It's going to give you (watch out) two windows because there really are two things here. There's the array, which is the squiggly line, and then there's the graph, which is the rectangle it's in. So when I asked @1080 it to make an array, it made me an array and a graph and put the array in the graph. By the way, there's no intellectual content in any of this. This is just pd lore. So this is the array. @1095 This has to do with the points in there. Since there are thousands of them that I can ask it, oh, let's have 2,000 of them. Then I'll say "apply" here. It's going to be a little embarrassing because you can only have 1,000 good points and then the other 1,000 are now zeroed. @1110 It did have the decency to change the bounds of the graph so that the array still fits in it, but that's about all it did for us. Now I'll do back to 1,000, like that. @1125 "OK" means "apply then disappear." Then the other thing is--what's that graph thing doing? Just left, so let's start over. Oh, and I'm drawing a polygon ... OK, now @1140 let's get the properties back so we can see not just the arrays but the Canvas properties. Now, here we can say the X... OK, X and Y really mean the horizontal and vertical axis. @1155 X is going to range from zero to 1,000. That means this point here is point zero and this point here is actually 999 because there are 1,000 points. If I change that -- you don't need to remember this-- @1170 you get the following embarrassing result-- Your graph wants 2,000 points but the array only has 1,000 so it looks stupid. I could also say, oh, the range is only 700, say. Then we get... It doesn't do it. @1185 Oh, yes, because I'm running .43 and there's a bug, so we say "no." If the array doesn't fit in the graph... In .43 it doesn't draw it. That's bad, and it's going to take me hours to fix it because there's something @1200 subtle wrong there. If your thing isn't drawing, it's because it doesn't fit in the graph. My apologies. Go back to 42 if you really need to see it. Somehow I didn't realize that was running .43. @1215 OK, we're going to cancel this. Oh, except I'm going to do this: The Y range goes from 1 to -1. Isn't that ugly? That's because computers think numbers go up that way, whereas mathematicians think numbers go up that way, or graphs think numbers go up that way. @1230 You have to say, yeah, I could say it goes from minus one to one but everything would be upside down and it would be confusing. For right now I'm going to say we'll go from 2 to -2 so that you can see the thing @1245 drops in size because now this is 2 and that's -2. There are ways of getting the thing to show you what its bounds are but, let's leave it that way. @1260 I'm going to just leave it like this. Just to belabor a point, let me disconnect this so I can have DSP running and not listen to it. @1275 I just ask it to graph the output of the oscillator and not the output of the multiplier so you can see what a full blast oscillator looks like. Now @1290 recall, I have the graph -- that's the rectangle -- going from 2 to -2 . The signal, the oscillator signal, ranges in value from -1 to 1, which is full blast as far as the computer is concerned. @1305 You can make signals that are more than full blast. These numbers are all floating points, so you can have numbers that go up to 10^37 or something like that. Your speakers can't play those. And it's a good thing, because you would @1320 vaporize the planet if you could. [laughter] Miller: But as long as what goes out is between minus one and plus one, then your computer will, I hope, faithfully turn that into voltages that your earphones or your stereo can deal with. @1335 All right. Just for, hadn't got these things... OK, this is the moment I think perhaps, to save this patch and continue. @1350 Played it, and I'm going to save "3.signalrange.pd" as the range, the signal range. @1365 All right. I'm going to now show you what happens when you... Oh, I'm going to turn the volume down in the room before I do this. And I'm just going to play the oscillator full blast into the speaker, @1380 or in the mixer. But the mixer's volume is going to be down, so we won't lose our eardrums. And then, I'll show you what happens when you add another one, which will cause things to malfunction in a novel way, which @1395 actually, you might have already heard a couple times. So, let's see. I don't want this anymore. Don't want this anymore. And I'm going to turn the volume down. @1410 OK, then I'm going to connect this to this. Actually, what I should do is turn them off. [tone] Miller: @1425 It's too much for the mixer. You can hear already, there's not a clean sinusoid. But let's, we'll pretend it's a clean sinusoid because I'm about to make it even worse. [laughter] Miller: I'm going to say, "OK, that's good." And I also want to go and get 550, @1440 which is a perfect third above 440. First off, I'll get... [tone] Miller: OK, hear that? Now, ready, set... [tone] Miller: @1455 What happened? Student: Clipping. Miller: Clipped. Yeah, yeah, OK. There's some, those of you with digital audio experience know what's going on here. But I'll graph it for you to show you what's really happening at the level of the signal, @1470 and to do that I have to introduce the final object for the day, which is clip~. And this is a, one of those minority objects which, it just, sometimes you just need it. But those times are maybe only once a week or so. @1485 So here it is, clip. This is the, clipping is, it's a term that... I don't know how old it is, but it certainly dates back to the old analog electronic days. It simply means what happens @1500 when signal goes out of the range of the audio device that is receiving it. So if the standard thing about clipping is you can hook an electric guitar up to an amplifier and overdrive the tubes. And if you overdrive the tube, well there is a maximum or minimum @1515 current the tube can put through. And beyond that, it just says, "Well, I'm clipped. I can't go any further, so I'm just going to stop right where I am." So it's like in this building, if you ask for floor minus one or floor four on the elevator, you won't get it. You only @1530 get floors one through three, because that's where the elevator goes. It's the same deal. So for instance, I'm going to clip between minus one and one, which is an exact imitation of what actually happens when the audio goes out of your computer, because the range of @1545 possibilities is minus one to one, and if it's out of the range, it is simply clipped to the range. And if I knew that, and if I for instance, add these two oscillators together... Oh, before I do that, @1560 sorry. Before I do that, I'm going to do this. Push that one, here we go. So here's the first thing. @1575 [tone] Miller: Oh, right. We're only listening to one of them, so let me play you both of them and show you both of... [second tone] Miller: So what's really happening is the periods of the two oscillators that we have @1590 are short. If each of them is fitting 20 or 25 cycles, then the thing... What you can see is that the thing itself is repeating at its much lower rate, which is in fact the, what is it now? It's the greatest common factor @1605 of those two frequencies, if you like, or the least common multiple of those two periods. OK? Or, now, finally, I'll show you what the computer... Let me show you. [tones stop] Miller: @1620 Or to show you what the computer really is playing, let's look at it this way. Rather than add it right into the tabwrite I will add the clipper and the tabwrite~, and then do that. Aha. Now, @1635 the signal that you saw before, even though, yeah. Even though the signal that you saw before was clearly periodic with this period, you didn't hear that period because in fact, in its @1650 internal structure, it really only had two components, each of which had a much shorter period, and your ear resolved those. It didn't hear, it didn't make a difference to... It just heard the individual harmonics; it couldn't fuse them, right? At least my ear couldn't. @1665 But if you clip it, you'd make that be no longer true. There's simply no possible way you can hear the signals having any period other than the period in this that it's got. Yeah? Student: How do you get the little toggle-light? Miller: These? Oh, @1680 this is not a toggle. This is a, this is the button which is called "bang." Oh, and if you go to toggle, you'll get another rectangular thing, but it's a toggle switch which goes on and off when you press it. That's related. All right? @1695 So this is clipping, and this is what your audio hardware does to you. Now, let me show you how you can make your life even worse. [laughter] Miller: I think this happened to one of you, but I'm not sure. I'm just operating @1710 on a guess now. So I'm going to say if you've got an oscillator like this... And now, I'm going to listen to my nice A440. [tone] Miller: And then I'm going to add another oscillator here. @1725 Ready? [tone] Miller: Oh, that's not what I wanted. Oh, yeah. I miscalculated. Add another one: Oops! What happened here@1740 ... is this: Let's see ... OK, so let me put in the, let me get that something into, @1755 yeah now we are clipping. Actually I can save some steps by just listening to the clip at the output. [tones] Miller: Now we get this, and this a problem because it is the sum of a sinusoid @1770 and another sinusoid that has zero frequency and zero phase, which means output is one volt... right? And the result is.... @1785 that half of the cycle is below 1 still - the half that was from zero to minus one is now going from 1 to 0, and the half that was going from 1 to 0 is now going from 2 to 1, and it's getting clipped. @1800 OK. In fact, when you learn how to control this, you can have a lot of fun because you can do this controllably and you can change the timbre of sounds by selectively clipping more or less of it, and this, for you electric guitarists, is the bias @1815 knob on your Ampeg amplifier thing [laughter] . Fender doesn't give you the bias knob, but the other manufacturers do. OK. Now I'm going to add another one. @1830 And what do you know? [laughter] Miller: The patient died, [tone] and the reason - worse - the reason why the patient dies is because now, the entire sinusoid here is above positive one, and so @1845 it got clipped to plus one, and so the result is a signal that you can't hear, you an only smell it, because it will melt your speaker. Speakers, theoretically will go down to zero Ohm's of DC and your stereo probably wouldn't do this to your speaker, @1860 but if it could, then you would have to call the fire department or something. All right, so this is [tone] this @1875 is how to make your life hard by making signals that are out of range, and, oops, that's interesting. And so, the first thing you hear is funny distortion, but you don't know whether the funny distortion is your patch, or whether it's just because your earphones are bad or @1890 something like that, and then when the signal goes away all together, then you still don't know which it is, but it's very possibly that it might be this. It might be a good idea to equip yourself with one of these things @1905 at the same stage as you are making your output. So, for instance, one thing that might be a really good idea would be: Whatever we do, we'll just put a nice adder @1920 at the bottom. It doesn't matter whether you're adding more than one thing or not. This adder really is just here to @1935 remind me that whatever's going out the DAC, it's going to go out the tabwrite~ -- it's going to be graphable as well. So now if I for instance do this, then I can both see it and hear it. @1950 Now, when you're turning in homework. ... Oh, good. Student: What's the adder for? Because I didn't see anything. What did it do? Miller: Oh, what's the adder for? @1965 The adder is there because when I change, when I add or take out stuff, I'm going to hook it into the adder instead of hooking it into the DAC and into the tabwrite~. And then that way I'm not going to forget to add something into the DAC that I didn't add into the tabwrite~. So really I'm adding zero. Student: OK. Miller: @1980 I'm going to explain more about adders in a second, but all I'm doing really is adding zero onto the signal, so I'm just wasting operations really. The reason I'm doing that at all is so that I can do stuff like this. In fact @1995 it doesn't even matter which - you wouldn't need an adder in pd at all because signals automatically add anyway. --Well OK, that's not quite true as I will tell you next. @2010 Any questions about that? Yeah? Student: Wait, so, is the adder unnecessary? Like can you just... Miller: The adder's unnecessary. It's only there so if I make a connection to it it makes the connection both to the dac~ and to the tabwrite~ too. @2025 And I could do that in a spiffier way, but I'd have to use another object. So what I'm going to do is I'm going to put this patch in a nice state so you might be able to remember what I was doing... @2040 @2055 This patch is going to get saved, and then I'm going to make a new thing (Starting patch "4.ampfrequency.pd")and do some other stuff... @2070 OK, so I'm going to insult your intelligence just for a few more moments and talk once again about amplitudes @2085 and frequency then graph them, because.... there is - I sense there is still confusion about this, and I don't know how to simulate this confusion in my own brain, so I'm just going to try to confuse you and hope that you stop me when things get confusing. @2100 So, here we go. Now we're going to take this away all the cruft. Oh, I didn't say this, but of course I didn't give this oscillator an argument so that means it's going at zero Hertz until I tell it otherwise, @2115 Oh, I didn't mention something else that's going to happen to you. If you open two or three of these patches at once, and if you have an array named "array1" in all of them, or in more than one of them, @2130 you're going to get complaints because pd will have two things named array1 and the name is supposed to let it figure out which one you're talking about. So, if there are two of them, it's confusing, pd will print you out a warning message and it will choose one of them for you, @2145 and it will probably not be the one you thought it was going to be. So what I'm going to do for that is I'm going to now change -- I forgot to do one, so I am going to try to remember later. But I'm going to change the name of this one to array3. @2160 And bang there and see if it worked... [tone] Miller: @2175 So now, we don't need clip~ anymore. What I'm going to do is I'm going to introduce the last thing that intend to do today; which is the number box. @2190 Oh, no. Second to last, sorry. I'm going to start; OK so there are two distinctions which are going to be important for the next half hour or so. One is frequencies versus amplitudes and @2205 inputs versus outputs. In other words, how you change the amplitude or the frequency of the sound and what it looks like when you change those two things in terms of the graph - that's one thing. And the other thing is that I have to give you some more details @2220 or more information about distinctions between messages and signals. And these two things I don't see how to separate them very well, so I'm just going to fold them together into one discussion. The first thing I want to do is this: @2235 go back and show you the oscillator, but give it a variety of frequencies. Let's see... [tones] @2250 This is my 440 Hertz. And if I start changing it I see this kind of change. All right? So now we got a nice theramin or something. [laughter] @2265 You will find this very hard to play musically. And we'll talk more about that later, perhaps. Now that is changing the frequency of the oscillator. That is the same thing in some way as telling the oscillator @2280 that its frequency should be some number like this. You could even do this: but we don't, but you could. You could say ... @2295 The oscillator is now 440 Hertz. [tone] But meanwhile I'm going to change it directly. [tone changes] @2310 This is perfectly legal, but this is confusing. This is confusing in one of the two ways you could be confusing in pd that I know of, that I'm going to cover now. Which is that I initialized the frequency to 440 but then I overrode it, or replaced it @2325 if you like, with the value 205. This is not good style. I'm doing it to show you how you can confuse yourselves. The reason you can confuse yourself now is that you can think that this number is still 440 because it says so right here. But it's not because I changed it. @2340 It would be smarter if I'm going to run something and it's going to change it, is to not give it a value which is not going to be reality after I do something to it. Although it's perfectly legal to do it. @2355 So now, the other thing that I want to do is say ... so that's why I'm saying oscillator without an argument now. Because I have a number box hooked up to it now and I'm trying to be hygenic about the way I'm making this patch. @2370 So the next thing is going to be: now I'm going to starting changing the amplitude. Which, if you recall, one does with a multiplier. What I showed you before is that we can multiply the thing by some number @2385 like a tenth. And then we would get something that looks like this. What did I do wrong there? Oh, oh boy! @2400 This is the oldest mistake in the book. Now what I've done is made a new oscillator, so its frequency is zero. And I had this nice number box going into to it, so it thinks it's 205. But I haven't actually sent the oscillator the message 205, @2415 since I made it again. So let me fix it and then break it again and then fix it so you'll see this. Because this is a thing which could be confusing. So I'll say all right, "go to 220 please." So you're at 220 Hertz. [tone] By the way it's quieter @2430 now since I'm doing this other thing. That's good. Now I'm going to say my oscillator: I want it to be something else. No actually, I just want it to be an oscillator, thanks. (I hit Control-Z there to do an undo.) @2445 And nothing, because it didn't really undo the change. It just made me a new oscillator and I told it to build me a clean one. It's clean in the sense that it hasn't received any messages that might change things like its frequency or its phase. So it's sitting there @2460 at the frequency zero, so it's putting out the value one. So I should be looking at the value 0.1 here, which we can't see. And that will be true until I do something like touch this. [tones] And once I touch this @2475 the value of 220 is added. Yeah? Student: Can you do that by taking out the input and re-connecting it now? Miller: No. Yeah so this would not work. Actually another way to break it would be to type a space here. @2490 And then click outside and then remake the object. Just typing a space dirtied the text string so it says, "Oh, I've got to make a new one." It makes a new one and it re-formats it so it's like the old one, but it's a new one now. Yeah. Taking this out...oops, @2505 taking this out and reconnecting it doesn't do a thing. You have to actually make the thing create an output. This seems like a horrible bug. And it will seem like a bug for @2520 a year or two until you realize that it's actually a feature. [laughter] I'll show you how you can even confuse yourself worse. [tones] Now what I've done is set up and argument between two sources of control. Watch. @2535 [tones] Here's my low A, and here's my high A. Which is it? [tone modulates] Well you can't tell from looking at the patch. So maybe you shouldn't do it. [laughter] @2550 You're perfectly welcome to, and there's situation where you could want to. But it's not likely that you would want to display the value coming in from two ways. One of which is guaranteed to be @2565 wrong at any given time. So you might indeed want to have two possible sources of frequency that are active at different times. In fact that's an important aspect of why pd is designed the way it is: You can do things @2580 from different sources. But if you do that, then you might not want to see what each source is trying to tell the oscillator. You might want to see what the oscillator itself is doing in the patch. So @2595 I could do that by either clarifying or further confusing, depending on your point of view. Let's do this: Now notice the oscillator is still going on at 447 Hertz. @2610 It doesn't care about any of this stuff that I've been reconnecting. Because these are messages, the messages are not flowing until I do something. I'm just making a patch. But, now, if I do something, like say, 440, please, then I've got 440 @2625 but at least I can see what it is. [tones] This is maybe a little bit better, and this will be OK until I confuse myself again by pouncing directly into here. @2640 This is not computer science. This is music. So, let's get rid of that because this is just confusing. I just did that to warn you how you can confuse yourselves. @2655 So, this is frequency and, while I'm at it, of course I've already shown you, I think, that this makes these kinds of changes [tones] . @2670 And, the amplitude is a similar situation except that I wouldn't dare do something like put 440 in here. Would I? Now, remember, I have the mixer way, way down right now. @2685 If I had done that at home with my stereo at its usual setting I would have jumped out of my chair [laughter] . What that did ..., well, I can't even graph it for you ... Oh, I can clip it then graph it. @2700 So, I'm going to say "clip -1 to 1" so that, in fact, I'm simulating what my computer's really putting out. @2715 And now, as long as I'm between -1 and 1, everything is good. But when I say I want 440 volts, please... [tone] I see that. @2730 That didn't graph terribly well. It's trying to to polygons. @2745 This is what Jimi Hendrix got when he played a note on his guitar. Basically, the tube was always either saturated and then you got what is essentially a square wave. @2760 This is a computer music technique. It's been elevated by having a name; it's called "wave shaping". You will hear more about this or read more about this in chapter five of the book. We will hold off on all the @2775 gory details until later. So, different ranges of numbers might be appropriate for selecting frequencies as opposed to selecting amplitudes. @2790 Now we're multiplying by zero. No matter what you multiply by zero you get zero and it looks like this and sounds like what you're listening to. I meant to say something and didn't finish saying it. @2805 You've seen me do this to number boxes and, of course, if you're in edit-mode you're doing that and getting frustrated. But, you can also type the number in, and then if you hit @2820 carriage-return/"enter", the number is generated as output. So if I do this, the output is going to be four, it will be four in fact if I hit enter, but if I want 440 I'll do this. @2835 Now, I did that so I can do this. I'm going to go here and I'm going to type the number zero-point-one @2850 and hit enter. Now we've got a complete computer music instrument with amplitude and frequency control. Now this is kind of stupid because if I reach for this number box - @2865 of course if I just click on this and start scrolling or dragging them down, [tones] It's impossible for me to get a nice sound with this. I can't get anything between 0 and 1, which is @2880 completely quiet and full blast. It is true that you can hold the shift key down and ask this thing to go up and down in hundredths. But if I were designing this @2895 thing as a patch I'd want to do something a little bit more user friendly. I would take the thing and divide it by one-hundred or something reasonable like that before I started messing with it. @2910 That's going to take me outside of my budget of five object types, although it's nothing but time. What I'm going to do is, now, go back and @2925 show you a little bit more about manifestations and differences between signals and messages. Student: I'm sorry. How do you actually type the number value into the number object? Miller: Oh, I didn't tell you something important. @2940 You have to click on the thing. It doesn't give you any visual feedback, which is stupid. It should. Then you can start typing and then you hit enter to make it go in. Student: And you're out of edit mode. Miller: If you're in edit mode it won't do it for you. Student: @2955 If you're in edit it won't. Miller: Yeah. It has to be in "run mode" or "locked," if you'd like. So, the final object @2970 that I want to tell you about is "print". ("Comments" are just amusing ... but good for explaining -- comments are very good.) @2985 Let me do a quick review of something very imporant: What I've been doing on the "Put" menu so far is mostly reaching for objects. There are three things that I still need to do that don't require just making @3000 an object and typing into it because these are user interface objects -- they're things that make the surface of the patch. They are the number box which is here, the bang, which is here, and the array, which is here. @3015 Everything else that you see here is just plain old objects. All right? Now, what I want to do is save this. So, now we have this print object without a tilde. @3030 OK, so it expects not a signal, but a message, or messages. And now, if I change this value, we get to actually see what the thing is doing. OK, this is how you debug patches. @3045 You want to know what your patch is doing. And the way you find out is if there are messages going through. You can sometimes help yourself with number boxes, but frequently, if you really want a complete record @3060 of what's going on, you just hook a print up to something. And then, if you want to know what's going on with a signal, you have things like this tabwrite~ , or print~ which prints the things out here. @3075 And those two things have signal inputs, so they are appropriate for talking to signal outputs, and they will show you how something is varying in time and you'll see that. @3090 Is there something else I needed to tell you about that ... Let it sit then. So, back to frequencies and amplitudes. Questions about this? Student: @3105 What was the keyboard shortcut for connecting two objects? Miller: Oh, there's no keyboard shortcut ... OK. There's one trick to that. There's only one way to make a connection that doesn't require that you actually do the drag thing, which by the way is horrible on a trackpad. And that is, @3120 we have an object, and we want to make a new object to be connected to it. So, while it's selected, you hit Control-1, Control-1 in general @3135 just makes a new object. But Control-1, if something ... one other object is selected, Control-1 means "make a new object and connect to it." @3150 Other questions? OK? Student: Does print run automatically when you turn on the DSP? Miller: Yes. Right. So print-tilde, you have to click it. With print tilde, you have to send it a message to tell it @3165 to operate like this. Let's see, you can do this, it's starting to get messy now. Turn it on. Oh, right, @3180 I've got the input down to zero. Oh, cool. Now I've shown you how you can make a patch that shuts up, but it's still running, so you can debug it without listening to it. -- -- @3195 Just make your patch have an amplitude of zero, make it be a control, the patch is going to be muted in the sense that everything I'm doing is initially getting multiplied by zero, so you don't hear it. But we can still go through things and do things like look at @3210 the oscillator numerically, or look at the oscillator graphically. ... No, we can't do that, but we can do this. ... Right. @3225 We can do that without having to have everything come over our speakers. It's a good thing. Student: Is there a way to graph in real time? Miller: Yeah. There's an object @3240 called metro, which is a metronome, which will send out a message repeatedly instead of just once when you click it, and then you can have it just grab 10 times a second or whatever you want. I'll get to that. It's out of my object budget right now. Student: @3255 Can you put up a bang on an oscillator, and how to play it with it? Miller: No. Oh, yeah. So how would you make something play when you click it? Yeah, I have to do some more objects to do that too. @3270 So, in fact, to make something start playing, you don't tell the oscillator to start playing, because it's always playing. You have to multiply it by something and make the thing that it's multiplied by quit being zero. And that in fact is @3285 kind of the crucial thing that I'm hoping to find about five different ways of saying today. Is ... You turn things on and off not by turning them on and off in the sense of "computing" or "not computing," but by multiplying them by numbers that vary from "zero" to "not zero." @3300 And the reason for that is -- obviously you would save computation time if you just turned the thing on and off -- but that doesn't make for nice musical beginnings and endings of notes. We want things to turn on and off smoothly, which you'll have to learn how to do. But the only way to accomplish that @3315 is by multiplying the outputs as a way of controlling the amplitude instead of simply by turning things on and off. And a wonderful example of that is this. Let's multiply ourselves by @3330 not a number, but by another oscillator. [tone] @3345 And let's maybe go at one Hertz. Now, this is where we're too loud for the mixer again, so we're hearing distortion. So rather than just take that lying down, @3360 I know how to deal with it now. So, let's say. Not only are we going to do that, but we're also going to have a multiplier controlling the overall amplitude. @3375 And now, we have a patch that does something interesting, but doesn't do it full blast. I'll start paying attention again and being careful about the outputs, that I can turn the mixer up. @3390 OK, so now what I'm doing is I'm taking this nice oscillator, that has a pitch of 330, and @3405 making it change its amplitude. So, as I click and look at the signal at different moments in time, I get different strengths. That's because this one is just making @3420 that waveform, whereas this other one, this one Hertz job, if I look at it --. Now remember. There are 1,000 points in this array. @3435 That means the array has a 44th of a second. So, at the speeds that we're looking at, you don't see very much varying at all in a one Hertz sinusoid. But of course, you hear variation, because there are 44 of these things going by per second. Faster than @3450 the video frame rate of the thing. So, this thing, even though it looks like it's doing almost nothing, is in fact varying, it's going once a second, so what it's really doing is it's going up, down, up, down, up, down. And what you hear is @3465 two peaks per second, because you hear a peak when the amplitude goes up to one, and you hear a peak when the amplitude goes down to minus one. Which means it got multiplied by minus one, which is also full blast. Student: @3480 Is this different than Tuesday? Because Tuesday we were doing something with the frequencies. Miller: Yes. This is a completely different situation from Tuesday's situation -- you've anticipated the next thing I want to do, in fact -- where there was @3495 an extra oscillator but it was controlling the frequency of the oscillator we were listening to. @3510 Maybe it's time to "Save as ..." ... Now we're saving "5.moreampfreq.pd" ... @3525 So, now what I want to do is say, "OK, this is good", but there's also the possibility where I had my nice oscillator. @3540 Here's an oscillator, and then I had an adder and I was adding 440, I think. @3555 And then I had another oscillator with another amplitude control. Student: Isn't that one multiplying by 440? Miller: @3570 Oh, thank you. I don't want to do that, do I? Now we have an oscillator. It's going to operate at some frequency, but, unlike last time, @3585 to give me more fun, I'll hook up a number there. I didn't have number objects last time, so I had to do it a little more severely. Now lets see what this does, let's do this. @3600 All right. Now we're getting complicated. This is yesterday's patch @3615 with a little bit more controllability but doing exactly the same thing. This is the oscillator that's making noise. And, morally speaking, it's speaking in 440 Hertz. But, in fact, we're taking that 440 and we're adding @3630 another audio signal to it. And that audio signal is the output of the oscillator whose frequency and amplitude we are controlling. Now, what was happening last time was this oscillator said "osc~ 6". @3645 So, that I initialized it to six Hertz. This was "*~ 30", and it was doing a fixed thing. But, now I'm using the number boxes here to fill in the frequency @3660 and the amplitude of this so-called "modulating oscillator." Now, if we turn this thing on, like this, let's turn this one off, @3675 I have to turn the patch on [tone] . There's 440 for us again. And, now if I say, this oscillator will run at three Hertz, we got this. There's that. @3690 And now this one was doing something different, which was this: [tone]. Let's go to 440 so we can compare it. This is a changing amplitude. Student: What's the point of adding the 440? @3705 Why didn't you just put the "osc~ 440" ? Miller: If I did that then it wouldn't know to add it -- it would be overridden by the values coming in. It wouldn't be 440 _plus_ the values. Student: Oh. OK. Miller: @3720 Yeah, so. That's a good question. It's not beautiful yet, but it's OK. @3735 I could have tried this. I just want to run this right in and then say 440. @3750 But now this 440 is actually being overridden by this. In fact, what I have really is an oscillator that is varying between plus and minus six Hertz. So nothing's happening at all. It's very easy to make sounds that you can't hear. @3765 And the reason you can't hear the sound, you can look at it and see why you can't hear it, is that it's just not moving fast enough for us to hear it. Student: @3780 For the lines you have connected, can you just grab it, disconnect it and move it to a different one or can you take the line off and .. Miller: I wouldn't be able to disconnect it either at the output or at the input. It doesn't do it. @3795 You have to delete the old line and make a new one. Student: This is probably a silly question, but, it sounds like another window that would show you the signal level, no way you could see how things are / troubleshoot? Miller: No, basically, no. @3810 There's no other window here except when you've got. I mean, you can build things that do that, but there's nothing built in. OK, so, that didn't work but @3825 this works: [tone] . Now, at this point I'm just confusing you but I think it's 440. I'm going to save that. Furthermore, you can improve it by doing this -- @3840 now everything is up for control [plays a scale of tones] . @3855 Don't try this at home. Then you have this -- which is how fast it's going. And this -- which is how deep it's going [demonstrating new tones and frequencies] . Now you have frequency modulation. @3870 This is 1960's computer music [laughter] . That is known as frequency modulation. Frequency modulation's taking @3885 the frequency of an oscillator and changing it. "Modulation" is a musical term that just means "change". In fact we shouldn't even call it "modulation..." Well, maybe it means change with time or something like that, or repeated change. No -- modulating harmony might not be repeated at all ... @3900 What we're doing now is we're taking this oscillator, it's frequency is the sum of a base frequency, a "center-frequency" if you like @3915 and an oscillator. This is an oscillator, the amplitude and frequency are 172 Volts and 82 Hertz. @3930 This is taking this oscillator and changing it's frequency by talking to its input. This is taking this oscillator and changing its amplitude by multiplying its output by something. @3945 And that, contrast to the other things, makes it sound like this. We can make sounds with it. This is trigonometry. If this is cosine A, this is cosine B, @3960 this is (cosine A X cosine B), which we all know is 1/2 [cosine( A + B) + cosine (A - B)]. Miller: So Algebra II is just this! @3975 Or actually to put that backwards: People will tell you that the reason, if you have two oscillators -- two sinusoids that are nearby in frequency -- they "beat" when you @3990 superimpose them, it's because they're moving in and out of phase. That's the layman's explanation of what's going on. The truth is that the sum of two sinusoids is algebraically equal to the product of two other sinusoids, @4005 it's the same relationship I just told you and the product tells you that it's changing in amplitude, which is the beating you hear, and the sum is the two that you put together. Now I'm doing that backwards, I'm taking an oscillator here and I'm making it beat by multiplying with another oscillator that changes it's amplitude @4020 and that's just algebraically equal to those two that you have to add to beat. It's the same stuff -- you can do it either way. This however you can do to a real signal. Try that at home and see what you get. @4035 Find a politician you don't like and multiply him or her by a thirty Hertz oscillator, and then you'll get a pleasant surprise! [laughter] Miller: @4050 This is an oscillator, changing the amplitude, which is sometimes called amplitude modulation sometimes called ring modulation as an historical term which we'll never get out of. @4065 This is frequency modulation, which is taking the same oscillator ... (I should make a nice comment, emphasize what an oscillator is, the main oscillator if you like...) This is @4080 taking this oscillator and changing it's input. You can do both at the same time if you want. Yeah? Student: Is the number there zero right now? On the right hand side. Miller: Yes. This one here? Student: Is that the amplitude overall? Miller: This and this, @4095 those are volume controls, or gain controls that I have on the outputs of both of these patches, so I can turn them on and off -- Which is not making the computer not compute, but it's multiplying them by a tenth or a zero @4110 And of course we don't hear them because also I've turned DSP off. ... [tone] This is a more correct way of showing you what's happening. Student: @4125 What is cross-modulation... Student: Is that not an official thing? Miller: I would use that to mean that I was taking one sound and multiplying @4140 it by another sound or maybe doing something else to it depending on the other sound... I don't know if it's a trick definition. Student: OK. Miller: It's also, @4155 lots of terms... we'll get further along and see all sorts of other things. Any other questions about this? Sorry to belabor this but I'm going to belabor it slightly. What we have is @4170 two ways of looking at signals which are print~ and tabwrite~ going in to an array. This one (tabwrite~) is more more work but it gives you a nice graph. It's more work because you have to make a button and choose when you're going to do it and make a graph that agrees in name @4185 with the tabwrite~ . I could have five or ten arrays in my patch, and five or ten tabwrite~ 's and they could talk to individual arrays. There's a print @4200 without a tilde and that is a thing which takes message input. And by the way, as I showed, it's good for printing these things out (messages) @4215 but it's not good for printing these things out (signals). Furthermore it will even refuse to allow me to connect and will print a nasty message if I do that. In general you cannot take a signal and put it into a message input. @4230 A message input wouldn't know how to deal with 44,100 numbers a second. I _can_ however take a message output and put it into a signal input, as long as there's not a signal going into the signal input as well. @4245 The message will simply set the value of the signal. So numbers which are messages promoted to signals automatically, but not vice versa. @4260 What else do I have to tell you about way of review? One other thing, this is the review but this is important, I'm thinking I could have confused you by... @4275 If you do this, this input doesn't take signals, it tells it that it's messages. That's to say, binary operations like @4290 times or plus -- If you feed it an argument that initializes the value but also tells that the inlet is expecting messages as opposed to signals. Multiply two signals don't give it an argument just say @4305 times~. Now all this should be explained in the help windows for all these things. -- By way of reminder, you can always get help by right-click; here's help for the oscillator, @4320 even a graph ...