*** MUS171 #04 01 13
Miller: @0000 The new objects for today are going to be... my memory's long here...we're going to find out.
es: @0000
@0015 Six 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
es: @0015
@0030 showing 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
es: @0030
@0045 the 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
es: @0045
@0060 is 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,
es: @0060
@0075 various 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
es: @0075
@0090 in 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
es: @0090
@0105 in 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
es: @0105
@0120 what that is and decibels which you learned about in physics. Alright, so that's physics
es: @0120
@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
es: @0135
@0150 and 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.
es: @0150
@0165 But 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
es: @0165
@0180 that 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~,
es: @0180
@0195 pretty 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
es: @0195
@0210 line~ 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
es: @0210
@0225 elements 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
es: @0225
@0240 graph a second of it. Wait a second before you see it and then you see if
es: @0240
@0255 I 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
es: @0255
@0270 version 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
es: @0270
@0285 well 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
es: @0285
@0300 audible 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
es: @0300
@0315 and 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
es: @0315
@0330 see 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
es: @0330
@0345 at 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.
es: @0345
Student: @0360 Because it takes 300 milliseconds to from 1 to 0?
es: @0360
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 @0375 make it painfully obvious -- we'll put a delay on the message, like this.
es: @0375
@0390 OK. 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].
es: @0390
@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
es: @0405
@0420 300" 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,
es: @0420
@0435 which 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.
es: @0435
@0450 Yeah. 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.
es: @0450
@0465 Oh, but with a different button. But now, of course, if I do .this ... -- nothing happens because I
es: @0465
@0480 stopped 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.
es: @0480
@0495 So 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
es: @0495
@0510 will be building synthesizers. Oops, what did I just do? I wanted to make this a smaller delay. ...
es: @0510
@0525 Let'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
es: @0525
@0540 400. Wow, there it is. Alright, now
es: @0540
@0555 someone 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
es: @0555
@0570 clear? 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,
es: @0570
@0585 you 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
es: @0585
@0600 what we have is... I'm going to save this. This is a good moment.
es: @0600
Miller: So what happened is I hit the button, 100 milliseconds later a message comes out of this delay, @0615 a 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.
es: @0615
Miller: The remaining 100 milliseconds between this @0630 300 and this 400 because, another 400 milliseconds later, this message clicks. Yes. Student: Bang?
es: @0630
Miller: Yes. Well. Delay sends a bang, which causes this message box to send a message "0 300" to the same line~, @0645 therefore 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]
es: @0645
Miller: @0660 Yeah. OK. So... Student: Could it replace something you've done before?
es: @0660
Miller: Oh. OK. There @0675 were 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.
es: @0675
Miller: Right? @0690 And 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).
es: @0690
@0705 So, 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
es: @0705
@0720 signal 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~,
es: @0720
@0735 which makes this kind of waveform. OK.
es: @0735
Miller: Now I need another button to press just for graphing. @0750 So there is what the oscillator does. So oscillators make sinusoids. And line~ makes line segments.
es: @0750
Student: You said something about you can take the line~ and a signal and @0765 make 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]
es: @0765
Miller: Sorry. Make one of what I just did -- not one of what you just heard, make one of what you just saw. @0780 I 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
es: @0780
@0795 a 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
es: @0795
@0810 numbers, 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,
es: @0810
@0825 but 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
es: @0825
@0840 enough that you can hear. Student: Then that number is the amplitude?
es: @0840
Miller: The first number, yeah. 0.95 is the height here. Amplitude is one of these terms @0855 that 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?
es: @0855
Miller: Like this. @0870 Right? Anyone want to predict what that will sound like? Yeah? Student: Won't it sound the same?
es: @0870
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. @0885 That'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.
es: @0885
@0900 So 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.
es: @0900
@0915 Now 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
es: @0915
@0930 and 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]
es: @0930
@0945 Furthermore, it might be helpful to graph that.[tone]
es: @0945
Student: @0960 Can you tell us how you have the parameters of that "x1-13" array set?
es: @0960
Miller: Oh. The array is going from minus one to one and it's 44,100 points, which means @0975 one 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
es: @0975
@0990 that, there's another good thing in the properties of an array which is that there's someplace where you select whether you want
es: @0990
@1005 to save its contents. OK,
es: @1005
@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,
es: @1020
@1035 which 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?
es: @1035
Miller: @1050 Yeah, you have the test version from December, maybe you still can.
es: @1050
Miller: OK. @1065 This sounds eerily familiar but I thought this problem had gone away. I've seen this, I saw this last year so
es: @1065
@1080 I 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? --
es: @1080
@1095 because 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
es: @1095
@1110 do 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
es: @1110
@1125 array 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.
es: @1125
Miller: You can... You can't ... @1140 OK, so it's 50/50 whether you can move it or not. [laughs] OK, I better go looking at this.
es: @1140
@1155 What you are looking at now is not the output of a line~ but the result of multiplying it by the oscillator . You've seen
es: @1155
@1170 what 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
es: @1170
@1185 for 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.
es: @1185
Miller: And this is what the output of a well-formed computer-music-@1200 style 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
es: @1200
@1215 do 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.
es: @1215
@1230 I'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
es: @1230
@1245 that 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
es: @1245
@1260 zero 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.
es: @1260
@1275 And 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.
es: @1275
@1290 You 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.
es: @1290
Miller: As a rule of thumb, @1305 this 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,
es: @1305
@1320 you 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
es: @1320
@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,
es: @1335
@1350 you 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?
es: @1350
@1365 It 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.
es: @1365
@1380 It 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
es: @1380
@1395 quickly starting up, when it starts.
es: @1395
Miller: So we have a sort of barely acceptable computer music instrument here. And while were doing computer music lets make this delay be @1410 just the rise time which is five and lets make this delay the half second. Now we have the standard computer music
es: @1410
@1425 bell. This is incorrect by the way. There is no bell that decays linearly. What would be the correct decay shape for a bell?
es: @1425
@1440 Logarithmic? 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
es: @1440
@1455 decay 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
es: @1455
@1470 doesn'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.
es: @1470
@1485 As 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:
es: @1485
@1500 This 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.
es: @1500
@1515 Until 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
es: @1515
@1530 again and again, in many different ways. Yeah? Student: So, how would you change it to logarithmic decay?
es: @1530
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. @1545 There are five or six ways you can do it. Depending on the exact spin that you want to try.
es: @1545
@1560 One 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
es: @1560
@1575 psychoacoustic 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?
es: @1575
Miller: Yeah. Oooh, @1590 that 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
es: @1590
@1605 and 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
es: @1605
@1620 the 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
es: @1620
@1635 anything. 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.
es: @1635
@1650 And 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
es: @1650
@1665 operate at 44k1. You should operate at a couple hundred thousand at least. That explains the value 44,100, which was the size of this
es: @1665
@1680 array 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
es: @1680
@1695 that 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
es: @1695
@1710 line~ -- 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
es: @1710
@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.
es: @1725
Student: @1740 Could you use line~ to set the frequency of an oscillator?
es: @1740
Miller: Yeah. That's a fun idea. @1755 You could use line~ to set the frequency of an oscillator. The answer is yes you can and why not.
es: @1755
Miller: @1770 Now these are not good frequencies for an oscillator, right? So, 440 and lets make it a half second. All right.
es: @1770
@1785 So, now I'll turn it on [plays tone and modulates pitch by an octave.]
es: @1785
@1800 Now 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
es: @1800
@1815 a 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?
es: @1815
Student: @1830 Could that line~ there be a message line. Is there also a message version of line?
es: @1830
Miller: There is. You could do this: Watch this connection when I change that -- Boing! -- It turns into a message line! Now, @1845 you'll get a wonderful effect [plays tone]. Let's make that a smaller number. No, it's too small
es: @1845
@1860 [plays tone]. You can almost hear it now. Hear an arpeggio? The reason it's arpeggiating like that - I'll put it
es: @1860
@1875 more 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
es: @1875
@1890 at 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
es: @1890
@1905 and 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~
es: @1905
@1920 changes 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
es: @1920
@1935 our 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] ...
es: @1935
@1950 whoops. 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
es: @1950
@1965 [playing a series of frequencies]. The version I showed you before
es: @1965
@1980 which is [plays frequency pattern] this smooth one. Was that clear to everyone? Student: So, line is discrete and line~ is continuous?
es: @1980
Miller: Yeah, line~ makes it into an @1995 audio 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,
es: @1995
@2010 and this is going to be rotten. Let's do 100 here. I don't hear anything wrong.
es: @2010
@2025 If 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,"
es: @2025
@2040 which 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.
es: @2040
@2055 Let'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
es: @2055
@2070 you 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
es: @2070
@2085 to 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.
es: @2085
@2100 It's better if you can to avoid getting into that situation. So that's line, as opposed to line~, which would do it correctly.
es: @2100
Student: The message at the top is @2115 every tenth of a second after you click it, it takes a tenth of a second to go to 110.
es: @2115
Miller: OK, let me see. OK. See, you're referring to this network over here, I'm assuming? Oh -- these two, @2130 oh 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,
es: @2130
@2145 or down to the values it needed. Student: So assuming you just turn on the DSP ... So what's the starting value?
es: @2145
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 @2160 until I decide to send a message telling it something else. Now that we've done that,
es: @2160
@2175 remember 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"]
es: @2175
@2190 and we're going to say three FM again.
es: @2190
@2205 And 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
es: @2205
@2220 old 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
es: @2220
@2235 these 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
es: @2235
@2250 like 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
es: @2250
@2265 setting 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.
es: @2265
@2280 And 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.
es: @2280
@2295 Let'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
es: @2295
@2310 at 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.
es: @2310
@2325 And that's the sound that I incorrectly said was
es: @2325
@2340 60'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.
es: @2340
@2355 Oh, 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.
es: @2355
@2370 Is 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.
es: @2370
Student: @2385 Can you say what the graph parameters are?
es: @2385
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 @2400 and 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.
es: @2400
@2415 And 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?
es: @2415
Miller: @2430 Oh, OK. So arrays actually are indexed starting with zero, c-style. So really the graph could have been from 0 to 44,099 but
es: @2430
@2445 what 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
es: @2445
@2460 the thing is - Oh, look at that. I just destroyed it. What did I just do? Hmm. All right. Can't see it anymore.
es: @2460
@2475 I didn't want it that way anyway. So what's happening here is: first off
es: @2475
@2490 this 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
es: @2490
@2505 repeating 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,
es: @2505
@2520 to 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
es: @2520
@2535 period 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.]
es: @2535
Miller: @2550 So, 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.
es: @2550
@2565 So 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.
es: @2565
@2580 And 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
es: @2580
@2595 the thing only be 1,000 points now. Yeah. Let's see. Let's graph
es: @2595
@2610 just 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?
es: @2610
Student: @2625 Does that 440 in the oscillator add to 2000?
es: @2625
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 @2640 2,000 volts and I'm adding an offset to that, so it's varying from +2,440 and - 1,560. Yeah?
es: @2640
Student: Sorry, could you explain @2655 the 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.
es: @2655
Student: But that 2000 ... @2670 what units is it in?
es: @2670
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. @2685 So 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?
es: @2685
Student: @2700 2,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.
es: @2700
Miller: @2715 A 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
es: @2715
@2730 local 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?
es: @2730
Miller: @2745 That'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
es: @2745
@2760 because 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
es: @2760
@2775 it's going up to much higher than that and down to something negative. Yeah. Let me see how you graph it.
es: @2775
@2790 Let 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.
es: @2790
Miller: @2805
es: @2805
@2820
es: @2820
@2835 OK, so now we're looking at the oscillator, but we're not changing the frequency.
es: @2835
@2850 So 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.
es: @2850
@2865 Now 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,
es: @2865
@2880 this 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
es: @2880
@2895 440. No, smaller than that.... OK, here, this is easier to understand.
es: @2895
@2910 So 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
es: @2910
@2925 this 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
es: @2925
@2940 than 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,
es: @2940
@2955 whose 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.
es: @2955
@2970 OK. Now what was your question?
es: @2970
Student: What would you do if you only wanted magnitude, you wanted the lowest value to be 0, instead of @2985 going between positive and negative?
es: @2985
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 @3000 by 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
es: @3000
@3015 330 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?
es: @3015
Miller: @3030 Yeah, 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.
es: @3030
@3045 Goal achieved [laughs]. So these are amplitudes which are variously positive and negative. But if you add enough to
es: @3045
@3060 a 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?
es: @3060
Miller: Oh boy you always have phase issues. But they would be different phase issues. -- @3075 But 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.
es: @3075
Student: @3090 I just wanted all of the values to be positive. Miller: But how would that help you?
es: @3090
Miller: @3105 Yeah I think I could do that to this and then the frequencies wouldn't - whats the right way of saying this.
es: @3105
@3120 Obscure it, the results would be complicated. Yeah OK.
es: @3120
Miller: So OK. So now if I make this value bigger, @3135 let'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?
es: @3135
Miller: Zero. That just means "do it right now please." So this is equivalent to "1000 space 0." @3150 And now we have the following hilarious sinusoid which did get around to phase zero once in the cycle but in fact was going --
es: @3150
@3165 you 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
es: @3165
@3180 until 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
es: @3180
@3195 superior 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
es: @3195
@3210 440, 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?
es: @3210
Miller: Yeah. In fact, you can do @3225 more 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.
es: @3225
@3240 Oof -- There maybe I shouldn't be graphing points after all.
es: @3240
@3255 Let'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
es: @3255
@3270 when you show frequency modulation. The thing is wrapping forward crazily and then wrapping backward crazily to add up to just one cycle forward. Yeah?
es: @3270
Student: Does the oscillator still output 440 Hertz even @3285 when 5,000 is added to it's frequency?
es: @3285
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. @3300 It's just being scattered all over the place. Student: How does the first value of 440 fit in?
es: @3300
Miller: Oh, this is getting added to this oscillator. @3315 Oh, 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
es: @3315
@3330 the same thing. Then turn on the variation: Now what we have is something that looks like this: [tone]
es: @3330
@3345 There'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.
es: @3345
@3360 So 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
es: @3360
@3375 the 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?
es: @3375
Miller: @3390 Right. The line~ controls how widely it's varying around the center value of 440.
es: @3390
Student: @3405 And the starting frequency of 220 controls how quickly those changes happen?
es: @3405
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 @3420 they 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?
es: @3420
Miller: Yeah, because it's being used as Hertz @3435 because 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?
es: @3435
Student: @3450 Is the 5000 frequency really just wave shaping?
es: @3450
Miller: It is FM modulation. It's frequency modulation. @3465 Which 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.
es: @3465
@3480 It 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).
es: @3480
@3495 The amplitude now is 1000 and now I'll start changing the frequency continuously.
es: @3495
@3510 [tones]
es: @3510
@3525 Alright, oh so this, now looks like this. And
es: @3525
@3540 you 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
es: @3540
@3555 inharmonic 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.
es: @3555
@3570 Now, of course the amplitude can still be varied, the amplitude of the modulating oscillator can be varied and then you get [tone]...
es: @3570
@3585 one 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?
es: @3585
Miller: @3600 Oh yeah OK. All right speed it up. Now, this is going to sound bad with these values ... [speeded up variation plays].
es: @3600
Student: @3615 That doesn't sound bad. That sounds awesome!
es: @3615
Miller: OK ... I guess you could like that ... [laughter]. What I don't like about it is that you hear this little @3630 wah-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.
es: @3630
@3645 Most 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,
es: @3645
@3660 but 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.
es: @3660
Miller:@3675 Other 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
es: @3675
@3690 actually 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 ...
es: @3690
@3705
es: @3705
@3720 The 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
es: @3720
@3735 because 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
es: @3735
@3750 tone. 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
es: @3750
@3765 could 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
es: @3765
@3780 you 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
es: @3780
@3795 so 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
es: @3795
@3810 hear 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?
es: @3810
Student: @3825 Is that the ratio?
es: @3825
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, @3840 they 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
es: @3840
@3855 behind 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.
es: @3855
@3870 And 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
es: @3870
@3885 next 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.
es: @3885
@3900 And, 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
es: @3900
@3915 about 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
es: @3915
@3930 thing 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
es: @3930
@3945 and 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.
es: @3945
Student: @3960 So line~ can ramp the volume down too?
es: @3960
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 @3975 by 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
es: @3975
@3990 additive 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
es: @3990
@4005 structure of the harmonics, or enharmonic partials of any sound that you want to make. Which could be powerful.
es: @4005