@0000*** MUS171 #04 01 13 Miller: The new objects for today are going to be... my memory's long here...we're going to find out. @0015Six of them since you only got four last time. What I want to do is I have two things in the program today which are not absolutely to develop new theory but to continue @0030showing you manipulative level things that we might want to do. What they are are, first off, oscillators are the same thing as, let's see, what's an oscillator look like here. Do not be confused by @0045the fact that OSC and COS are anagrams. osc~ is oscillator and cos~ is a thing which just takes the cosine of what we're looking at. Actually, if you give the input in cycles -- so it's the cosine of two pi times the thing. And phasor @0060is the other thing that you need if you want to make an oscillator and someone gives you the cosine function. I'll try to explain that in comprehensible terms later and when you see that then you'll actually understand what an oscillator is and does. Then, @0075various conversion things: frequency back and forth to midi and RMS back and forth to decibels. These are the things that you really use at least at the first cut in order to be able to control pitches and amplitudes @0090in human readable ways. So up until today I've been giving you amplitudes that look like 0.1 and stuff like that which is a perfectly reasonable way to operate, but most people would prefer to use some kind of reasonable amplitude units. So stage two @0105in learning how to do that is knowing the usual psychoacoustics or acoustics measure of amplitudes and frequencies which are going to be... or frequencies, maybe, which is not really a unit but which seems to be the easiest way to describe @0120what that is and decibels which you learned about in physics. Alright, so that's physics@0135... So, with that in mind, I'm acutely aware that I used about five minutes of the very end of the last class to suddenly introduce the line~ object. So I want to go back over that review-ishly @0150and try to make sure everyone uses it and wants to use it. There will be more about how to use this thing effectively, that's to say programmaticly, that I won't be able to tell you today because I won't have all the GUI objects to be able to do that. @0165But I can at least keep at it at the sort of level of preplanned, here are the breakpoints, and here's what I want to do on this level. Alright? So the usual patch @0180that we've been operating on, or make it the usual kind of patch, is - make a frequency, - multiply it by something to control the amplitude (which until now has been an oscillator because we didn't have line~).But now that we have line~, @0195pretty much for the rest of time were going to be using this (line~) or objects derived from it for controlling amplitudes instead of oscillators which are not usually amplitude controllers really. Alright so @0210line~ does something which at the end of last class I was hurriedly trying to show that I will just develop that again - probably somewhat differently in order to emphasize it. So what we have here is a nice table with 44,100 @0225elements in it, so that it holds a second of a sound sample at the rate that we operate at. And that way we can do things like -- First off let's look at the oscillator and we'll see what 440 Hertz looks like if you @0240graph a second of it. Wait a second before you see it and then you see if @0255I were honest I would tell you that there aren't actually 440 cycles being graphed here. What's really happening is there aren't 440 pixels in that part of the screen so it's graphing some incorrectly unsampled @0270version of that waveform. But nonetheless you just get a sense that it just fills this table that is the rampage between -1 and +1. Which is indeed what the output of an oscillator looks like. If you want to see it @0285well you have to give this thing some much lower value. And then you'll see a reasonable number of cycles but on the other hand when I play it to you wont hear anything. Because 10 Hertz is below the @0300audible frequency range. Alright, so we go back to this. And now what I want to do is graph what line~ does. So lets turn it on @0315and lets graph it. Well that was kind of stupid. The graph actually falls right on top of the rectangle that holds it. So if you want to actually @0330see it maybe I should look do this -- I don't know how to do this in any good pedagogical way. I could make the table go from -2 to 2 which I've done a couple of times. There now your looking @0345at it. Yes? Student: What's the "300" in the message boxes going to line~? Miller: OK, yes I'v got to get to that. So the 300 is the amount of time in milliseconds that it takes to obtain the value that I gave it as a target. So here the target is zero and the time is 300. Student: @0360Because it takes 300 milliseconds to from 1 to 0? Miller: That's right or from wherever it was to zero because if it is at zero, I asked it to do that which means it has to go from zero to zero which means it just flattens. Or -- to @0375make it painfully obvious -- we'll put a delay on the message, like this. @0390OK. I didn't do that right; I didn't tell it how much to delay, did I? So we'll delay another 400 milliseconds. I'm going to turn it off and then, there it is: [tone]. @0405 Alright, so this is what line~ does. It starts where ever it was and when you send it a message -- so the message arrives, "0.95 @0420300" arrives, at this point in time. Because I started graphing 400 milliseconds earlier than I sent that message, and line~'s way of responding to that message is to ramp up to its target value, @0435which is almost a one, and do that in the next 300 milliseconds. It doesn't look like it, but this should be 4/10ths of it, and this should be 3/10ths of it. Something bothers me here ... it doesn't really look that way to me right now. But maybe it is. @0450Yeah. I'm looking at it from real close, too. Who knows. Alright! Or conversely, sorry to insult your intelligence, but, 2e'll do the same thing to get back down. @0465Oh, but with a different button. But now, of course, if I do .this ... -- nothing happens because I @0480stopped DSP! ... (Oh, this is going to be very confusing. The delay sent the message anyway, and then this thing happened, and it all happened while DSP wasn't running. @0495So they all took effect at the same moments, but that wasn't what I wanted to show you.) I wanted to show you this: Going up in here; here's what it looks like to go down -- and here's what it looks like if to go up and down. And pretty soon you @0510will be building synthesizers. Oops, what did I just do? I wanted to make this a smaller delay. ... @0525Let's do this for real. What we're going to do is turn it on after 100 milliseconds and then turn it off after another @0540400. Wow, there it is. Alright, now @0555someone who doesn't understand this, ask a question. Or do you just need to stare at it? That's a possibility too. Or is this just @0570clear? Probably not. What's not clear about it, first off is that you can't actually see from a patch what objects are doing the good thing right now and what aren't. That's a problem that no one will ever be able to solve. But what's happened was, @0585you could pretend these things aren't here because they are not happening right now. Let's actually cut this. Actually, let's just throw the whole thing out; we don't need it. So now @0600what we have is... I'm going to save this. This is a good moment. Miller: So what happened is I hit the button, 100 milliseconds later a message comes out of this delay, @0615a bang message comes out of this delay and does this, which means over the next 300 milliseconds we're going up. Then, how long does it stay at 0.95? Student: 100. Miller: The remaining 100 milliseconds between this @0630300 and this 400 because, another 400 milliseconds later, this message clicks. Yes. Student: Bang? Miller: Yes. Well. Delay sends a bang, which causes this message box to send a message "0 300" to the same line~, @0645therefore it goes down. And the whole thing fits within a second, so we got to see it all. Yeah. Student: It doesn't make sense. Could you just go over exactly line~ again, what the function of it does? [laughter] Miller: @0660Yeah. OK. So... Student: Could it replace something you've done before? Miller: Oh. OK. There @0675were examples earlier where we did things like this. Let me break this for a second. And do this: osc~ oscillator a couple of Hertz. Multiply by that. Miller: Right? @0690And that's an amplitude control. This... -- This is another amplitude control. But it is an amplitude control that let's you tell it whatever you want to do really, as opposed to just sitting there and just doing something by itself (as osc~ does). @0705So, answer number one is osc~ could be used as an audio generator or as a level control by using it to multiply by another oscillator or something else. And line~ also could be used as a straight @0720signal and you would hear a thump. Or you can use it as a level control by multiplying it by something that you want to hear. line~ makes this kind of waveform. In contrast to osc~, @0735which makes this kind of waveform. OK. Miller: Now I need another button to press just for graphing. @0750So there is what the oscillator does. So oscillators make sinusoids. And line~ makes line segments. Student: You said something about you can take the line~ and a signal and @0765make it sound like an oscillator? Miller: Yeah, Maybe I shouldn't have said that. If you want a kick drum sound? Make one of these. [tone] Miller: Sorry. Make one of what I just did -- not one of what you just heard, make one of what you just saw. @0780I shouldn't be telling you this. This is not good computer music here. But you can listen to the line~ object, right? And if I do this people won't hear @0795a thing and they can just see the speaker come move a little bit. Maybe, not even. But if you do this real fast -- like, if I replace these numbers with tiny numbers, like this. Let's replace this by 4 and make all these @0810numbers, you know about 2. Then I've got a nice sound that puts out. That's this. Oh. There it is. That's the sound of a pulse. You can't really see it in detail, @0825but that's a ramp that's going up in two milliseconds, then it's staying at the top for two milliseconds, then it's coming back down. Six milliseconds wide, which means that the bandwidth of it is .. well never mind, it's audible. It happens fast @0840enough that you can hear. Student: Then that number is the amplitude? Miller: The first number, yeah. 0.95 is the height here. Amplitude is one of these terms @0855that can mean anything ... But amplitude here is just how big it is in some sense. So yes it's the amplitude. Student: Could you make that .95 be -.95? Miller: Like this. @0870Right? Anyone want to predict what that will sound like? Yeah? Student: Won't it sound the same? Miller: Yeah. Looks different, but sounds the same. By the way, there's no reason that your ears couldn't have been designed in such a way that that would sound different. @0885That's a way that you can encode secret information in a signal that no one can hear. You've got the sign as a completely inaudible -- but very present -- parameter. OK. @0900So there's that. Let's get back to reality here. Anyway, let me go back to real reality, which is I'm going to go back to using this as an envelope in some kind of a reasonable way. OK. @0915Now you didn't hear this because I just played the output of the line~, not the thing that is having its amplitude controlled by that. But you can imagine that if you took a sinusoid @0930and multiplied it by a signal that started at 0 and gradually went up to 1-ish and then went back down to 0 that you would hear the sinusoid turn on and off. That's what you heard before, which is this sound. [tone]@0945Furthermore, it might be helpful to graph that.[tone] Student: @0960Can you tell us how you have the parameters of that "x1-13" array set? Miller: Oh. The array is going from minus one to one and it's 44,100 points, which means @0975one second. I have it graphing points and not lines, I think. Oh wait, it doesn't look like I'm doing that right so maybe that's not true. One little thing about @0990that, there's another good thing in the properties of an array which is that there's someplace where you select whether you want @1005to save its contents. OK,@1020 here it is: "Save contents." If you un-check that then it will not pollute your patch with 44,100 values of whatever is sitting in your array. And then when you load the patch, it'll be zeros and your patch will be many many lines smaller, @1035which might be a good thing as soon as you start putting large values in arrays. Student: Do you know of problems or quirks with dragging the properties window on a Macintosh? Miller: On a Macintosh? Miller: @1050Yeah, you have the test version from December, maybe you still can. Miller: OK. @1065This sounds eerily familiar but I thought this problem had gone away. I've seen this, I saw this last year so @1080I should go back to worrying about that. I suspect that there might be weirdnesses for OS 10.4 if you have an old Mac but now? -- @1095because I heard some reports about that. So I don't know, maybe I should look at it later. I know what it would look like because I think I've seen it but it's odd that it's still happening. So, yes, everyone else: On a Mac, when you do this and get the properties @1110do you have a way of moving the properties out of the way? Because...no, that's not good. I've had it on Macintosh's sometimes happen that you get the two, these two dialogues show up and the @1125array properties are right behind the canvas properties and, furthermore, you don't get the area that allows you to drag the windows so that you can't move it. Student: On my Mac, you can. Miller: You can... You can't ... @1140OK, so it's 50/50 whether you can move it or not. [laughs] OK, I better go looking at this. @1155What you are looking at now is not the output of a line~ but the result of multiplying it by the oscillator . You've seen @1170what the oscillator's output looks like, it's got a constant amplitude of one and it's batting up and down rapidly. Now what we have is nothing because no matter what's coming out of here you're multiplying it by zero, you're getting zero. And that's nothing @1185for the first 100 milliseconds until the thing ramps up and then there's a period of 100 milliseconds, (it's not too clear) where the thing is flat, and then there's a period of three hundred milliseconds where it goes back down. Miller: And this is what the output of a well-formed computer-music-@1200style instrument should look like. It should turn on in a gentle way. At least it shouldn't turn on by just turning on, and then it should turn off by just turning off here. So bad computer music style might be to - be to @1215do something like this. Actually I'll just simulate it. Suppose I either didn't put the line in or just put the thing right in the multiplier like this - yeah, here. @1230I'm just trying to figure out how not to be confusing -- Maybe the least confusing thing is I'll put times of zero here (for the line~ objects.) Now we have a computer music instrument @1245that makes a pop when it turns on and off. OK. Differently, to boot. What you see is every time that I whack it I get something somewhat different. It jumps from @1260zero to some value. Whose value depends on what phase the oscillator happened to be at, at the moment I clicked the button. Or actually, at the moment the computer decided I had clicked the button. @1275And so at that particular time we didn't get a huge click because the value was relatively close to zero right when I whacked it, but if I whack it again - That one really was smooth on but it was not smooth off. @1290You just get what you get. There it was bad - it jumped almost to full blast right at the outset. OK? This is a good way to make annoying sounds. Miller: As a rule of thumb, @1305this is either a function of psychoacoustics or personal preference, depending on your philosophy. If you give this thing at least five milliseconds to go up and down, @1320you will get something that most people don't perceive as having a click at the beginning and the end. And that, in my opinion, is about as fast an attack as you should have on something@1335 if you don't want to have a snapping sound, or a click. Unfortunately, that number is not a constant of nature. That number depends on the frequency of the oscillator. For low frequency tones, like 50 Hertz-ish, @1350you will still hear an ugly popping sound even at this speed, and you'll have to make this number larger. So then it's a question: how do people who play bass, play their instruments? @1365It doesn't take 20 milliseconds for a bass to start sounding. And so there is this ramp of 20 milliseconds and yet the bass, when you pluck a string, doesn't click. There is a reason for that but I'll try to explain that later on. @1380It is possible to make things that go on quickly without clicking even if they have bass frequencies. But you will have to be smarter than what I've taught you to be so far in order to pull that one off. In particular you should make it so that the phase of the oscillator is something appropriate for @1395quickly starting up, when it starts. Miller: So we have a sort of barely acceptable computer music instrument here. And while were doing computer music lets make this delay be @1410just the rise time which is five and lets make this delay the half second. Now we have the standard computer music @1425bell. This is incorrect by the way. There is no bell that decays linearly. What would be the correct decay shape for a bell? @1440Logarithmic? Well yeah, logarithmic that's one way to say it. It should be a falling exponential. Which is to say, if you took the logarithm of it you should see a straight line going down. It's an amazing fact that a mass-and-spring system. Like the ones you studied in Music 170 as they @1455decay they lose a fixed number of decibels per second. So if you believe in decibels as a psychoacoustic measure, the rate of drop off is actually constant whn you listen to it. Which is why bells work as musical instruments in some sense. This @1470doesn't work it sort of hangs in the air and then ends in this sort of -- I don't know what. That doesn't sound right. It sounds like it was ringing for a while and then someone damped it. @1485As opposed to someone let it ring. And if I graphed the logarithm of this which would be how you heard it. In other words if I graphed it in decibels. It shouldn't take the log of this. Well it could take the log of of this: @1500This is now this is showing the envelope generator again. If I took the logarithm out of this you would see something that started off not quite level but then suddenly started dropping precipitously later on. @1515Until finally here it hits minus infinity because the logarithm of 0 is divergent. Questions about what I just put down? I'll probably say this @1530again and again, in many different ways. Yeah? Student: So, how would you change it to logarithmic decay? Miller: Yeah, how would you make it be logarithmic? Oh that's a good one! I intend to bend your ears very seriously about that in the coming weeks. @1545There are five or six ways you can do it. Depending on the exact spin that you want to try. @1560One thing that you could do is you could say, ... Oh you know what? I'd have to use an object here that I'm not ready to use yet. So let me go on to units because once I've talked a bit more about the @1575psychoacoustic units then I can answer questions like that a little bit better. Other questions? Yeah? Student: In the line~ the "500" was 500 milliseconds. What is the 44,100 number? Miller: Yeah. Oooh, @1590that is a good question. OK. Units in PD are confusing. 44,100 is the numbers of samples in a second. 500 is the number of milliseconds in a half second @1605and sometimes in pd-Land time is in samples, and sometimes time is in milliseconds. This is just kind of unfortunate, I don't know anyway around this situation. PD here doesn't actually believe that @1620the axis here is time, this is really just an array of numbers. Which of course you could treat as an audio sample which is the way I'm treating it right now. But it could be probabilities or it could be weather data or @1635anything. If you want to use this to store a sound, the natural thing to do is have the horizontal axis be samples of which each one is 1/n-th of a second where 'n' is the sample rate. @1650And that number varies - if that number were always the same things would be a lot easier, but in fact sample rates vary depending on what you're trying to do. If you want to find about a dolphin's songs you should not @1665operate at 44k1. You should operate at a couple hundred thousand at least. That explains the value 44,100, which was the size of this @1680array which we set in the panel where you set the size of the array. Here, these are values of time, which are of interest to line~. So another part of the answer to that question is @1695that different objects - for instance, line~, or osc~, take their inputs to mean different things depending on their functions. So for osc~, its input is setting the frequency of that object. And @1710line~ -- when I'm sending it messages like this -- the message is interpreted as, "This is an output value which itself is in arbitrary units, which matters to the next object down. The second thing is @1725 a time which is in milliseconds. And that is possible, because line~ is a thing which actually runs in time, and so it has access to what the real value of time is so it can operate on a time unit as opposed to a unit of samples. Student: @1740Could you use line~ to set the frequency of an oscillator? Miller: Yeah. That's a fun idea. @1755You could use line~ to set the frequency of an oscillator. The answer is yes you can and why not. Miller: @1770Now these are not good frequencies for an oscillator, right? So, 440 and lets make it a half second. All right. @1785So, now I'll turn it on [plays tone and modulates pitch by an octave.] @1800Now we've got full computer music, right? [laughter]. Well, never mind that comment ... You can hook anything to anything. The only restrictions being is that there is @1815a distinction of type, which is to say something can be a number which is happening at the time of messages, or something can be an audio signal, which is something that comes out of a ~ object. Yeah? Student: @1830Could that line~ there be a message line. Is there also a message version of line? Miller: There is. You could do this: Watch this connection when I change that -- Boing! -- It turns into a message line! Now, @1845you'll get a wonderful effect [plays tone]. Let's make that a smaller number. No, it's too small @1860[plays tone]. You can almost hear it now. Hear an arpeggio? The reason it's arpeggiating like that - I'll put it @1875more in your face [makes adjustments to line values]. The reason you hear those values in the middle ... This thing, which I wasn't going to tell you about, is a version of line~ which puts out messages @1890at a fixed rate. What rate? The rate that defaults to 20 milliseconds. Why 20 milliseconds? Because people used to use this to control midi devices @1905and if you try to ram more than 50 messages (per second) down a midi device line you can get in trouble for various reasons. So, this (message-version of line) exists. And anyway sending a message to osc~ @1920changes its frequency just fine, but it changes it in a way that happens right when it's going to happen, as opposed to doing it continuously the way a signal would. Another way of seeing that is @1935our old friend, print. First off, there's nothing coming out of line, but if I tell it to ramp up to 880 ...[showing the pd window] ... @1950whoops. It's already at 880. That wasn't a good example; I'll ramp it back down. And, it says, "oh, OK. 20 milliseconds later they're here and here", and this is the arpeggio that you heard which was too fast to be able to hear very well @1965[playing a series of frequencies]. The version I showed you before @1980which is [plays frequency pattern] this smooth one. Was that clear to everyone? Student: So, line is discrete and line~ is continuous? Miller: Yeah, line~ makes it into an @1995audio signal, which for practical purposes is continuous. In fact I think using the word "continuous" is a bit of a lie because it's really just "continuously at the sample rate." Oh yea and we can do that here too, @2010and this is going to be rotten. Let's do 100 here. I don't hear anything wrong. @2025If we listen to this over headphones you wouldn't like it though. Can't hear it in this room I don't think, at least I can't. What you should hear is a gritty sound that's called "zipper noise," @2040which is the effect of this thing now. So you have five steps, going from zero to .95, and this thing is changing discontinuously, which is therefore a click, like this. @2055Let's see, so here's the crude way to turn things on and off.[ Uses only "0" and "1" message boxes.] OK, so if you do it this way @2070you have the same thing, but each of the jumps is only a fifth as large so they're quieter and buried in the sound of the oscillator, but if you do that with your headphones you can hear something bad. It's actually, it's easy @2085to track problems down when things are really bad, but when things are only just a little bad like that, then you will have to listen to your thing very much more carefully and more critically on order to be able to find find the problem. @2100It's better if you can to avoid getting into that situation. So that's line, as opposed to line~, which would do it correctly. Student: The message at the top is @2115every tenth of a second after you click it, it takes a tenth of a second to go to 110. Miller: OK, let me see. OK. See, you're referring to this network over here, I'm assuming? Oh -- these two, @2130oh OK. So what's happening here is - Right. OK. Whenever I whack it, over the next tenth of a second when I whack it, it ramps from wherever it is up to the values, @2145or down to the values it needed. Student: So assuming you just turn on the DSP ... So what's the starting value? Miller: Zero. So now, for instance if I'm playing the sound and I say 'OK give me a new one of these, it's putting out zeros @2160until I decide to send a message telling it something else. Now that we've done that, @2175remember that I showed you how to do rudimentary frequency modulation? (This isn't exactly an aside, this is an embellishment.) So we save as, ["3.fmagain.pd"] @2190and we're going to say three FM again. @2205And now let's see - lets get rid of - sorry, OK. I don't need this anymore. What I need is another oscillator whose frequency is ... -- I'm going to recreate as much like the @2220old values as I the old ones I can remember. So I'm going to add 440 to another oscillator in order to create this oscillator. And that other oscillator is going to be an oscillator with an amplitude control. So lets get @2235these two things out -- oh these three things out. So this is an amplitude controlled oscillator. That's all you really need to do it. So here now if I listen to that @2250like this I get, whoops I don't have the off button sorry. OK. There's that and now we're going to take that instead of @2265setting it up to an amplitude of 1-ish I'm going to set it up to an amplitude of 1,000-ish. Do not play this through the speaker. And meanwhile I'm going to make it slower so you can hear what's happening. @2280And what I'm going to do to this, is I'm going to add 440 to it and make it be the frequency of another oscillator. @2295Let's just make sure this is off. And I'm going to clean it up a little bit so that you can see a little better what's going on. Alright, Oscillator. OK. Now what were listening to is this oscillator right now its playing @2310at 440 Hertz and this is going to apply vibrato to it. Vibrato is going to be at the audio frequency also at 440 Hertz and its going to have amplitude of zero up to 1000. OK. @2325And that's the sound that I incorrectly said was @234060's computer music. This was invented or published in 1973 so this is 70's computer music not 60's computer music. That's a correction from last week. My apologies to John Chowning if he ever sees this video. @2355Oh, John Chowning is the originator of the frequency modulation technique, as we all know. And anyone who has a cell phones uses FM all day long. For which I once heard John say he was sorry. OK. @2370Is it? -- Now this is an excellent moment to ask if you understand what's going on or not. Let me tell you one useful thing. Student: @2385Can you say what the graph parameters are? Miller: The graph parameters -- OK. I didn't actually graph anything just now. The graph parameters are properties. It's got a name (x1-13) it's got size 44,100 @2400and I am saving contents which I probably shouldn't and I have these polygons despite the fact that I might need points. Whoops, I closed the other thing too. @2415And then the "canvas" -- that is to say the graph that it's in -- the horizontal range is set so that it holds the array. You can change that but- Student: Doesn't the array actually have 44,101 points? Miller: @2430Oh, OK. So arrays actually are indexed starting with zero, c-style. So really the graph could have been from 0 to 44,099 but @2445what would that change? That might move one thing over one pixel. Also, I mean you also can lie to it. You can say "I want you to start graphing at 1000 please." You probably shouldn't do this ... and then it's all very good except @2460the thing is - Oh, look at that. I just destroyed it. What did I just do? Hmm. All right. Can't see it anymore. @2475I didn't want it that way anyway. So what's happening here is: first off @2490this thing is repeating every... hmm, I don't know how to describe this... OK, this is an oscillator nominally which is operating at 440 Hertz and I'm applying vibrato but the vibrato itself is @2505repeating every 440 Hertz. What that means is that rather than changing the heard-pitch of the thing, I'm changing the pitch so fast that it's actually changing the waveform. Or, @2520to put it another way, the result is repeating still every 440th of a second. The thing's repeating at 440 Hertz still even though its pitch nominally is changing, it's happening within a cycle and the cycle is always the same @2535period so we don't hear any change in pitch when we start applying vibrato [the original 440 Hertz oscillator alone] [then ramping-in the vibrato changes the timbre.] Miller: @2550So, if we're not changing the amplitude, and we're not changing the pitch then old psychoacoustics joke is: If something isn't amplitude and it isn't pitch, then it must be timbre. @2565So we're making a timbrel variation on the sound and there are ways of describing mathematically what's happening here which I won't go into but I will go so far as to graph these waveforms so that you can see the vibrato in action. @2580And it's a good thing. To do that now, I have now to change the parameters of the table. "Properties" -- OK. So let's have @2595the thing only be 1,000 points now. Yeah. Let's see. Let's graph @2610just the output of the oscillator without worrying about the amplitude. -- And ... it won't do it! .. Because I have to do something else. This is the old 43-test bug. Yeah, question? Student: @2625Does that 440 in the oscillator add to 2000? Miller: It does, yeah. Oh, yes. Thinking of it that way, the first oscillator is 2,000 volts right now. It's actually varying from plus or minus @26402,000 volts and I'm adding an offset to that, so it's varying from +2,440 and - 1,560. Yeah? Student: Sorry, could you explain @2655the values in the message box and what goes to the *~? Miller: OK. This is going to be the target value that line~ gets, so if I graph the line~ output it would be 2,000 units north. Student: But that 2000 ... @2670what units is it in? Miller: Oh, what unit is it in? It's in whatever units the thing I put it to is taking it to be. In other words, it's really just a pure number. The units only become relevant when you use it for something, which is down here. @2685So it's really just knowledge about the patch that this is all operating in Hertz and the reason it's operating in Hertz is because this oscillator wants the thing in Hertz, or cycles per second. Yeah? Student: @27002,000 is the amplitude connected to the value of the oscillator, right? Miller: That's right. And that's why "amplitude" is such a slippery word. It's both an amplitude, but it's an amplitude that's in Hertz. Student: It's a magnitude. Miller: @2715A magnitude? Yeah. This is a question. I think of amplitudes as being able to be positive and negative and magnitude as being the absolute value of the amplitude. That might be a @2730local usage of mine. It's the usage that's in my book. It's also what the quantum mechanician would say, I think. Student: If that's 2,000 Hertz then it's not oscillating at 440 ... why doesn't the pitch change? Miller: @2745That's right. And yet the change that I'm making in the frequency of the oscillator is varying, but it's varying in such a way it all adds up to no variation @2760because there's as much positive as there is negative. So half the cycle here this thing is adding to the frequency, the other half is taking away from the frequency, so the average frequency is still 440 even though @2775it's going up to much higher than that and down to something negative. Yeah. Let me see how you graph it. @2790Let me graph it. Hang on to your questions for just a second. I'm just going to change it [the Y-range] to +2, -2 again. Miller: @2805@2820@2835OK, so now we're looking at the oscillator, but we're not changing the frequency. @2850So now you see the period of the oscillator is from, for instance here to here. So it's about 2/5ths of this number line. OK, I changed the window by the way, so that it's at 250 points now. So it's a very short amount of time in the life of this sound. @2865Now I'm going to send the oscillator up to amplitude 2,000. I'm not going to graph that (first oscillator), because it would go through the roof. But you can still now look at the output of this (second) oscillator, and then you get - OK now, @2880this requires some explanation. It still has the same cycle, but let me ... - Before I give it 2,000, let me give it some smaller number like @2895440. No, smaller than that.... OK, here, this is easier to understand. @2910So you see it's still cycling from here to here. That it's going too fast, and then after that , it's going too slow. It's going faster here because at @2925this moment in the cycle, this oscillator was positive, and therefore was adding to the frequency. So it sped up to some frequency much higher than 440 Hertz. But then over this period of time, it has slowed down to some frequency much lower @2940than 440 Hertz. And on average, over the cycle, the frequency was 440, and so it actually made it through the cycle in the correct amount of time. But it did it in a non-uniform way, @2955whose result therefore was not at all a sinusoid. And then if you listen to it, you won't hear a sinusoid, you will hear some other waveform that has some other partials, because waveforms have partials. @2970OK. Now what was your question? Student: What would you do if you only wanted magnitude, you wanted the lowest value to be 0, instead of @2985going between positive and negative? Miller: Oh, yeah, there's a couple of ways you could do that. You could take the absolute value. Which means negative values simply be negated so they become positive. Or you could slide the whole thing up @3000by adding one to it. And then you would just see the entire waveform do that. Oh, that would be if you added one to this oscillator. This oscillator right now has an amplitude of @3015330 but I'm adding 440 to it. So if I graphed it I it would go up to positive in fact. It's all ranging from 110 to 770. Student: So those are all magnitudes? Miller: @3030Yeah, in my way of using amplitude and magnitude I would say that magnitude is the amplitude because the number is a positive real number, whose absolute value is itself. But I would never say something like that except to confuse someone. @3045Goal achieved [laughs]. So these are amplitudes which are variously positive and negative. But if you add enough to @3060a sinusoid - if you add enough of a constant to a sinusoid it would be positive and the samples would all be positive. Student: Then you wouldn't have phase issues? Miller: Oh boy you always have phase issues. But they would be different phase issues. -- @3075But that probably didn't answer your question very well did it? Student: Sort of. I can just look at it on the computer. Miller: Yeah, I think the gist of it, you're confusing yourself by using the word magnitude. Student: @3090I just wanted all of the values to be positive. Miller: But how would that help you? Miller: @3105Yeah I think I could do that to this and then the frequencies wouldn't - whats the right way of saying this. @3120Obscure it, the results would be complicated. Yeah OK. Miller: So OK. So now if I make this value bigger, @3135let's try 1000. Student: You don't have a second value in the message to line~ , where you have 1000 as the first value? How long does that line~ take to ramp up? Miller: Zero. That just means "do it right now please." So this is equivalent to "1000 space 0." @3150And now we have the following hilarious sinusoid which did get around to phase zero once in the cycle but in fact was going -- @3165you can't see it right now. I'm going to just scramble the phase a little bit and see if we get a better one. Oh, there we go. Alright. So at some point it hits zero phase and then it goes racing along @3180until at some point it decides "No I went a little bit too far ;lets go backwards." And so I think at this portion of the waveform I think it's actually a negative frequency going backwards until it decides to come backwards enough to rush forward at @3195superior speed. So by pushing the - OK. So what I did was I made this oscillator have amplitude 1000 which therefore is so great that even after you add @3210440, you have both positive and negative values. And therefore you see the thing wrapping both forward and backwards in the cycle. Student: Can we hear what that sounds like? Miller: Yeah. In fact, you can do @3225more of it. So now I'm going to ramp it up to 5,000 and then graph it. Yeah --2,000, sorry. Yeah, yeah. Alright. Let's make it 5,000. @3240Oof -- There maybe I shouldn't be graphing points after all. @3255Let's go back to graphing this stupid way with polygons. Polygons are better if you have smaller numbers of points. --- There we go. This is the classical, pedagogical waveform that we show @3270when you show frequency modulation. The thing is wrapping forward crazily and then wrapping backward crazily to add up to just one cycle forward. Yeah? Student: Does the oscillator still output 440 Hertz even @3285when 5,000 is added to it's frequency? Miller: OK. Sample this oscillator and the oscillator's frequency is averaging 440, but it's varying by 5,000 around that average, which means it's rarely in the vicinity of 440 anymore. @3300It's just being scattered all over the place. Student: How does the first value of 440 fit in? Miller: Oh, this is getting added to this oscillator. @3315Oh, you mean this 440 on top? Oh, that's a good question. What if I make this 440 something different? Let's turn it off first. So now we're listening to @3330the same thing. Then turn on the variation: Now what we have is something that looks like this: [tone] @3345There's the original tone, which is an octave higher. Now what I'm doing is I'm varying the frequency at a rate so that it evens out completely only over two cycles. @3360So the resulting period is in fact 1/220th and not 1/440th. So this (220) is the frequency at which this thing is changing. Now @3375the variations are taking twice as long to cycle, but this (440) is still the center frequency, which could be some other number if we wanted to. Yeah? Student: How does the line~ control the changes? Miller: @3390Right. The line~ controls how widely it's varying around the center value of 440. Student: @3405And the starting frequency of 220 controls how quickly those changes happen? Miller: It's how quickly the variations happen. Yeah! Yeah, yeah that's it. So the frequency of this oscillator is 440 with disturbances. The disturbances have both an amplitude and @3420they have a speed. So the speed is 220 times a second and the size of the disturbance is 5000 or whatever it is that I set it to. Student: And its 5000 Hertz? Miller: Yeah, because it's being used as Hertz @3435because oscillator is ... These magnitudes are eventually finding their way down here and then they're being used as Hertz. But I could use this to read a sample or something like that and then the units would be different. Miller: Yeah? Student: @3450Is the 5000 frequency really just wave shaping? Miller: It is FM modulation. It's frequency modulation. @3465Which is "FM." You could even think of it being as overdrive in something too, but I'm not sure what. Yeah maybe, I'll talk more about wave shaping and over-driving and stuff later on. @3480It is a sort of overdrive. Now OK, so gravy on the cake is why don't we just make this thing be something we can control. Like this: ...Now I'll go back to the original(440). @3495The amplitude now is 1000 and now I'll start changing the frequency continuously. @3510[tones] @3525Alright, oh so this, now looks like this. And @3540you don't see a period in fact, you have to wait an entire second I think, no, you have to wait a fifth of a second before the thing all wraps around. So now you get something which is a nice @3555inharmonic tone. And you can analyze this and find out what the frequencies of the inharmonic partials are which I think we'll manage to get into in week six or seven, but here I'm showing that this is a thing that you can do. @3570Now, of course the amplitude can still be varied, the amplitude of the modulating oscillator can be varied and then you get [tone]... @3585one of these good 1970's computer-music sounds. Yeah. Student: Instead of making line~ do it in five seconds can you do it in one second? Miller: @3600Oh yeah OK. All right speed it up. Now, this is going to sound bad with these values ... [speeded up variation plays]. Student: @3615That doesn't sound bad. That sounds awesome! Miller: OK ... I guess you could like that ... [laughter]. What I don't like about it is that you hear this little @3630wah-wah effect as it's changing and you can't get that wah-wah effect out. And it's cool for the first five minutes but then you get really tired of it. And you can't iron it out -- you just have to turn to a different sysnthesis method at that point. @3645Most people who use FM, don't use these kinds of values. They're good pedagogically, because there's no way you can miss hearing it. If you keep these values upon the order of this (440) or maybe even twice as much as this, you don't get that wah-wah, @3660but you still get a timbrel variation. -- But you don't get a whole lot of high partials, so then, if you want high partials but not the wah-wah then you have to think a little harder. There are five or six ways I can tell you of proceeding. But, that happens later. Miller:@3675Other questions about this? There's a homework assignment for next time which is on the (~msp) website, but I haven't made the WebCT upload-yoohah yet. The homework assignment is @3690actually not to do FM, but is something that you will need line~ for, which is to make a collection of four oscillators which makes a tone and breaks up into two tones. After you've enjoyed it for awhile. Let's see if I can actually find it ... @3705 @3720The gotcha is I don't think I'm going to be able to get my computer to play this. This is a graph that shows you how you can do the thing. Which you will not be able to hear @3735because I'm not configured ../ It's playing out some other audio device that I don't know how to control. You'll hear it if you play it. It will start out as a nice @3750tone. This is a time versus frequency plot, which is a way of describing how you might wish the partials of the sound which would be sinusoidal components which would add up to make a sound -- if you believe that sounds are made up of sinusoids, which they @3765could be. So, what I'm describing here is how the frequencies of a bunch of sinusoidal components might change in time. If you played this and, for instance, -- the amplitudes, they're not shown here, but if you made the amplitudes all equal, which would be a good idea -- when you play these four @3780you will hear a tone. At least if the four sinusoids start at the same time, you'll hear a tone, whose frequency would be that of the fundamental -- which I think I suggested might want to be 220 Hertz. And @3795so if that were true this would be 220, 440, 660, 880. And you would hear a nice tone until this thing happened. At which point a wonderful psychoacoustic effect would take place. Which is your ear would quit being able to hear this as a tone. You would still @3810hear this and this being fused as a single tone at this frequency, although its timbre would change because it would no longer enjoy even harmonics anymore. And meanwhile you would hear this, these two. ... Oh, what's the interval between this partial and that partial? Student: @3825Is that the ratio? Miller: What's the interval? Two to one is the ratio. Yeah, so an interval is a ratio, really. So the interval of two to one is called an octave, in Music Land. So since these are an octave apart, @3840they in fact could also function as a tone at this frequency that has two partials. And you will hear that tone as soon as this thing starts sliding away, because your ear will no longer allow it to hide @3855behind these partials to be considered part of this tone. So what you'll hear is a single tone that bifurcates into two tones paradoxically. One of them consisting only of odd harmonics, harmonics number one and three. @3870And the other consisting of harmonics one and two of a different pitch. And that's a wonderful thing to contemplate. I didn't bring it along this time, but @3885next time I'll play you some music by Jean-Claude Risset which uses that in interesting ways. Basically, you can design timbres that you can tear apart and make series of pitches out of. Or collections of pitches out of. It's fascinating. @3900And, it is indeed 60's computer music, because that was stuff that they did even before they had access to frequency modulation. So this has nothing to do with FM. You can do this just with additive synthesis. Sorry -- "additive synthesis" is what computer musicians say when they're talking @3915about making a bunch of oscillators and adding their results. So you can make this by adding four oscillators up. And now that you know about line~, you can arrange for the frequencies of oscillators to slide from value to value. And of course you should make the whole @3930thing turn on in a smooth way and then do this, and then turn off. And that will require also that you have delay objects because you want the ramp up to start here but then you want the change in frequency to start here @3945and then you want a ramp down to start over here. Student: You need the other objects with line~ and delay, too? Miller: Yeah, and oscillators, yeah. It's, basically, you just practice with the objects that you all know about. Yeah. Student: @3960So line~ can ramp the volume down too? Miller: Oh, how would you ramp the thing down? Yeah, you can't show it, I'm not graphing amplitudes here but frequencies. So I would have to make a separate graph to show how the amplitudes would change. And, yeah, just have a line~ multiplied @3975by the whole wreck. And then it, after an appropriate delay you send that to a nice message zero with a time value. And then it would turn off. And then when you do that you will have full access to all of @3990additive synthesis. At that point you can make more complicated ... -- Well, OK, your patches will be horrible if you actually try to do it without introducing some automation. But you will at least in principle have control over over the @4005structure of the harmonics, or enharmonic partials of any sound that you want to make. Which could be powerful.