 So, let's just look at what you need to do in the assignment. Some of you have started, some of you are close to finished, or at least some attempt at most of the tasks, so today we'll discuss and I'll demonstrate some parts of the assignment and be able to answer your questions, so now's the time to ask. Three tasks. First one on audio, second two on wireless LAN. I'll talk about the audio one last. We'll come back to that. Let's talk about the wireless LAN ones first. Task two is to capture traffic. So I'll explain what I mean by capture, what actually is happening there, we'll explain that a little bit. The idea is that you will connect two computers together using Wi-Fi or a wireless LAN and then use a third computer, record what those two computers are sending to each other and then investigate what happens. So we'll demonstrate that today. And then the third part also on wireless LAN is again with your two computers transfer a file from one to another and measure how fast that transfer is. So you've got a 100 megabyte file for example, you transfer it, it takes 10 seconds, you measure the throughput 100 megabytes divided by 10 seconds, 10 megabytes per second. It's easy, but you need to set up your experiment and probably repeat it multiple times, make sure the conditions are predictable. So when you make conclusions on why is the throughput 10 megabytes per second? Why is it one megabyte per second? Why isn't it one gigabit per second? Then when you make conclusions about why you see those results, they'll make sense. So let's go to look at the second task and explain that and demonstrate it. So capture wireless LAN traffic. What does that mean? I've started to draw a picture here. This is what you want. Two computers, A and B, let's say two laptops, they don't have to be laptops, but two computers that can connect to each other. Now they should connect directly using wireless LAN. The normal mode of operation when you're using wireless LAN is that you connect your computer, the client computer, to an access point, like the one on the wall. We're not doing that in this assignment. So what normally does, what happens is, okay, forget about M for a while. Let's say B is an access point, the device on the wall, A is your laptop. The access point has cables going into it to the rest of the LAN. There's a cable that goes up and down to a switch on the third floor and out to the rest of the internet. So normally when you're accessing a wireless LAN, you're connecting wirelessly to the access point and then the rest is wired. In fact, if I have my two laptops and I connect to this one access point, when I'm connected to that access point, if I transfer a file from this laptop to this laptop, it actually goes via the access point. That's the normal way wireless LANs are used. So everything goes via the access point. In this assignment, because you don't have access to your own access point, even though there are some around, it's sometimes difficult to do experiments using the SIT access points. What I want you to do instead is have a wireless connection direct between two computers, between two clients. So now B is not an access point, B is another PC, laptop, mobile phone. And they connect directly, no access point involved. So this is a special case of using wireless LAN. And it's called an ad hoc link or an ad hoc network, ad hoc wireless. It's for temporary connections. So I don't have an access point, I just want to connect to another computer then form an ad hoc link. Sometimes called a direct wireless connection ad hoc, sometimes a point to point wireless link. Different software or different operating systems may refer to it different names, but ad hoc I think is the most common. So that's what you need to do for task two and three, form an ad hoc link between two computers. And I think all operating systems allow you to do that, you just have to follow different steps of how to do it. It will be different depending on your computer, but it should work, you'll find out how to do it. But make sure when you're connected wirelessly, you're not connected to an access point. You connect direct to the other computer. Everyone knows how to do that? I know some people have done it, how did you do it? Or what software did you use to create a, to transfer a file? Airdrop. I think in Mac OSX, airdrop is one piece of software to allow you to transfer files between other Mac computers. Now when you do that, you need to make sure you've got an ad hoc wireless link between the two computers, not going via an access point. Again in Windows, you can set the network connections when you go into the details of the network connections for the wireless interface, I think you can set the link to be an ad hoc link as opposed to via an access point, which is sometimes called infrastructure link, so create a direct link. Now this, in fact task two, all I want you to create a direct link, the same concepts apply as if this was an access point as well. The idea is that you have one computer, you transfer some data to another wireless device, another computer. The idea in task two is to get a third computer, M here, to record everything sent between A and B without a wired connection. So three computers now, two of them are transferring data, the third one is listening in and capturing what they're transferring. So we can talk about how that works. Just recall that with wireless LAN and with many wireless technologies, when we transmit a signal, it goes, depending upon the antenna, but the antennas with wireless LAN normally transmit a signal in all directions. So when my laptop sends data to this access point, the signal is transmitted out of my laptop and you can think the signal goes in all directions. So it goes towards the access point, good, but it also goes back there, it goes up a little bit and down and so on because it's, because of the antenna design, it propagates in all directions, not just in one specific direction. It's an unguided medium that we're using. So even though I want to send data to B, the signal goes all around A. You can think anyone nearby A will receive that signal. So what normally happens in wireless LAN is that you create a frame to send, A creates a frame to send to B. Inside that frame is a destination address, B. So A creates a wireless LAN frame, the header will contain different things, including the destination address, because A wants to send to B, it sets the destination address to be B's address, let's say the letter B. It creates that frame and transmits it wirelessly. That frame is transmitted in all directions, including to B and including to M. A has no control, it's the antenna that controls where it goes. So the frame is transmitted everywhere, the destination in the frame is B. What normally happens is that everyone nearby A, more precisely within range of A, such the signal is great enough to receive, everyone receives that frame. So the wireless device inside M and B receives the frame. B's wireless LAN card receives the frame, checks the destination address, sees the destination is B, I am B, therefore it processes that frame and uses the data inside that frame. So if the frame is destined to B and B receives it, well that's good, B continues to process that frame and use it, but it's also received by M. So M receives the frame and the wireless card inside M checks the destination and it sees the destination is B. So in this case M discards that frame, that's the normal operation. M received a frame, the destination is B, it's not to me, I'll discard it, I'll throw it away, I will not process any data in it. Just like you ignore it as if it was never received. So that's the normal operation with wireless LAN. Even though we transmit a frame because of the radio characteristics, everyone within range receives that frame, only those which are the destination actually process the frame, others ignore the frame as if they never received it. That's what happens in wireless LAN and many wireless networks. Every time my laptop's transmitting, your mobile phone, your tablet or laptop is probably receiving a signal containing the data that I send, but it's ignoring that frame because the destination is not your laptop or your phone. What we want to do or what you would do in task 2 is to tell this computer M to not ignore the frames it receives. So it receives the signal, normally it checks the destination and ignores. If it's not to me, I'll ignore it. But what we can do in some devices is configure them such that when they receive it, it doesn't matter what the destination is, we will not ignore. We will take the frame and process it. And we'll see what we'll do when we process it. Now this capability depends upon the wireless devices, what wireless LAN chipset you have on your motherboard, so who manufactured your device, what version it is, and also the drivers that your operating system use to control that device. This capability to tell the wireless device to process all received frames is not available in every computer. It doesn't work in Windows because of drivers. So if you've only got Windows, you will not be able to use it on this computer to receive these frames. You need usually a Unix-based operating system. So Linux or Mac OS X will work, in most cases, there may be some exceptions. With Mac OS, I think it will work almost all of the time. That is, you can use Mac OS here, it can receive frames and you can tell it to, even if the frames aren't destined to take a copy. With Linux, it works in many cases, it may depend upon the hardware. So that's the first limitation. If you don't have a computer where it works, then in the third floor, the iMac lab, the lab with all the new iMacs in it, they have wireless devices, wireless chipsets, and it will work on them. I've tested it in the past, actually I tested it in the old ones, it should work on the new ones as well. So we need three computers, two are going to transfer data to each other, the third is going to monitor what they do, and this mode where this one receives what others are sending is often called monitor mode. We monitor what others are sending. Depending upon your operating system, there are different ways to tell your wireless device to monitor. On the course website, there's two links. One is to how to do it in Linux, Ubuntu Linux, some instructions I've written, and another is to how someone's done it in Mac OS. So you can follow those links to get the details of how to configure this computer to monitor. I'm going to quickly do it and then we'll see how we can take advantage of it. So this laptop and what's displayed on the screen is going to be the red one, the monitoring laptop. My blue one here, which you cannot see on the screen, is going to be computer A, just the normal computer, it's going to transfer files with computer B. I don't have a third laptop with me, I'm not going to use this one. In fact, I'm just going to use the access point as computer B and connect to some server. In your experiment, computer B will be another laptop. But in my experiment, I go via an access point. But still we're going to monitor and see what A is sending to B and B is sending back. So I'm going to quickly do it. Again, these instructions that I'm doing here are linked to on the course website. So you don't need to copy it down. You can see the details later. I need to remember what to do. On the command line, I need to tell my first, I need to turn off my wireless land interface. And I'm going to configure my interface, specifically my wireless land interface on my laptop. It's got the name WLAN0. I'm going to turn it off or turn it down. We talk about an interface being up, on, or down, being off. Just so I can set it up, I'll turn it off. Pseudo just means I need to do this with some administrator privileges. I need my password. So it's turned off at the moment. And now I'm going to, sorry, configure the wireless LAN parameter, configure the wireless interface parameters. The W is not IF config, it's IW config of my wireless LAN. And put it into what's called the monitor mode. This is the mode where whenever my wireless device receives a signal, it will actually not ignore the frame. It will take a copy. This is a special mode which is not supported by all devices. And now turn it back up, turn it back on. If everything's set up and I did some things before just to test, it should work. It doesn't always work. Now, what's happening when this one sends data to the access point, say to B, this one will receive that and will process the data. But in fact, it's destined to be so there's no application on my computer that's going to deal with that data. What I want to do, I want to now tell my computer everything that I receive on the wireless LAN interface and everything that's sent, I won't send anything, but everything that is received to take a copy, to record, or commonly called to capture everything that's received. So I need some special software that whenever something's received, it will record and I will save it in a file. That is, I'm going to save every frame that I receive in a file and then look at them later. There's different software to do that. I have a program called TCP dump. And what it does is just records everything that's received on the wireless LAN interface, minus I, the interface WLAN zero. And I have an option, not so important here, but I will use minus N to tell this software not to do any DNS lookups. If you don't include it, it will still work, but it's a little bit faster with this option. And write everything I receive to a file, call it whatever you like. Even the extension is not so important. This software, when I start it, is going to take everything that's received on the wireless LAN interface and write those details, the actual packets, including the headers and the data, into this file. Press Enter, it's running. It doesn't give any other feedback. Now everything that's being received is written to the file. So when you open your phone now and you connect to Facebook, then I may record what you're sending to Facebook. Now let's do it. But with my laptop here, I've got my browser open, and I'm just visiting a website on the ICT server. I just clicked, you cannot see it, I just clicked on a link to one of the help pages on the ICT web server. And now I'll stop this capture. This is called a capture. We're capturing the packets. Just Control-C, it stops. Sorry, a little bit off the screen. There's a three here, a 34712. So over that time, there were 34,712 packets received by my laptop. Many things around here were sending wireless packets, both my laptop, my blue laptop, other one, probably someone's phone, someone's laptop at the back, and my computer captured those and saved all those packets in a file. So now we want to look at those packets and see what other people were sending. In particular, see what my blue laptop sent to the destination B. We need another piece of software to do that. Before I start that up, any questions so far? Some new things. You need to do this yourself, different steps on different operating systems, but the same concept. Tell your computer to monitor, then tell your computer to capture what you receive and record in a file. Anyone done it yet? Did it work? You said you were trying it. Were you successful? Not yet. I have config and IW config are just some utilities on my operating system to configure the interfaces. In different operating systems, you have similar utilities, or you can use the graphical interface in some cases. TCP dump is a special piece of software I've installed that records packets or frames sent and received, and I've written them to a file. Now I'll use another piece of software called Wireshark to view those packets, to open that file. Wireshark provides a nice graphical interface to view the packets. Let's just make this a bit easier to see. There's a lot of information here. I'm not going to explain the details of Wireshark. Just a quick intro to what it shows. All these colored lines here are packets received by my computer. Sorry, you cannot see the left of the screen, but this is a time starting from time 0. And then one millisecond and 57 microseconds later, my computer received a second packet. And then a little bit later, received a third packet. So when I turned it into monitor mode and then started TCP dump, it started recording these packets. And this lists those packets. And for each packet, it shows when it was captured relative to the start time or relative to the first packet, who sent it, the source address, who's the destination of that packet, and some other information about what's in that packet, including what protocol is being used and maybe some extra info. And there are, what do we say, 34,000 packets there? It says 34,712 packets. Many of them, I don't know what they are, because many things are happening in the background on this network. And that's what we see here. Some of them you may recognize or some you will over the next few weeks. And I'm not going to try and explain them at this point just that each line represents a packet. And once we select a packet, we'll eventually see some details of that individual packet. The contents, the headers, the data will be shown down here. What I want to do is see what my blue laptop sent to the destination. So my blue laptop is A, and the destination is some computer B. What did it send? So I want to see what A sent to B. What I did on A was I opened my web browser and visited a website. So I typed in a URL, pressed Enter, and eventually a web page was displayed on my browser. What protocol was used in that case? What did A, my blue laptop, what protocol did it use? Web browsing. HTTP. So the protocol, there are different protocols used, but the application layer protocol is HTTP between A and B. And the basic way HTTP works is that your browser sends a request for a web page to the server, A sends a request to B, and then B, if it has that web page, sends back the web page in a response. That's the basics of HTTP. A sent a request to B, requesting some URL, some web page. B sends back that web page. And then my browser, when they receive that response, it displays the web page on my screen. So I want to see, in my capture, so from M's perspective, I want to see that request and response. I want to see the details of it. So I go back to my capture, here we go. Of the 34,712 packets, I hope, if it worked, it doesn't always work, but I hope two of them are my HTTP request and response. Now to find them, I can either browse through 34,000 packets or maybe better apply some filter to filter out the packets of interest. And I know that one way to filter is to show just the HTTP packets. And I see many. So now it's just showing the ones that use HTTP. There are many. Maybe someone at the back was visiting a website. I will not look in that. Just browse through, because I don't want to see what they were viewing. Now, so there are many here. So I would like to see what my blue laptop sent, not what someone else sent. I'll just check my IP address. I just checked the IP address on my blue laptop, computer A. And I'm going to filter based upon that IP address. So just a filter condition. The protocol should be HTTP. And the IP address should contain my laptops, which is 10.10.101.65. OK, so now I've cut down the packets displayed to just those which were involving my laptop, computer A, and used HTTP. All right, we see some green and black ones here. The one highlighted, the orange one, one at the top. Here's the source address, my laptop. Destination, some IP address. Protocol being used, HTTP. Contained inside that message is some string get slash help slash putty dot. That's it. That is the HTTP request. I know from past that a HTTP get request is A requesting the web page from B. When B receives this, it sends back a reply containing that web page. This is the request that my computer A sent to some web server, B. And the IP address of the web server is this 203 address. What's this? Anyone want to guess? Who sent it? The second one, the orange one. Compare the first, the green one, and the orange one. I said the first packet is the request sent by my laptop to the server. The second one, the highlighted orange one, also is sent by my laptop to the same server. It's a retransmission. I didn't expect that to happen, but that was a retransmission of that request. Maybe something went wrong. So this doesn't always happen, but this is some error control working. The first one was sent, and maybe an act didn't come back. So my laptop sent a copy, it retransmitted. So that's an example of error control. You won't always see that. I could be wrong. It may be some other special case, but let's say it's a retransmission for now. We don't know. Third ones of interest, sent by the server sent to my laptop. This is the response. And it's some message saying everything's OK. So think of ignoring the other packets. This one is the request from my laptop to the server. This orange one is the response from the server to my laptop. Request, response. And this is what we're seeing is from the perspective of M. Let's go back. And what we can do when we select a packet, this response packet, is I can view some of the details. So in this pane or this part of the window, it shows the details of that individual packet. Many details here shows that it's using HTTP, TCP, IP, 802.11, which is a wireless LAN standard. It shows the protocols in the different layers being used in this packet. And you can expand them and see many details in the header. So these are the header fields for a particular frame. Destination address, source address, and many other things. I don't expect you to understand all of that. But you can see examples of different headers there. What's interesting is the data. So we can think of this is one header of our wireless LAN frame. There's another header for our IP datagram, header for TCP, some header information for HTTP. Then this is the actual data, the real data that we want to transfer. And we can expand. Sorry, you cannot see on the screen, but there's a little arrow that allows me to expand. This is the data sent in the response from server to my laptop. What is it? What's the data? Does it make sense? Do you recognize anything in the data? What's this tell you? It's a HTML web page. It's the actual web page that I requested. So my computer, computer A, sent a request to the server, computer B, asking for a particular web page. Computer B sends back that web page, the HTML, in the response. My computer, computer A, receives this HTML, and the browser uses it to display on the screen. So this is the actual data, the actual web page. If I captured someone at the back browsing some other website, then I would have seen the contents of the web page that he just looked at just by capturing on my third computer here. And if you don't want someone to see what web page is you're looking at, what do you do? Maybe you're looking at the web page for your bank account. You're doing online banking. You send your username and password to the bank to log in. I just captured that. Your username and password to your bank account. And your bank web server sends back your account information, all your transactions, and it's displayed on your screen, and I just captured all of that. What can you do to stop me seeing your bank username and password and your bank account information? That's not good if I can do that. Does anyone do online banking or online payments? As you pay for something, you buy something on eBay or Amazon, and you've sent credit card information? Anyone? Yeah? Most people may have. I can capture everything that you do if you're doing it nearby. But many financial websites, information that needs to be protected, even though I can capture, there should be some encryption being used between your computer and the website. So that I capture it, but because it's encrypted, all I see is random looking data here. I do not see the contents. So make sure you're using encryption and in web browsing, HTTPS, when you're doing important things that you don't want people to see what you're doing. Now that's a different topic. We'll cover that next semester in IT security. That's what you need to do, okay, in task two. But you transfer a file from A to B and then on your third computer, you tell it to put it into monitor mode, start the capture using TCP dump. In fact, you can use Wireshark or even other software. Then on A, you transfer a file to B, then you stop your capture on the monitor computer, M, and then look at it in Wireshark and try and find the packets which make up that file transfer and try and see what's happening there. Questions? Everyone knows what to do now? Okay. Okay, what do you need to explain in the report? So if you can do that, then what do you submit? Let's just go back. So in fact, a lot of this assignment is just getting you to do the tasks. The reporting is not so much. In this case, you report on the experiment by describing the setup of the experiment. Draw a picture like I just drew. Two computers and the third one. And give me some details about how you set up those computers. What operating system did you use? Maybe what wireless technology did you use? What software did you use? Then you'll capture some of packets in the data exchange. There may be many. As you see, I have 37,000. I want you to draw the exchange of packets of the relevant ones or the interesting ones. So in my case, what I would draw is an exchange of a request going from A to B and a response going back and draw some details of those packets. I say in a time sequence diagram, what's that look like? It looks like our flow control and error control diagrams. These diagrams we've been drawing which show the exchange of packets over time. Packet sent from A to B, response is sent back. In your case, there may be more packets sent. Now, if there are 1,000 or 10,000 packets sent, don't draw them all. Just, for example, draw several and maybe dot, dot, dot on the last one. So let's say you transfer a large file and that's what the task asks you to do. You'll see that there are many packets sent. You don't have to draw them all. Just say, okay, packet one, two, three and then dot, dot, dot or say, okay, then this continues and then the last packet. Just to indicate that there's lots of packets. So draw the exchange and then draw a diagram of the packet format. What's that look like? We'll see another example later on the glyc. Let's see if we can draw it on the screen and be a bit more precise. Let's go back to our capture. There's a lot of information here, but one way to view this, so the current packet that I'm looking at, Wireshark shows it almost in a upside down protocol stack. So at the bottom is the data. Then it's the application layer protocol, HTTP. This is just some special case, but it's part, you cannot see a little bit to the left. The transport protocol, TCP, the network layer, IP, then actually these two are the data link layer combined. They're both part of the data link layer. And then the rest, we don't actually see the physical layer. That's the signal being sent. It doesn't see that details. It just summarizes some information, this radio tap and the entire frame. How will I draw that? Well, let's try, try and draw that response. What do we have? We have data, HTTP, TCP, IP, and the last lot I'll just draw is 802.11, just to keep my picture simple. We're gonna have some data. So this is one way to draw. We're gonna have a HTTP header, then there's the TCP header and then the IP header. And finally, let's put all the rest into one called 802.11, the wireless LAN header. That's an example of our frame, one frame. We often draw our packets or frames like that that show the data, the contents, and then the separate headers which are attached. So again, from the layered perspective, this is the topmost layer, and then we go down as we move to the left. This is what actually is transmitted from A, or in this case, from B to A. And they each have some size. You could even note on there the data is X bytes. HTTP header is so many bytes, so TCP header is so many bytes. You get that information, we'll just go back to what from Wireshark. When I, it's hard for you to see, but when I select the data here, down the bottom it says 3983 bytes, the size of the data. HTTP 506 bytes, so think of that as the header is 506 bytes. TCP 32 bytes, IP header 20 bytes. What is inside that header? Well, we're gonna expand and see, well that 20 bytes has different information including the source IP address, the destination IP address, the length of the IP packet, and some other information, the header fields. And then to keep my picture simple, I drew this logical link control and 802.11 together. You can actually, you should draw them separately as two different ones. The radio tap header is in fact a special thing that Wireshark shows to show some characteristics of the radio signal. It's not a real header. It's a data structure used to say something about the physical layer. Maybe you can write it as the physical layer, but it's a bit of an exception. It shows things like the data rate used, the wireless LAN frequency used or the channel, the type 11G, not 11B, not 11N, and some signal strength. And frame in Wireshark just means the whole thing. That means the entire frame, 715 bytes in this case. Why is the data larger than 715? It turns out in this case, it's the frame, the data, the web page was broken into multiple and then combined at the end. It was fragmented. I don't expect you at this stage to understand what is happening in all of these protocols, but just try to capture the messages, the important messages. And of those important messages, draw at least one packet, one individual packet similar to this diagram and maybe make note of how big they are and you can optionally make note of what are some of the important values in there. So there are some of the things I want you to report on in the assignment. Other questions about this part of the assignment? Yours may not look like this. It may look, it may be different. Are you trying to capture? You can do it on Mac, you can capture and capture what he's sending on his phone. Give it a go. That's task two. Task three, measure the wireless LAN throughput. Take a file, a big file and transfer it from computer A to computer B and time how long it takes. And we know throughput is the rate at which the real data, that file, is delivered to the destination. So if we have a 100 megabyte file transferred and it takes 10 seconds, then the throughput is 100 divided by 10 or 10 megabytes per second. Do that multiple times and measure the throughput through multiple tests, multiple experiments and see what trends you see. What is the actual throughput? What's the maximum you can get? In that case, you can use the same two computers, A and B, you don't need N. You don't need a third computer. So task three, just two computers. But still using a direct connection, not using an access point. And that's where, for example, on an Apple Mac, you use, for example, what is it? AirDrop. AirDrop is one piece of software to transfer a file from one computer to another. Other software is available. You need to find some software to allow you to transfer one computer to another. Many different options available. You could have a web server on here and just use your web browser on here to transfer a file. You can use some secure or some FTP client and server, some download, some special application that works on Windows to transfer files. I think Windows even has, you can have it built in. On the same network in Windows, you can browse to other people's computers and transfer files. So you just need some way to transfer a file from one computer direct to another. Do it multiple times and measure the performance. Any questions on task three? Anyone done task one? Hands up, task one. Yeah, we tried at least. Task one is different. Not about wireless, it's about audio. What you need to do is record some audio, some something of your own, you talking, some music, whatever, but record some. So the audio input is the analog data and then you wanna record and save on your computer which of course stores digital data. So this process of using your computer to record that analog audio needs a codec to convert it to digital to store on your computer. So we use some codec that converts that analog into digital data and then it's stored on your computer. And now we've studied the PCM codec, pulse code modulation. In our lectures, remember the diagram with some audio input or some analog input and then we take samples every sampling period and for each sample, we map it to one of the levels on the vertical axis and that level is mapped to a binary value. If we had eight levels, zero through to seven, each number maps to a three bit binary value. And that binary value is the data. So that was PCM and that's a common codec. Think of that as the base codec to use. It does no compression, it does nothing fancy, just records and maps direct to digital data. So what you need to do is to record your audio first using PCM as the codec and save it as a file. How do you do that in practice? Most audio recording software, if the format, the output format is WAV, WAV, then typically it uses PCM unless you change it. By default WAV normally uses PCM. That means if you have your audio recorder and save a file in WAV format, it used PCM. Doesn't have to, but in most cases it will. Then you take that PCM encoded file and you want to investigate what happens if we use other codecs, not PCM, that's something different. How does that impact on performance? The way to do that is not to record new audio but to take the original PCM one and convert it using a different codec and select several different codecs. So let's talk about that. What have we have? So PCM's one codec, give me some others. Some audio codecs that you know of. Some shown up there. Those people that have done it, what did you use? Think of music files, audio files you have on your computer. What format or what name are they often given? MB3, okay, a common one. Let's just list some. So the original codec that you'll use is PCM and we distinguish between the codec, which is the algorithm for converting from analog to digital, like PCM, and the way in which that digital data is then saved on your hard disk, saved in a file. There are different data structures, sometimes called containers or formats of the file. PCM is often saved, sorry, in a wave format. Let's make this so you can see. Our screen has a problem, still, one more time. Okay, so one codec is PCM and commonly, the format used to save PCM encoded data is wave. Another one you just said is MP3. MP3 is a codec. The format used is also called MP3. So you see the extension and it's usually MP3. What's another codec? There are many, okay? I'm sure you've used other ones, or you've heard of other ones. You know of any others? Audio codecs, recorded music or listened to music or any form of audio recording, anything? You need to explore and find some out. Windows has some Windows media audio, okay? Still around, I think. Some used in, some audio formats used not so much for music, but for sound audio in videos, in movies. So the audio track for a movie. AAC is one. AC3, the format, I can't remember. I don't think it's AC3, it's used. You often find those two as the audio track of a movie. Flack is another one. And again, same format. Apple has what's called ALAC and often contained in M4A as the extension. And there are many others. Some common, some not so common. So first we distinguish between the algorithm for doing the conversion from analog to digital, the codec, and then the way in which that digital data is saved in a file, the format or container. Sometimes they're the same, sometimes they're different. So in fact, wave format can be used to store data encoded using different codecs. The same applies to videos. You may have seen videos with the MP4 or MKV extension. That's the format. But the codec to encode the video and the audio may be different. Maybe H264 or some audio format. I'll write up another couple that I'm going to demonstrate. There's VORBUS in an ALG format. And there's what's used in GSM mobile phones. We'll save it in a wave format. So there are many others as well. They have different characteristics, different algorithms. Think of PCM as the base codec. There's no compression involved. It just takes the data by sampling and produces the digital data and saved in a wave format. Most of the others compress, which means the file size after saving will be much smaller than when you use the wave format. Think of wave as uncompressed. All the others apply some compression, making the file size smaller. And they compress in different ways. What I want you to do is to take your wave file and convert to different codecs, using different codecs, and compare the results. I've done some... I've got some examples. What were they? I created some samples from before, actually from our lectures, and I saved them in wave format using PCM, some test files. Test four, test five, test six. Let's just make this display a little bit better. Three files that I've actually recorded. This is from some past lectures. So the audio, it was saved in a wave format using PCM as the codec in all three cases. And this shows those file sizes. We may come back to why they are that size later if we have time, but I've also used some software to convert them to using different codecs. And I'll run that again now. I've got my own script that will use a program to convert. And it takes some time to convert. It tries different codecs. So it takes the test four dot wave file and then using this first codec and the format. So it shows the codec, the format, the rate, the file size and time. And it's converting them now. The first one, again, there's a L here, libvo, aac, enc. That's in fact an implementation of the aac codec. That's one codec. The format, the output extension is dot aac. The second one, the codec is flat. There's an F here. And the output is also, the format is also flat. The third one, the codec is an implementation of MP3. There are different implementations of some codecs, different software that implements them. And then the fourth one is the codec is vorbus. The format is org. This one is aac. There's an a here. The format is m4a. This is a gsm codec. And actually the format is wave. I also set the bit rate to do the encoding. In some codecs, you can specify some parameters. In this case, a common parameter is the bit rate. If you think of the output file, how many bits per second are saved? So in each of these, I specify 32 kilobits per second. I can change that to something else, 64, 120 or some other number. Even though it's shown as 32 kilobits per second for all of these, in fact, it's not relevant for some of them. For FLAC, for ALAC, it doesn't make sense to talk about the bit rate. It's just displayed there because it's poorly implemented software on my part. Even gsm, it's not 32K, it's actually 13K. But for some of them, and I think you may know, with MP3, you can get different bit rate MP3s. In your assignment, you may try different bit rates. What does it do? What impact does it have? I've also recorded the resulting file size. So the first one using AAC is seven megabytes in length, the file. The original WAV file, test4.wav, was 158 megabytes. When we encode that same content using AAC as the codec, it's not 158 megabytes, it's compressed down to seven megabytes. So just a few percent of the original, five percent of the original size. So the codec includes, well, performs some form of compression. And what it does is looks at the structure of the audio and tries to omit information that's not useful in playing back that audio. And sometimes omit information that has very little impact on the output audio. For example, omit frequencies which have very low magnitude of the input. Audio, the input may have a range of frequencies. Maybe the high frequencies have very low magnitude, very low amplitude. The codec may omit them to save space. So we see different file sizes. AAC, MP3, Vaubus, all about seven megabytes. FLAC, ALAC, this M4A, don't get confused here. This is 72 megabytes. This is 73 megabytes. Understand what's the difference there when you do your assignment? Try and recognize, well, what's different between FLAC and these others? Why is one down to seven megabytes? The other down to just 70 megabytes. FLAC doesn't get a smaller file size. GSM, three megabytes, 2.9. The last number is the time it took to encode. So some are faster than others. That depends upon, of course, your computer. Depends upon the implementation as well and also the codec. So what you can do is compare based upon file size, compare based upon time to encode. And the third one is to compare based upon quality. If you play back the original WAV file and also then you play back the same audio but encoded with these other six codecs, which one sounds better? That's not easy to determine the quality because you'll find that many of them sound the same. It's hard to distinguish. In some cases, you'll be able to distinguish. So what I want you to do is to run some tests and listen to some of them and try and give your opinion on A, whether you can distinguish, okay, this one is different quality. That is, one is better than another. And maybe run that test multiple times, different input files. And see, maybe you come up with a conclusion that, okay, compared to my original WAV file, MP3, I can always hear that it's slightly lower quality. So sometimes you can distinguish. It's not easy to, in some cases. So if you can make some conclusions based upon that. What about GSM? That's another way, the best way is to listen and to get multiple people to listen and compare and give some score. Okay, this one's best, this one's second best and so on and get some statistics about what a group of people think of the best quality. I don't expect you to do too much of that in your assignment. At minimum, you should listen to some of the, or to a selection of files and see if you can distinguish or do you think they're all the same? If you wanna go further, you can run some tests and get several people to listen and give them a score. And give some ranking for the different codecs. But that's hard to do because many of them will sound the same. Any questions? On which program did I use? It's not called ComAudio. It's called FFmpeg, in this case. Actually, I will not run it, FFmpeg is a common, it's a program available on my computer, but it actually provides a library of many different codecs. It's used in many different, or that library is used in many different pieces of software and even hardware. So it's available on different operating systems. Another name or very similar, it's just a variation, is AV-Comp for audio-video conversion, but effectively the same from our perspective. You don't have to use that, you can use others. You'll find that many pieces of audio and video software that you use may use the library provided by FFmpeg. Another way to compare quality would be to look at the audio in an audio editor, a sound editor. Let me open up two of these files. I'll open up another test file that I've encoded, one using the Wave, the PCM Wave, and the other one using GSM, Autumnone's GSM, top one is Wave using PCM. Any difference? Can you see any visual difference? So this is the audio signal, or when we play it back, this is the audio that will be played back. It's the signal as a function of time in time domain. Very hard to see if there's any difference. They look the same from my perspective. You could zoom in and see if there's any difference in the amplitudes, so this is our signal over time. But we know we can also look at a signal in the frequency domain. Remember this is some signal that's made up of different components at different frequencies. The software allows us to plot the spectrum. The first 230 seconds, that is plot that same signal in the frequency domain. That's the top one, the PCM encoded. So I have the original audio, it was actually some musical piece in this case. I encoded with PCM, and this was the encoded data in the time domain, this is the encoded data in the frequency domain. Where, remember the frequency domain, at each frequency we have some magnitude, peak amplitude of that component. Now this shows it, it approximates it and we see a continuous plot. But the important thing we notice, look at the range of frequencies, the spectrum and the bandwidth. Ranges from zero up to a little bit past 15,000 hertz, 15 kilohertz. So this musical piece, when it was encoded with PCM, contains frequencies of up to about 15 kilohertz. We know with voice, typically the frequencies are up to about four kilohertz, but with music it's larger because there's different higher and lower frequencies than voice. So someone playing the piano or similar. Most of the greatest signal strength is in this range of up to 1,000 hertz. But there's still some components in the higher frequencies. So when we play this back, all of these components would be played back and heard by the listener. Now if we do the same for the GSM encoded, same original audio, but encoded with GSM, and it's hard to compare on the two screens, but you see the frequency components in the GSM encoded audio range up to just four kilohertz. What the GSM codec has done has effectively removed everything but beyond four kilohertz. So even though the original audio had frequency components from four up to 15 kilohertz, GSM doesn't include them. Because GSM codec is actually intended for transmitting voice. Most voice is contained within four kilohertz, so it just removes everything beyond that. But music has frequencies beyond four kilohertz. When you play back the GSM encoded file, you will not hear those higher frequency components, those higher frequencies. So the music, especially if it's important in that music, the higher frequencies, the quality will not sound as good. So that's another way to infer that GSM quality is going to be worse than the original one because it doesn't contain all the frequencies of the original audio. How much worse? Well, it depends on how significant those frequencies were. I don't necessarily want you to do this for all your codecs or your files. You could try and see if you notice a difference, but just be aware that you can compare from that perspective. Any questions? That finishes our discussion of the assignment. That is giving some hints about what you need to do. Any questions about the assignment? So audio conversion finds some software to do it for you. There's many different pieces of software and then two wireless LAN experiments. Maybe the hardest part, everyone can get access to computers. If you cannot get access to a computer that can monitor, then use the iMacs on the third four lab. They have wireless and they can monitor.