*** MUS171 #05 01 18 |
Miller: @0000 This is the familiar network where you have an oscillator with a controllable amplitude. Amplitude of course you control by |
es: @0000 |
@0015 multiplying the output of the oscillator, that's the easy way to do it. And the frequency of the oscillator you control by sending it the appropriate input. So here it is: [Tone] Miller: You can do them both simultaneously, maybe not. |
es: @0015 |
Miller: @0030 Wizard of Oz. And if you want to sequence that, why you don't get some delay objects, so maybe the |
es: @0030 |
@0045 good way to do this is give yourself a button, and then you can have delays. "Delay" you can abbreviate as "del"; there are abbreviations for some of the |
es: @0045 |
@0060 most frequently used objects. And it's going to become important in this particular case. You'll see why. |
es: @0060 |
Miller: So let's @0075 have the button turn this on, and have it to be at 440. The recording will jump to 440; I'll tell you why in a second. You don't want to necessarily slide to the note, if you want to start a note at the beginning of something. |
es: @0075 |
@0090 You might want to have it just jump there. So this is now a button that makes sure that we're at 440 when we turn this thing on. [Tone] |
es: @0090 |
Miller: When you turn something off, you don't have to do anything to its pitch, because just turning the amplitude of the thing by multiplying it by 0 turns it off. @0105 It's still playing A-440, this oscillator is, but we don't care about it. So now a...[Tone] |
es: @0105 |
Miller: You do want one of those -- @0120 it also turns this off, right? So hit that button and turn it off. So you want it to slide to 440 and turn it off. |
es: @0120 |
Miller: @0135 Ah! That sounded horrible. Let's not do that! OK. So now what we're going to do is make a nice little sequence by having "delay 500" successively, |
es: @0135 |
@0150 which will be setting these delays every 500 milliseconds. |
es: @0150 |
Miller: As a matter of survival, if you're going to have a bunch of delays, don't daisy-chain them but have them all come off of the @0165 button or whatever triggered them. Because, why? Because that way when you start it again it restarts all the delays and you won't have messages trickling down the delays when you're no longer trying |
es: @0165 |
@0180 to do certain things. So now what's going to happen is every time I press the button ... yeah, I should do this <<puts indicators that show the delays being triggered>> every time you press the button you start a sequence of delays going. [Tone] |
es: @0180 |
Miller: @0195 [Over sound] Miller: And furthermore, here's a subtlety, when you start a delay, if it was already started, it forgets |
es: @0195 |
@0210 the previous time it had been started for and resets it to the new time you're starting for. |
es: @0210 |
Miller: That's a good way for a delay object to behave, because then it doesn't go off and do something in the wrong order, because you told it to do something and then changed your mind later. If you changed @0225 your mind about what you wanted to do. It is now only doing the new thing, so you can actually believe that things are going to do what you ask them to when you start something -- if you connect to the delay this way. |
es: @0225 |
Miller: If you decide that you want to connect to the delays @0240 successively one to the next, then that won't necessarily be true, each one will set the next one off, and if you reset the first one, depending on what phase the others are in, they'll continue doing their things, and then you'll have different delays fighting each other for control of your oscillators, |
es: @0240 |
@0255 which will not be as good. So it is a good thing not to daisy chain your delays, but to have them all come off the same source like that. |
es: @0255 |
Miller: Now I'm going to make beautiful music. That's going to be, nothing? Oh, @0270 it's going to be a rest. Yeah, that'll suit fine. And then they'll go over there, and then they'll wait another second. I won't even put that delay in there. It should be 2500. |
es: @0270 |
@0285 And here it'll go back down to A and here we'll stop. And now, here's one of the things that's problematic about patching, and I will show you |
es: @0285 |
@0300 strategies later to deal with this: Your patches get messy after you've done a certain amount of stuff. Technique number one: |
es: @0300 |
Miller: Turn the font size down. Other techniques are going to be use more than one window, but I haven't shown you how, and also @0315 use names for things so that everything doesn't have to be a connection. I haven't shown you how to do that either, but that's all coming. And now if I have this right I'll have this this beautiful composition. [Tone] |
es: @0315 |
Miller: @0330 Ta-da! The marching demons in the Wizard of Oz. So this is how to make sequences that do things like control amplitudes and frequencies. OK. Questions about this? What I did and why? |
es: @0330 |
@0345 Yeah? Student: I forgot, for the first number in these messages is for frequency? There's a .03 there. |
es: @0345 |
Miller: Oh! OK, yes. That's the thing. These are @0360 numbers, what they are depends on where you put them. Or rather, how they're interpreted depends on where you put them. So these numbers are frequencies by virtue of the fact that they're talking through this line to this oscillator. But these other numbers are amplitudes because they're talking and this line is getting multiplied |
es: @0360 |
@0375 by the oscillator. So even though the data goes down, in some sense the meaning bubbles up. Student: So it's on the line that goes amplitude and then time...? |
es: @0375 |
Miller: Right. Or value and time or target and time. @0390 I think of it as target, because it's the place where the line will eventually be, or the thing that the line will eventually be emitting, I guess is the right word after the time elapses. Student: So it's another process that determines what they're lined up to. |
es: @0390 |
Miller: Yeah. @0405 Other questions? No. I'll leave this then and get onto fun topics. Not that this isn't a fun topic, but there are other fun topics. ...I'll just do a "Save As", |
es: @0405 |
@0420 remember the font size and start all over again. I'll just do three...table...Oh, no, wait. |
es: @0420 |
Miller: I neglected to tell you a bunch of things last time. @0435 Yes, right. Table oscillators first, and then units, psychoacoustic units which is MIDI units of pitch versus frequencies, and decibels versus linear amplitudes, which I will show you after I show you the basic |
es: @0435 |
@0450 yoga of table lookup in computer music -- Well, phase generation and table lookup, which is how oscillators are made, which is the bread and butter of computer music. And the fact that it's taken me five classes to get here says something either about the |
es: @0450 |
@0465 indirectness with which I'm approaching the thing, or the fact that perhaps it is actually more complicated than I'm thinking to myself it was supposed to be. OK, so we're going to do phase and tables. <<saving 3.phaseandtables.pd>> Do this one. OK. |
es: @0465 |
@0480 And, we don't need any of this except the time for that, so. But we'll keep this around for this, just to be able to use it. |
es: @0480 |
@0495 But...here's where I'll stop, maybe on this. |
es: @0495 |
Miller: All right. So the first thing to comment on is the following: There is an object, @0510 whose name is phasor, which generates phases. These are not useful things to listen to. In fact, let me prove to you this is not useful to listen to by playing it.[Tone] |
es: @0510 |
Miller: This is a bad sound. @0525 The reason is that it sounds like a mosquito is what's called fold-over. Well, there are several reasons it sounds like a mosquito. But the reason it sounds bad in computer music ears is because of fold-over, the fact that this signal is not a good band-limited signal |
es: @0525 |
@0540 that is limited to 22 kiloHertz and a half. It is an un-band-limited signal that has theoretically an infinite trail of partials, and in a digital environment such as in any computer music environment, you will hear |
es: @0540 |
@0555 various kinds of badness happen. What it sounds like is just not exactly a stable quality of the signal. It sounds like it's fluttering a little bit. That is |
es: @0555 |
@0570 fold-over. There are better examples of fold-over that I could show you, but they would be piercingly ugly to listen to and I don't really want to deal with them. Go look at the PD documentation; you'll see a wonderful fold-over generating patch which will make you jump out of |
es: @0570 |
@0585 your chair and spit out your gum. So now why am I showing you this, then? Because you use it to do things like look up wavetables. To show you this, I have to get out |
es: @0585 |
@0600 my array so you can see what's happening. I'll do that now. Sorry this is getting repetitive, but it is what it is. I'll call it <<the Array>> "array.1.18a" |
es: @0600 |
Miller: 18] @0615 And then just going to use a nice tabwrite~ write it. Wow. I shouldn't really have given a long name, should I? "array.1.18a" ... I don't want these to fight with each other if |
es: @0615 |
@0630 you happen to load more than one of these up while you're looking at old patches, which is why I'm making these awful names. I'll show you a better way later, but that will wait. |
es: @0630 |
Miller: So now, one of the things the phasors do that makes ...oh! @0645 Duh! I thought it was me. It actually was me but at a deeper level. Here's a crucial thing to get: Here's a |
es: @0645 |
@0660 sawtooth wave...notice how there are bad kinks in this? That's actually graphics. |
es: @0660 |
Miller: But there are bad kinks in the thing, because sometimes when the thing wraps around, actually let's go to 440, sometimes when the thing wraps around... Since we're at @0675 44,100 points per second, 440 Hertz means how many samples per cycle? |
es: @0675 |
@0690 100 and a fraction, I think, if I'm doing this right. << (41,100 samples/second)/(440 cycles/second) = 100.22 samples/cycle >> |
es: @0690 |
Miller: So it's <<a cycle is>> about 100 samples long. Oh yeah, it's about a hundred samples long 'cause the table's about a 100 samples big. But @0705 it's not exactly 100 samples long from the bottom to the top, it's just that sometimes it's 100 samples and sometimes it's 101 samples.<<A cycle is usually 100 samples but sometimes -- approximately every fifth cycle -- it's 101 samples.>> |
es: @0705 |
Miller: It's not a decent periodic signal, really, it's a sawtooth wave being represented @0720 digitally and it sounds bad. What you do to make it sound good is you use it to look up a table such as ... -- And here's object number two for today: Phasor and cosine are both |
es: @0720 |
@0735 objects you haven't seen yet. The cos takes whatever goes into it and reports its cosine, or outputs its cosine. [Tone] |
es: @0735 |
Miller: @0750 And that's when you get this kind of thing: That's a nice sinusoid. |
es: @0750 |
Miller: OK. So your cosine is not a sine, because cosine is the simple function and sine is the complicated function to @0765 deal with. There's only one wavetable, so it became cosine. With an oscillator, really, you've seen this as osc~. The osc~ is in some sense equivalent to (phasor and cosine). |
es: @0765 |
@0780 Phasor is an object which just generates a phase that goes from left to right if you'd like, a certain number of times a second you specify, for instance by an input. And cosine is a table lookup |
es: @0780 |
@0795 which if you give it 0, it gives you 1; if you give it 1/2, it gives you -1. And if you give it 1, it gives you 1 again. |
es: @0795 |
Miller: And I happened to click it just at a moment when it was going from 0 to 1 in the space of the window. But if I do it again, @0810 you'll see in fact that it's just moving between those two values. That was an accidental click. All right? |
es: @0810 |
Miller: Now, this is interesting because you don't have to use cosines. You can use other waveforms. And @0825 what would be another good waveform? |
es: @0825 |
Miller: Well, for instance, I could ask for the cosine of twice the thing which would be two @0840 cycles of the cosine wave and do that like this: Multiply the phasor by two so that it doesn't sweep from 0 to 1, It sweeps from 0 to 2. |
es: @0840 |
Miller: And then, @0855 when I connect that, you hear [Tone] the octave. Miller: So, there's twice as fast as this. [Tone] |
es: @0855 |
Miller: Well, "twice as fast," that might be confusing. What's really happening is, @0870 think of this as a function. This function is a cosine of twice the input which is to say it doesn't just go from one, to minus one, to one once as the phasor's output goes from 0 to 1. |
es: @0870 |
Miller: As the phasor's output goes from 0 to 1, @0885 this goes from 0 to two and so this thing goes through two cycles. So, you're looking up the second harmonic. So, now you can do groups of harmonically related sinusoids. You can build up tones out of |
es: @0885 |
@0900 amplitudes of individual harmonics by combining cos~, and cos~ of the octave with the cos~ of the twelfth, and so on ... like that until you get tired of making the patch. |
es: @0900 |
Miller: This is @0915 a very simple ... What's the right word? ... a very simple example of using wavetables, of using waveforms, specifying waveforms, which are things which |
es: @0915 |
@0930 you index by giving it a number from 0 to 1 so this phasor does repeatedly at some number of times per second given by its frequency. |
es: @0930 |
Miller: Phasor has memory. It has to remember its @0945 phase from sample to sample. So, it is an effective integrator. The frequency that you put it tells it how much it's going to add to each previous sample to make the next one. |
es: @0945 |
Miller: cos~ doesn't have any memory. It's @0960 just a pure function that takes whatever you put in and puts something out. So, phasor is the real oscillator here and cos~ is a wavetable that the oscillator is indexing. |
es: @0960 |
Miller: And furthermore, this @0975 combination of (phasor and cos~) is what you previously have known as osc~. All right? Now, I told you that so I can tell you this next thing: |
es: @0975 |
Miller: You can make your own tables up. @0990 Here's where, at least in some respects, things start to get fun. So, how am I going to do this so it's in the right space? There, I can't see that so I'm going to cheat a little bit. I'm going to make a window as big as |
es: @0990 |
@1005 I possibly can so I can keep this font. |
es: @1005 |
Miller: That will hopefully make something that can be understood. I'm going to make another table and I'm going to give it, @1020 again, I didn't think in advance, I'm going to give it 8 points. Yeah. And this is now going to be a table, "tab.1.18" -- |
es: @1020 |
@1035 Sorry. That's a bad name. Everything is bad about this ... |
es: @1035 |
Miller: Here's the graph. Yep. We're happy. Everything is good. Now, last time I did this, I forgot that I asked you to do @1050 the points instead of polygons. Miller: Points. So check that we did. I forgot, OK. Now, we have something which we can edit and it's just a bunch of numbers. 8 of them. Right? |
es: @1050 |
Miller: @1065 So, you've seen all of this before except I don't know if you've seen me drawing one, but that's one way of getting things into the table. There are other ways. You can have text in a file. You can, if you want to, |
es: @1065 |
@1080 save the properties and somewhere in here it gives you the opportunity to... |
es: @1080 |
Miller: What does it do? What does it allow you to do? Edit this in by...Oh, got 'em .. where am I now? I'm looking a feature that @1095 isn't there -- OK. I'll show you how to get numbers in there in a good way later. That's going to be a whole other thing. All right? Miller: So, I just put a waveform in here. Now, what I can do is say, "Oh. Let's listen to it by..." |
es: @1095 |
Miller: @1110 OK. Some pedagogical sense tells me I should do this first. We're going to read out of the table and the table is going to be "tab.1.18a." |
es: @1110 |
@1125 Notice, I did not put a tilde in. I'm going to do this just with messages to start with because it's going to be easier to understand what's going on. And then, I'm going to add a tilde and we're going to be operating with signals. So, |
es: @1125 |
@1140 on that Miller: Input number ... and beside it |
es: @1140 |
Miller: So, I'm using a Macintosh keyboard on a Linux machine. The little Apple key doesn't do anything in Linux. @1155 It doesn't think it's an Apple. |
es: @1155 |
Miller: OK. So, I give it numbers like 0 and it gives me this value. I give it a number 1 and it gives me this value and so on like that. And now, I can just go sweeping through @1170 the thing looking at the values in the table. Right? Miller: So, we've got storage. Not only storage, but storage of as many numbers as you want to put in the array. |
es: @1170 |
Student: How come when you go @1185 negative three, it still gives you a value? |
es: @1185 |
Miller: Yes, thank you. What happens when I go off the end of the table is, it says, "Well, that's OK. I'll just give you the closest point to what you had." So, in general, Pd's approach to errors -- @1200 this is not good computer science -- is it just puts guardrails on everything. |
es: @1200 |
Miller: So, if you divide by 0, it doesn't give you an error. It just gives you 0. If you try to read off the <<end of the>> array ... Actually, there's several things it could have done. It doesn't give you an error because then you wouldn't hear anything. @1215 It's better to hear something that's wrong than not to hear anything. Maybe. |
es: @1215 |
Miller: You could also say that "if I gave you a negative value, the thing that you should do is wrap around to the other end as if you were an endlessly repeating waveform." That <<wraparound>> @1230 is done using a different object in Pd. The table doesn't do that and if you want that, you have to use an object called "wrap" which I will introduce later if needed. |
es: @1230 |
Miller: Instead, it simply says, "If you're between 0 and 7, @1245 it will read the value out of the table. And if you're in excess of 7 or below 0, it will simply give you the last or the first value." Which is good enough for us right now. |
es: @1245 |
Miller: Furthermore, if I give it a number like, let's see... If I give it 0 as the first value, @1260 and the last value is 7 because there are 8 numbers -- That's one possible way of counting. That's the modular arithmetic way of counting. |
es: @1260 |
Miller: The other thing is, if I give it a half, what should it do? @1275 That's a trick question on two levels. ... Yeah? Student: You can give it a 1, possibly. Or you can give it less than 1? |
es: @1275 |
Miller: Well between this and this. So, you could just @1290 do what you said, which is to say, just call it 1 or just call it 0. Miller: Oh! And then, should you round, in other words, if I give it a half should round it up to one, or should it just truncate it down to 0? Another thing that... Yeah? |
es: @1290 |
Student: @1305 Could it do interpolation? |
es: @1305 |
Miller: Another thing it can do is interpolation. But then, the question is, how many points of interpolation should you do? And if it's two points, there's really only one good interpolation algorithm. But when you have four or 8 points, there are several different @1320 ways of interpolating that have different properties. -- So, it just doesn't<<interpolate>>. |
es: @1320 |
Miller: If I give it numbers between 0 and one, it declines to act smart. It simply truncates the 0 and gives you that value @1335 until I hit one, at which point, it gives you the next value and so on. Student: So, if you were to go below this number now, does it round down or does it just round one of them up? |
es: @1335 |
Miller: It rounds down. Right. Oh, yes. @1350 There's no memory again so it doesn't know what I asked it previously. So, everything is as if there's no yesterday and it always rounds toward minus infinity. Actually, in table land, it only counts from 0. So it rounds towards 0, we'll call it. |
es: @1350 |
@1365 OK? If you wanted to... Yeah? Student: Can you go and put the numbers in again? |
es: @1365 |
Miller: Yes. @1380 I'm trying to decide which is the best way to show you how to do that and which requires the least constructs. There are about five ways of doing it and I didn't realize I was going to have to do that today. So, I didn't think |
es: @1380 |
@1395 in advance about which one to show you so I'll get back to that. Miller: You will eventually want to be able to do things like throw values in a table. |
es: @1395 |
Miller: Oh! There's a tabwrite~ you can see here, so you can guess that there might be a tabwrite <<without a tilde>>. @1410 But it's not. Remind me to get back to this. The tabwrite is not a tabwrite~ without a tilde. -- It doesn't turn out to make sense to just write sequentially through the table in message land so it works differently. |
es: @1410 |
Miller: @1425 All right. So, here's tabread. Now, you could say, "tabread~" And now that you've heard everything that you've heard, you know exactly what will happen when I run a phasor into tabread~ |
es: @1425 |
@1440 and then, listen to the result. |
es: @1440 |
Miller: Why don't I hear anything? Do I look surprised that I don't hear anything? @1455 I'm not trying to project surprise here. OK? |
es: @1455 |
Miller: What are the values coming out of phasor? 0 to 1, not inclusive. And what does tabread~ do? It rounds down to the nearest integer. @1470 The nearest integer down is always 0 so we're getting out solid, whatever that number was, -.21 and the mixer is then forgetting it because it's AC-coupled. |
es: @1470 |
Miller: So, if I want to hear something, @1485 I would take this phasor and multiply its output by the size of the table. |
es: @1485 |
Miller: @1500 Oh. Here's a thing: You will learn various ways of making your patches not occupy a huge amount of space. Something that I do but you don't have to, is when you're multiplying |
es: @1500 |
@1515 by a line, you put the line next to the multiplier instead of above it. Miller: And if you do that consistently, then you learn to expect it and then it looks normal when you do this, even though, this line almost looks like it's going up. This is the way that I normally do this when I'm working. |
es: @1515 |
Miller: @1530 Now, I'm going to say, "Multiply by the size of the table, please." Oh, I forgot to put a space. |
es: @1530 |
Miller: Oh, hey! Sorry. @1545 I need a tilde because I need a signal multiplier because there's a signal coming out of phasor~. |
es: @1545 |
Miller: And now, this is sounding better than the phasor. Right? @1560 And I have a little timbre-editor. OK. This is not beautiful sounds yet because there are discontinuities in the table. Let's turn this off. |
es: @1560 |
Student: @1575 Doesn't the table go from from 0 to 7, though? Instead of 8? |
es: @1575 |
Miller: Ah, thank you, right. So, why am I going up to 8? It's because if I went from 0 to 7 you would never hear this last value because the phasor @1590 would go from 0 to 7 but it would never get to 7 because the exact value of 7 would wrap it down to 0. |
es: @1590 |
Miller: So if I want to read the entire table, I want to go all the way to 8 even though I know nominally the table stops at 7. So @1605 it's confusing for two reasons that cancel each other out. |
es: @1605 |
Miller: There are 8 things in the table so 0 to 8 sounds natural until you realize that actually they're indexed from 0 to 7. So it sounds like you should go only to 7. But in truth you should still go to 8 because @1620 otherwise you wouldn't get any of the 7 because it would not do it. |
es: @1620 |
Miller: Is that clear? That is either clear or not depending on whether you could follow about three different facts that I introduced in the last half hour @1635 all at once. OK? So you can think of the horizontal axis here as going from 0 to 8. |
es: @1635 |
Miller: In fact I think of it that way, even though the places where the individual points live @1650 are just in integers from 0 to 8 which are 0,1,2,3,4,5,6 and 7 -- but not 8, because then there would be nine of them. |
es: @1650 |
Miller: And furthermore, for it to "spend just as much time," if you like, between @1665 7 and 8 as it does between 0 and 1, you should multiply the phasor's output by the whole number 8 -- the number of points: 8. This will change when we start interpolating the table, because then there will be fewer values that are useful. |
es: @1665 |
@1680 But that will happen later. ... Next thing about this, what if...There is one way of getting values into the table. But we can do it anyway. |
es: @1680 |
@1695 Let's put a sinusoid in here. |
es: @1695 |
Miller: I am going to be a little sloppy, but not terribly sloppy. We're going to say, osc~, and I'm going to give it a frequency which is equal to (the sample rate)@1710 /8, so that its period in samples is 8. Right? |
es: @1710 |
Miller: And I'm going to be lazy and say, give me a message @1725 box which gives me the sample rate which I believe to be 44,100. And then I will say divide it by 8, the number of samples in the table. That will be the frequency for an oscillator. And then I'm going to write |
es: @1725 |
@1740 that into the table. This is called "tab.1.18a" ... confusing, |
es: @1740 |
@1755 all of the above ... |
es: @1755 |
Miller: . OK. write it. And there is our nice sinusoid. Oh, that didn't appear... <<The first value in the table is hidden by the top border of the table.>> ... @1770 Oh, yeah, I started this oscillator up and it had initial phase 0 and its frequency happens to be such that it repeats every 8 samples, so every single time I whack the button it will see it on a |
es: @1770 |
@1785 64-sample boundary for technical reasons. Miller: And I am always going to see a phase that is magically 0 here. That is a weird accident. And now I have this nice table which will sound just like a sinusoid when I play it for you. [tone] |
es: @1785 |
Miller: ... @1800 NOT. Right? OK. This is in fact not a sinusoid but it is the function which is... the same points as the sinusoid every eighth of the cycle, but flat everywhere between it. |
es: @1800 |
@1815 And that is not very sinusoidal. If you did a Fourier analysis of this you would see mostly this nice sinusoid but then you would see a very jagged difference between that and the sinusoid it's imitating. |
es: @1815 |
@1830 And that jagged function would have lots of high frequency information in it which would sound like ... that kind of stuff. [tone] It is even better ... Because now if I go up in frequency. [more tones] -- I'm not going to make you hear a whole number of them; |
es: @1830 |
@1845 I'm not that bad. |
es: @1845 |
Miller: All right? How would you make that better? Put in more points, maybe. Right? So now we can say... @1860 Yeah, so let's get the "Properties" out. I'm going to say the number of points I want ... I don't know, 1,024 -- I am just making |
es: @1860 |
@1875 up a number. Oh, I don't have to use a power of two if I don't want to. Let's make it 1,000. That's just a bad reflex of mine. OK, 1,000 points. "OK." |
es: @1875 |
@1890 Now, the points that were there are still there and it's going to sound horrible if you listen to it. [original tone] |
es: @1890 |
Miller: It's just using the first table. Now I'm going to use 1,000 of them. First @1905 I am going to put a sinusoid in. OK, there is a good sinusoid with lots of points in it, right? And now I have to remember to change this 8 to 1,000. |
es: @1905 |
@1920 Now there's your sinusoid. [tone] |
es: @1920 |
Miller: Don't buy this sinusoid. This sounds good under our current listening conditions, but if you think about it, @1935 the error here is going to be on the order of 1,000 ... well it's going to... the phase is going to be off by a thousandth of a cycle or so. So there is going to be a little lookup error in the amount that you get here which will be something like |
es: @1935 |
@1950 2*pi/1000 . And that sounds quiet but that's about a part in a hundred. <<extraneous room noise here>> |
es: @1950 |
Miller: In other words this thing is making its error on the order of part in a hundred. @1965 And that is loud -- that's minus 40dB. And if you want to hear it, I can prove that that's bad. I will give you that at much lower frequencies |
es: @1965 |
@1980 and then you will hear a characteristic computer music error...Let's make it...20 ? ... All right,we'll start it at 55 Hertz.[tone] |
es: @1980 |
Miller: @1995 I can't hear anything wrong yet. Can you hear bacon frying in there? I don't hear anything wrong. |
es: @1995 |
@2010 I guarantee you will hear the problem if you listen to this carefully. I am going to turn the whole thing up to prove that this is bad. |
es: @2010 |
Miller: @2025 Leave it there and I am going to turn the volume up a little bit. Before I destroy these speakers. |
es: @2025 |
@2040 Hear that stuff? |
es: @2040 |
@2055 All right? When you are in a good listening environment, you will hear that a lot louder than you hear it here with this all these fans and everything else. And what that is is about |
es: @2055 |
@2070 40dB down from the sound of the sinusoid, but I am moving the sound of the sinusoid out of the way so that all you hear is the forty decibel down nonsense. [tone] Miller: Furthermore, it's still there when you do this kind of stuff. |
es: @2070 |
Miller: @2085 You might be able to hear it, and you might not. But if you listen to this in a good studio, you will hear it and it will not be appropriate, not be a good thing. Furthermore, that was only a |
es: @2085 |
@2100 nice sinusoid here. And of course the reason we are doing table look up is so we can do other stuff besides sinusoids. And "other stuff besides sinusoids" has higher harmonics in it, perhaps. So in fact what about the, |
es: @2100 |
@2115 what about if the signal that I put in here had a little bit of energy in the harmonic? Then what would I be listening to? [tone] Miller: Miller: This stuff. [sliding tones] |
es: @2115 |
Miller: @2130 You could want this, but you might not want it too. Let me shut that off. All right? So whatever you put into that |
es: @2130 |
@2145 wavetable to the tenth harmonic didn't sound like a sinusoid, it sounded like that thing. And the hundredth harmonic sounded a whole lot worse. |
es: @2145 |
Miller: Yeah. Questions? @2160 So table lookup is not the panacea that...well, sorry -- Table look up is not trouble free. You have to pay your dues and figure out how you are going to use this effectively. |
es: @2160 |
Miller: And @2175 cos~, that one is a table lookup that happens to be a cosine that's worked out in such a way that it gives you nineteen bits of precision, which is usually good enough. And so if you can live with cosines you will not have to deal with this situation. |
es: @2175 |
Miller: @2190 But there are moments when you will have to do real table lookup. In particular as soon as you have a sample going into the computer ... As soon as you're doing a recording you're putting a recorded sound in here and then playing that back using an oscillator, or using a sampler. |
es: @2190 |
Miller: You will have to deal with the @2205 issue of how well you are interpolating it and what kind of numerical accuracy you are getting out of it. We can avoid that for right now because basically, we are not going to be careful about that yet. |
es: @2205 |
Miller: I am going to show you that I think @2220 next week when we get into how to do sampling. And right now I will just go back to...OK, this looks good and now we can have a quick look at what waveforms sound like.[tone] |
es: @2220 |
Miller: @2235 Here's a nice pulse. It's one of the simple waveforms. And that's sort of "pulse width modulation," if I could draw something perfectly |
es: @2235 |
@2250 horizontal here. There is that kind of thing. Triangle waves like this: Right? And so on. ... |
es: @2250 |
@2265 Maybe you want to have a better way of putting things in wavetables than this, right? |
es: @2265 |
Miller: So that is all programming. And I am going to show you pretty soon how to record a sample. But for right now, this is @2280 by and large how most of computer music works. You generate phases. Which is done by, typically by eventually, a phasor object ... at some point inside your patch there's going to be |
es: @2280 |
@2295 one of these generating phase. And then at some point you are designing or finding waveforms. You could be adding up partials to make a |
es: @2295 |
Fourier-synthesized waveform, or you could be recording a waveform, or you could have some for some @2310 other reason. |
es: @2310 |
Miller: And that typically finds its way into storage into an array, and then you look the array up using the phasor. In other words, the phasor generates the index that changes your array @2325 that is telling you what the waveform is. And then you are playing it and you're making a tone whose timbre depends on the waveform and whose amplitude and frequency depend on what you multiply |
es: @2325 |
@2340 the table lookup by at the output. So here I am controlling amplitude, and here I am controlling frequency. |
es: @2340 |
Miller: Frequency control is going into the phasor and amplitude control is happening at the output of tabread~. @2355 And these three objects are replacing the one object osc~, the oscillator. |
es: @2355 |
@2370 You can deal with that right? And now we can do all three...So let me save this and make another one. <<saving "4.moretables.pd">> |
es: @2370 |
Miller: @2385 So I can get rid of some of this. |
es: @2385 |
@2400 So tables can be waveforms, or they can be other computer music items. |
es: @2400 |
Miller: And one thing you can imagine wanting to do is @2415 make this thing be...either the amplitude or the pitch of something changing in time. Let's make it amplitude to start with because that will be easier to hear. And then I will show you how you can control pitch using a table. |
es: @2415 |
Miller: @2430 OK. So I am going to make a nice envelope. So now we have an oscillator, and I am going to tell the oscillator to go very slowly. |
es: @2430 |
@2445 But rather than listen to this as the output, I am going refer this as the amplitude of something else. |
es: @2445 |
Miller: @2460 What? ... So we're going to take this and...just by convention I have been putting the amplitudes to the right, so we'll continue doing that. Like this. |
es: @2460 |
@2475 So I am giving myself a way to turn the thing on and off too. But meanwhile I am going to multiply a regular oscillator by this: |
es: @2475 |
@2490 [Tone] Ta-da. |
es: @2490 |
Miller: @2505 This is not perfect ... This is not a perfectly good example. This is now taking what is in here <<tab.1.18.a>> |
es: @2505 |
@2520 and making an oscillator out of it that is running at three cycles per second, and is then multiplying that by this oscillator <<osc~ 220>>. |
es: @2520 |
Miller: And I asked it for, well just by drawing I asked it for something @2535 that goes up quickly and comes down more slowly. Right? Yeah? Student: What is the "*~ 1000" doing? |
es: @2535 |
Miller: Ah, right. So this phasor outputting @2550 values from 0 to 1. And the table needs an input which is in points; and there are a thousand points here. So this is an adjustment to the range which is the size of this table. |
es: @2550 |
Miller: @2565 Or another example -- This is more along the lines of classical electronic music. Let's go back. |
es: @2565 |
@2580 This is kind of a bad example but I'll look at it anyway just to see the badness in a bad example. And now: Table Controlling Pitch -- Why not? <<saving 5.table-pitch.pd>> |
es: @2580 |
@2595 I haven't changed the name of the tables ... So I have to get the "Properties" anyway .. Points? -- I'm going to change it back to ... what? -- |
es: @2595 |
@2610 12 . I'll make it "d" now. <<<array is named tab.1.18d>> |
es: @2610 |
Miller: @2625 Change that to "d" <<in the tabread~ box>>. So now we have a nice oscillator that is reading this table. And it's giving us values that are ranging from -1 to 1 ... but I want to change that -- |
es: @2625 |
@2640 Let's make it have a range that is appropriate to frequencies, which might be 1000 to 0. ... |
es: @2640 |
@2655 So now everything at the bottom is 0. I can't edit it now ? ... Let's see what I can do about this ... |
es: @2655 |
@2670 I'm going to put something in. Here's how to generate a 0 without any object ... |
es: @2670 |
Student: @2685 It should be "1.18.d" -- "tab.1.18.d" |
es: @2685 |
Miller: Oh, thank you. @2700 "d" That didn't do any thing either ... Sorry I am just trying to get this thing through to where I can edit it, and I am not succeeding. |
es: @2700 |
Miller: That didn't do anything either. That's "tab.1.18.d" <<not array.1.18.d>> How about I just put some value into here directly? ... 57 ... All right! @2715 Now this is nothing to listen to. These values are now ranging from 0 to 1000 so they are too big to use for amplitudes. |
es: @2715 |
Miller: But they are perfectly good to use for frequencies. So we could for instance, instead of using this as the @2730 amplitude of the oscillator, we can do the frequency of the oscillator. And .... [tone] |
es: @2730 |
Miller: Oh!? ... You know what? @2745 We need to change this: <<output range of phasor changed from 1000 to 12>>. <<varies the values by writing in the table tab.1.18d>> OK. |
es: @2745 |
@2760 So this is an old electronic music trope. For those of you who listen to old electronic music like from the era of Subotnick <<Morton Subotnick>> and those kind of people. This is called a sequencer, |
es: @2760 |
@2775 an analog sequencer even though it is digital. |
es: @2775 |
Miller: Because the way analog sequencers used to work is they used to have a collection, typically of twelve, occasionally of sixteen voltages that you would set with knobs. And then you would give it usually a trigger @2790 and ask it to advance it to the next voltage. That was an analog synth board. |
es: @2790 |
Miller: This is how to make that sort of thing using digital technology. And by the way everything is in Hertz, so this is 0 to 1000. @2805 And this kind of doesn't work very well for specifying pitches. In fact, you will notice that all of the pitches were within a couple of octaves of each other. |
es: @2805 |
Miller: That is because from a quarter of the way up to all of the way up is two octaves @2820 because each octave is doubling. So if this is a thousand, an octave down is 500, an octave down is 250. So this is an ugly scale to be trying to do musical pitches on. |
es: @2820 |
Miller: @2835 That is going to bring me to the next topic which is: units in computer music. ... So now what you have seen so far in 45 minutes is two objects really. Well, maybe three, mostly two. |
es: @2835 |
Miller: @2850 phasor~ and tabread~ -- whose jobs are to remember where you are and scan through something, which is the basic thing an oscillator does and to hold and retrieve values. |
es: @2850 |
@2865 And these values ... So far you know how to get them in by using tabwrite~ -- |
es: @2865 |
Miller: And I am going to tell you about the best way when I figure out what the best way is. But I am going to do units first, because we need units badly now so that you can start @2880 making music. |
es: @2880 |
Miller: Oh yeah. So just try to make this thing do a C major scale. First off, a twelve note system isn't a good choice. So let's just use the first eight points. Right! ...so nobody said that you had to use the entire table. @2895 [tones] |
es: @2895 |
Miller: So if you use some smaller number ... depends on the size of the table. <<changing the output range of the phasor to less than 12. changed to 6>> Now you get the first @2910 6 values of the table. Miller: Now I've got a more powerful scheme because ... Miller: ... Add to this ... "+~" |
es: @2910 |
Miller: @2925 Now what I am doing is |
es: @2925 |
@2940 I am looking at a little window inside the table of six notes. And I am sliding the window over. If I change the value from 6 ... |
es: @2940 |
Miller: @2955 Now it's multiplied by 0; I am not |
es: @2955 |
@2970 getting anything at all. But if I add 0 multiplied by twelve, that is the original thing.[tones] ... |
es: @2970 |
<<changes phasor output from 12 to 3. Tones change>> Oh yeah, right! So I am only ranging through 3 values, if I'm doing that once per second, @2985 that happens at a much slower speed than if I range over 12 values in a second. |
es: @2985 |
Miller: Why a second? Because this phasor is going at 1 Hertz so it is doing that. <<snaps fingers for tempo>> And then if I say, look at three @3000 points, it is doing three points per second. But if I tell it to do twelve it is doing twelve points per second. Right? Yeah? Student: What does it sound like if the phasor is at 2Hz? |
es: @3000 |
Miller: Two? @3015 Let's try 440. ... All right, so let's see. Let's turn it on again. First off -- 2: [tone] |
es: @3015 |
Miller: @3030 The rule is that when you are |
es: @3030 |
@3045 doing things faster than 30-ish times a second you don't hear them as individual events. And so all that you can possibly hear them as is sound I guess. And so now we are changing the sound of the thing by playing them supersonic with melody. |
es: @3045 |
@3060 [tone, varying with frequencies of phasor] |
es: @3060 |
Miller: @3075 Now if |
es: @3075 |
@3090 we say -1 Hz? ... It is going backwards from right to left. Backwards. Meanwhile ... Adding does that: |
es: @3090 |
@3105 Furthermore, let's say I add even a fraction ... 3.5: |
es: @3105 |
Miller: @3120 And then it is four long, but it is actually not aligned with points in the table, so it hits 3 in the middle of it and then 2 at the outside, that you get 1/2 of. |
es: @3120 |
Miller: Oh, right: @3135 [tones] |
es: @3135 |
@3150 If you run off the end of the table, it's kind of just your tough luck. ... Whoops, now we are really off. ... |
es: @3150 |
@3165 There are twelve points in the table; let's make it fall off like this: You're getting the last four points on the table and then it is sticking on the fourth one. OK? |
es: @3165 |
Miller: @3180 Now you know how to make computer music. |
es: @3180 |
Miller: Actually, this is even more like '60s-style analog @3195 music. This is stuff that you would hear out of the San Francisco Tape Music Center <<Morton Subotnick, Ramon Sender et al.>> that belonged to a certain generation. Many of those people are still alive, by the way. You can send them emails. |
es: @3195 |
Miller: Questions @3210 about this? Is it clear what I just did? Yeah? Student: I'm not too clear on the +~. You said it moved the window? |
es: @3210 |
Miller: OK, yeah. @3225 Right. Meaning in some sense it bubbles up from the bottom in the sense that for tabread~ I have to provide a number which will tell it where it's going to look. See, if you think of those numbers as living horizontally from 0 up to |
es: @3225 |
@3240 11 and then 12 being that you put in twelve but the integer is never twelve -- really 0 to 11. |
es: @3240 |
Miller: Now if I say, for instance, take the phasor, which ranges from 0 to 1, and multiply it by 5 then I'm going from 0 @3255 to five which means I'm scanning through the first 5 points in the table. If I add now 2 to that, it adds two to those points -- to that range. Well, actually it adds two to every value, which de facto adds two to the range of possible values |
es: @3255 |
@3270 that those results occupy. Miller: In that case, after I've done that, the phasor which went from 0 to 1 goes from 0 to five now goes from 2 to 7 and therefore reads points 2, 3, 4, 5, and 6 -- which gives you five points in the table. |
es: @3270 |
Student: @3285 Then that number 12, is that arbitrary? Miller: That's arbitrary/historical. If you go look at an old synth they typically have 12 on them. ... Yeah? |
es: @3285 |
Student: @3300 Just to make sure ... Do you need a tabwrite~ to mess around with <<manually changing>> the graph? |
es: @3300 |
Miller: I'm running this version 43 test three, which doesn't let you edit the thing when the graph goes outside of the bounds and I had a negative number @3315 in there and I changed the range so that I couldn't edit anymore. So I threw that in <<the number-box input>>so I could bash it to a constant. Now that I have it, it's kind of useful because I can now say "Just play A 440 please" |
es: @3315 |
@3330 and it giving me consistently A 440.[tone] |
es: @3330 |
Miller: Or ... in fact, I could, no let's not do that. I was going to put some message boxes in to try to make a nice sequence of pitches @3345 in the table but then I realized that I'd have to press them all within a few 44,000ths of a second ... and that wasn't going to work terribly well. Yeah? |
es: @3345 |
Student: The oscillator for the tabread~ is that @3360 220? Miller: Thank you. Yeah. That 220 is obsolete. It got overridden by the input. Student: Can you input something to an oscillator that already has a value? |
es: @3360 |
Miller: It forgets the value and adopts the value. Except if @3375 I disconnected the input it would jump back to the 220 and then you'd be even more confused. So it's best not to have that 220 there. Bad style. |
es: @3375 |
Student: @3390 Can you show the properties for the table? <<tab.1.18.d>> Miller: OK, so take this one here? Student: Yeah. |
es: @3390 |
Miller: So ... its size is 12. I don't mind "Save Contents" because it will add 48 bytes @3405 or something ... |
es: @3405 |
Miller: The X range is from 0 to 12. Oh, by the way, if you change this and if it agrees with this range when you change it it'll update this range for you. You @3420 don't have to set that. Miller: Here I wanted to go from 1,000 at the top to 0 at the bottom -- which is a reasonable range of pitches but not the only possible range. |
es: @3420 |
Miller: @3435 All right. Let's see. I'm going to next talk |
es: @3435 |
@3450 about units. And to do that I think what I would do, I'm going to save this now as patch number 7 <<saving 7.table-pitch-midi.pd>> because I'm going to have to have a patch number six in the middle. |
es: @3450 |
Miller: @3465 So by the time we get to 7 we're going to be putting MIDI numbers into the table instead of frequencies in Hz -- which will make everyone breathe a sigh of relief. But meanwhile, I want to go back one. |
es: @3465 |
Student: @3480 You are putting all of these patches on the website, right? |
es: @3480 |
Miller: Oh, yeah. Yeah, I believe it's true the patches from last Thursday are on the website, but if you look and don't see them it's because I forgot to put them up and I need to...@3495 So they're not there? ... I need to put them up! I'm sorry. I'm forgetful. |
es: @3495 |
Miller: OK. Six. <<saving 6.units.pd>> So now we're just going to talk about units. To talk about units we don't need this stuff, @3510 but we still need our nice oscillator and our multiplier. There. Same thing as always. |
es: @3510 |
Miller: Now, @3525 the objects of interest are as follows: The one that's the easiest to understand probably is "MIDI-to-frequency" <<mtof>> and its companion, "frequency-to-MIDI." For |
es: @3525 |
@3540 mtof, you just give it a number and out comes the frequency in Hz that would correspond to that value in MIDI. |
es: @3540 |
Miller: For instance, 69 is the @3555 MIDI number which is associated with the A above middle C which is sometimes called A440. So this is a pitch and this is the value in Hertz. The pitches are good to use because |
es: @3555 |
@3570 you can look at two of them and know exactly what the interval is between them, that is the musical distance between them. |
es: @3570 |
Miller: You can't necessarily do that with two of these numbers <<frequencies>> like if I gave you 261.62 and this <<440>> @3585 you wouldn't necessarily know right off the bat that's a major sixth, if I've got it right. But here if I say OK give me a major sixth that's 60 to 69 then you can know that. |
es: @3585 |
@3600 So, for instance, if you want to make oscillators make a chord. ... First off -- before I even do that, let's just play this: [tone] <<changes with inputs to mtof>> |
es: @3600 |
Miller: @3615 I'm too lazy to get the piano out, but if I whacked A I believe I would hear the same pitch as I heard here. There is one situation in which that wouldn't be true which is if I was wrong about the sample rate of my conversion hardware. |
es: @3615 |
@3630 That's probably right. So now, for instance, if I want to play [tones] a musical sixth or seventh tone. It's a much easier job than multiplying by |
es: @3630 |
@3645 one and a half. Now if we want to go up by a musical third here that's easier than multiplying by that ratio, which is a number that you all know from |
es: @3645 |
@3660 acoustics. What's a tempered major third interval ... or the ratio? |
es: @3660 |
Miller: That's not the easiest possible computation you could be doing. ... @3675 Yeah? Student: How did you change the number so quickly? Miller: Oh, how did I change it so quickly? I click on this thing and then I start typing and I hit enter. And, I've had a lot of practice. |
es: @3675 |
Miller: @3690 OK. ... So 12 half steps are a factor of two, so four half steps is a factor of 2^1/3 because 4 is 1/3 of 12. So the cube-root of 2 is the musical major third, |
es: @3690 |
@3705 tempered. |
es: @3705 |
Miller: That's weird, isn't it? ... I tritone the easiest one of all besides an octave. @3720 Even though it's the worst interval -- It's the square-root of two, 6 half-steps out of 12. They're all irrational except for the octave. <<all the half-steps>> |
es: @3720 |
Miller: All right. Let's see. So now...OK, @3735 so here to make, for instance, a nice major chord, just as an example, |
es: @3735 |
@3750 you could say, "All right I will take this frequency and I will multiply it by 1.25 and by 1.5." |
es: @3750 |
@3765 That's 5/4 and then it is 3/2. Those are the musical perfect third and perfect fifth, perfect major third and perfect fifth. ... Now let's see if it's going to work for me. |
es: @3765 |
@3780 [tones]<<major chord at various frequencies>> |
es: @3780 |
Miller: All right. That's OK as long as you're doing tempered chords @3795 and you happen to know those numbers. More musicians know these numbers in half step and they would rather do the whole thing -- instead of in frequencies -- in pitch -- |
es: @3795 |
@3810 Where going up a major third is not multiplying by a ratio (which is what you do to frequency), but it is adding the number of steps. (Because pitch is in steps or in notes.) |
es: @3810 |
@3825 We can say in steps. So here we say "+ ..." -- How many half-steps are in a major third? -- Four. And in a fifth? -- |
es: @3825 |
@3840 7. This might or might not be easier: [tone] |
es: @3840 |
Miller: @3855 And by the way, it's no longer a perfect major chord. It is a tempered chord. It sounds different, especially here because there's some distortion. If there weren't any distortion I don't think you'd hear that beat. [tone] |
es: @3855 |
Miller: @3870 OK. ... Yeah? Miller: Students: What's the 69 thing again? |
es: @3870 |
Miller: Oh, thank you. 69, this is the MIDI pitch which corresponds to A440. @3885 I should probably tell you about the MIDI scale. Student: That's pre-specified already? |
es: @3885 |
Miller: That's pre-specified. That was specified by the musical instrument digital interface standards board back in the '80s, I think. @3900 This is basically never going to change. 60 is middle C. Why 60? Because they wanted all the pitches to be positive numbers. In fact, they wanted to fit the whole thing in a 7-bit word, so everything is between |
es: @3900 |
@3915 0 and 127. The definition of MIDI pitch is that 60 is middle C and values that are not 60 are counting away from middle C up or down in half steps. So |
es: @3915 |
@3930 a major chord in middle C. [tone] Going up a half step, add 1 ... |
es: @3930 |
Miller: Subtracting 1, going down a half step. [tones] ... @3945 Yeah? Student: Does a MIDI have to be integers? Miller: If it's real MIDI it does, but we don't have to obey that. 60.5 (a quarter-tone above middle C) [tone] |
es: @3945 |
Miller: @3960 Why do you call one half of a step a quarter tone? That is music history that we just have to live with. |
es: @3960 |
@3975 Along with the fact that they used letters A to G and five of them have sharps and the other two don't. |
es: @3975 |
Miller: ... all that stuff we inherited from people who thought differently from how we think. I hope @3990 you prefer typing 64 and 70 to typing 261.62 -- you don't see the whole thing here. -- And those numbers which are frequencies that I don't even know. |
es: @3990 |
Miller: Right. And @4005 just for the sake of being thorough: If you ever want to get back, there is a frequency-to-MIDI. <<ftom>> And that will do this for you: |
es: @4005 |
@4020 It will figure out what you have to say in order to get a given frequency. So if I happen to know that the thing I am |
es: @4020 |
@4035 listening to... let's see, to avoid re-using the number 60 ... suppose we're in Europe and we've got line-current to listen to, which is 50 Hz. |
es: @4035 |
Miller: So that is pitch 31.35, which is, @4050 let's see thirty ... 60 is middle C ... Then 31.35 is a G, a little bit north. Which is the sound of a ground loop in Europe. -- So Hertz to |
es: @4050 |
@4065 MIDI to Hertz. |
es: @4065 |
Miller: If you have an integer here, you are not always going to get an integer here and vice versa. The only situation where both of these happen to be an integer is when you use numbers like @4080 220 or 440, which correspond to A, which is 69, or 57, or 45, etc. Yeah? |
es: @4080 |
Student: This may be pretty unrelated -- But do you @4095 have any idea why they arranged it so that notes in MIDI are like 69 for A 440 and then they have negative numbers which correspond to Hz? |
es: @4095 |
Miller: Oh yeah, right. Yeah. @4110 So what is MIDI 0 here? It's 8 Hertz and change. So if you want something to go at four Hertz you have to say, go down an octave from 0 in MIDI, which is -12 MIDI. Isn't that horrible? |
es: @4110 |
Miller: @4125 And this is a perfectly reasonable vibrato rate, in fact a good vibrato rate is -6 or so. By the time you get up into non-negative MIDI frequencies you are really too fast for doing nice vibrato. Why did they do that? |
es: @4125 |
Miller: -- @4140 Because pitch originally was supposed to live on an 88-key keyboard. Because this was invented by instrument manufacturers. They thought about selling keyboards. So they invented a 7-bit protocol that can describe 88 keys. |
es: @4140 |
Miller: @4155 You can do that in a variety of ways like you can count the bottom of the piano as being 0. But what they wanted was for middle C... well, for C's in general to be multiples of twelve. That makes the arithmetic easy. |
es: @4155 |
Miller: So then you could make the bottom @4170 of the piano be -3 ... No, you can't do negative numbers -- That's an A, usually. So then it could be 9. ... But in fact they made it 21 so that middle C would be about halfway up the range from 0 to 127 I guess. |
es: @4170 |
@4185 Anyway ... It works OK. |
es: @4185 |
Miller: The highest frequency you can talk MIDI into talking about... I can set the width of the number box; occasionally @4200 you have to. ... So you will have trouble specifying pitches above... -- ooh. That went the wrong way. |
es: @4200 |
Miller: You can't describe any of this in classical MIDI, hardware @4215 midi, above this pitch here, which is not going to bother any musicians. Oh and by the way, 0 - even though 8 Hertz as a frequency is subsonic. |
es: @4215 |
Miller: So we did cover the range of hearing decently well, although not perfectly. @4230 And of course you can go out of the range negatively, you can also go out of the range positively. 200 MIDI is almost a megaHertz. |
es: @4230 |
Miller: @4245 1000 MIDI is almost 10^26 Hertz. It's exponential -- every time you add twelve here, you are doubling this number. |
es: @4245 |
Student: @4260 How do you get that number box? Miller: Here? Oh, I just clicked on it and it said one, 0, 0, enter and then it did it for me. |
es: @4260 |
Student: @4275 The width of the number box, though? |
es: @4275 |
Miller: Oh. Oh, right, OK. Yeah, yeah. So this thing? This is because my number box by default is only five units wide. And I went into properties and told it to make this one 8 units wide @4290 so that I could see bigger numbers. It is a trade off of screen space versus range of numbers you can see. |
es: @4290 |
Miller: Actually five is almost never the right number. It is almost always either 3 or else it's 8. Five is almost an anti-...@4305 almost a local-minimum of utility. And of course, minus a thousand is a very low frequency. Like a once-in-the-age-of-the-universe type frequency. |
es: @4305 |
Miller: @4320 So that is units of frequency and pitch. So MIDI is a unit of pitch, and that is suitable for describing musical intervals because when you add |
es: @4320 |
@4335 some fixed number of steps to a pitch you move by the interval no matter where you are. |
es: @4335 |
Miller: ... Whereas frequency has a more dubious range...the audible frequencies anyway, roughly speaking, range from 20 to 20,000. @4350 So it is a more unruly scale for typing numbers in. And that is all I should say about that. |
es: @4350 |
Miller: Oh, if you want to have an interval, you multiply the frequency by a number to get @4365 the interval, as opposed to adding. And this is in fact exponentiation. It is a normalized kind of exponentiation so that adding here is the same as multiplying here. |
es: @4365 |
Miller: Because when you add something @4380 to something that you are going to exponentiate, you multiply. Right? |
es: @4380 |
Miller: Similarly to pitch and MIDI, we have objects for doing @4395 amplitudes. And I have been using these numbers like 0.03 for amplitudes all quarter so far. |
es: @4395 |
Miller: Now we can start using amplitudes in decibels, which might also be a nice range from 0 to 100-ish. @4410 So the objects in question are called "decibels to root mean square." <<dbtorms>> That is a horrible name, isn't it? |
es: @4410 |
@4425 "Root mean square to decibels." <<rmstodb>> |
es: @4425 |
Miller: I don't know a better name for these, but this is not a good name. 100 decibels @4440 corresponds to one volt, if you like. And then every increment of 10 db is a multiple of ten in power. |
es: @4440 |
@4455 Multiplying power by 10 means multiplying amplitude by square root of 10. |
es: @4455 |
Miller: Because power is proportional to the square of linear amplitude. @4470 A good measure of linear amplitude is root mean square, which means "the square root of the average of the squares of the sample." -- "Mean" means "average" in this context. |
es: @4470 |
Miller: So that root mean square is: "Take your signal, square it, take the mean @4485 and then take the square root of it." That is what the letters are and that stands for. And decibels-to-rms means get this thing <<100>> and make it that or get 90 (which is ten fewer and turn it into 1/(square-root of 10) <<.316>> ... |
es: @4485 |
@4500 which you all know by heart. Miller: And then 80 then becomes [1/(square-root of 10)]^2 because we divided by the square root of ten twice. -- And that means dividing by ten. |
es: @4500 |
Miller: And now you can see why @4515 it is a reflex of mine to always say 0.03...that's about 70 db. .3 is about the square root of ten, .1 is a tenth, .03 is about ten to the minus three halves and so on like that. |
es: @4515 |
@4530 It's 10 db every time you multiply by three-ish. Yup. Student: Aside from just knowing that knowledge, is there any practical benefits to what you just showed us? The dbtorms? |
es: @4530 |
Miller: @4545 Well, there's this. Now I can stop doing this and start doing...Ooh, I'm going to have to introduce a new object and there are only five minutes to go. I don't know if I should do this. In fact, what I'll do is I'll |
es: @4545 |
@4560 quit doing the niceties and just give myself a number box. Like this. Now I can say "Give me seventy db please," -- and you can't hear anything because I don't |
es: @4560 |
@4575 have any pitch here. [tone] |
es: @4575 |
Miller: So this seventy is an easier thing to think in terms of than this 0.03. Not only is that easier, but also @4590 at this point I've got something that operates reasonably as a control. I can mouse on this without having to hit the shift key -- that is a good thing. And furthermore, every time I push this by a fixed amount, |
es: @4590 |
@4605 like 10, say, it gets the same amount louder as the last time I pushed it by 10. Or I can take it down. Right. |
es: @4605 |
@4620 So if you like ... five db, five or 10 db is a musical dynamic. And if you think in terms of there are six dynamics all the way from triple-f <<fff>> to triple-p <<ppp>>. |
es: @4620 |
@4635 If you think that is a 35-decibel range of loudnesses, then then make it be 5db per dynamic. And then you've got a decent way of controlling dynamic that doesn't have you typing lots of decimals. |
es: @4635 |
Miller: @4650 Unfortunately, what this would mean is that 0 should be 10^-5. But the dbtorms object cheats, and when you say 0 it gives you a true 0 out |
es: @4650 |
@4665 so you can just turn the thing off. That's important -- because otherwise, it being digital, even if you had an amplitude of 10^-10, it might be doing 0 crossings, and it might still make its way to your speaker. |
es: @4665 |
@4680 So 0 is true 0, but as soon as you get off of 0, it gets to real numbers that are too small to show. |
es: @4680 |
Miller: Yeah, I need to make this number box fatter again. OK. @4695 Now 0 is 0, but one db is about 10^-5; 20 db 10^-4 <<.0001>> |
es: @4695 |
@4710 and so on like that. And negative db you just truncate to 0. |
es: @4710 |
Miller: You can tell this thing more than 100db --@4725 I'm not going to do it right now, because it's connected to sound. But if 100 db is an amplitude of 1, then 120 db is an amplitude of 10, which is too loud to play, but not |
es: @4725 |
@4740 too loud to think about; maybe you are going to attenuate it later. And 140 is an amplitude of 100 and so on like that. All right? |
es: @4740 |
@4755 Miller: Questions about that ... in 30 seconds? So those are acoustical units, and that was table lookups and phasors. |
es: @4755 |