<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>driver writing != bus driving</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/iliast/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/iliast/feed.xml</link>
    <description>Ilias Tsigkogiannis&amp;#039; Introduction to Windows Device Drivers and Windows Audio Concepts</description>
    <lastBuildDate>Tue, 06 Dec 2016 20:45:25 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to emulate a Raspberry Pi on your PC</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/how-to-emulate-raspberry-pi</link>
      <pubDate>Thu, 10 Nov 2016 08:18:32 GMT</pubDate>
      <dc:creator><![CDATA[Ilias Tsigkogiannis]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/?p=556</guid>
      <description><![CDATA[I am very interested in trying simulators and emulators for popular IoT devices. One of those is the...]]></description>
      <content:encoded><![CDATA[I am very interested in trying simulators and emulators for popular IoT devices. One of those is the Raspberry Pi. As I was searching for simulators, I found that one of the best ones is QEMU. I found lots of information about how to use the QEMU simulator, in order to simulate a Raspberry Pi running Raspbian Wheezy (which is an older Raspbian version), but there was almost none for Raspbian Jessie (which is the latest Raspbian version). And the problem was that the steps that work for Wheezy, do not work for Jessie. So, in this article, I'll explain how to do this for Jessie. The same steps should also work if you are running Linux, however I have not tried them in Linux, so I cannot be sure.

<strong>1. Download the QEMU emulator</strong>

<strong></strong>The easiest way to download and install QEMU is to download the 32-bit binaries from <a href="https://qemu.weilnetz.de/w32/">https://qemu.weilnetz.de/w32/</a>. Even though my OS is 64-bit, the 64-bit version of QEMU did not work for me (the Raspbian kernel crashes during boot and the system restarts. The same problem happens with any QEMU version that is older than v2.6.0). After you download the latest file version (which is <a href="https://qemu.weilnetz.de/w32/qemu-w32-setup-20161016.exe">qemu-w32-setup-20161016.exe</a> as I'm writing the article), you can either double click and install it or you can use <a href="https://www.7-zip.org/download.html">7-zip </a>to extract the contents without installing (after you install 7-zip, you can right click on the QEMU exe file and select "Extract").

<strong>2. Download Raspbian</strong>

You can download the latest Raspbian image from Raspberry Pi's website. You can either download the full image (<a href="https://downloads.raspberrypi.org/raspbian_latest">https://downloads.raspberrypi.org/raspbian_latest</a>) or the "lite" version (<a href="https://downloads.raspberrypi.org/raspbian_lite_latest">https://downloads.raspberrypi.org/raspbian_lite_latest</a>), which is smaller. The filename that I downloaded is 2016-09-23-raspbian-jessie.img .After you download the image, you should extract it to the same directory as QEMU.

<strong>3. Download the kernel</strong>

You can download the latest precompiled kernel from <a href="https://github.com/dhruvvyas90/qemu-rpi-kernel">https://github.com/dhruvvyas90/qemu-rpi-kernel</a>. I used <a href="https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.4.13-jessie">kernel-qemu-4.4.13-jessie</a>. Save this file in the same directory as QEMU.

<strong>4. Expand the Raspbian image</strong>

If you immediately boot into Raspbian without expanding the image, you will notice that there is very little free space. In order to be able to use more space, you need to expand the image. You can determine how much more space you want to allocate to Raspbian. In order to add 5GB to your Raspbian image you can open a command prompt, go to your QEMU directory and type the command:

<em>qemu-img.exe resize &lt;your_raspbian_image&gt; +5G</em>

<em>e.g. qemu-img.exe resize 2016-09-23-raspbian-jessie.img +5G</em>

<strong>5. First boot (to fix a setting)</strong>

Now you are ready to boot your emulator for the first time. In your command prompt, you can type:

<em>qemu-system-arm -kernel &lt;your_kernel_image&gt; -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -drive "file=&lt;your_rapsbian_image&gt;,index=0,media=disk,format=raw" -redir tcp:2222::22</em>

<em>e.g. qemu-system-arm -kernel kernel-qemu-4.4.13-jessie -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -drive "file=2016-09-23-raspbian-jessie.img,index=0,media=disk,format=raw" -redir tcp:2222::22</em>

Notes:
<ol>
 	<li>If you see an error about missing dll files, then you can download them from <a href="https://qemu.weilnetz.de/w32/dll/">https://qemu.weilnetz.de/w32/dll/</a>.</li>
 	<li>You will see a warning saying that the -redir option has been replaced by the -netdev option. I am still using -redir, since I could not understand how to use -netdev. If you know how, please leave a comment below and I will replace the command.</li>
</ol>
After the emulator finishes booting, you will see a terminal window saying that you have started in emergency mode, instead of the default mode, due to an error. In order to fix this, you will need to create the file /etc/udev/rules.d/90-qemu.rules using your favorite editor, e.g.

<em>sudo nano /etc/udev/rules.d/90-qemu.rules</em>

In that file you need to add the following:

<em>KERNEL=="sda", SYMLINK+="mmcblk0"</em>
<em>KERNEL=="sda?", SYMLINK+="mmcblk0p%n"</em>
<em>KERNEL=="sda2", SYMLINK+="root"</em>

Note: You are currently using the British locale (en-GB), that's why some characters do not correspond to the standard American keyboard, e.g. the character " is typed when you press the key @ (and the opposite). We will fix this in a following step.

After saving the file, you can either close the emulator or issue the reboot command (sudo shutdown -r now).

Note: Previous versions of QEMU (before v2.6.0) required changes in /etc/ld.so.preload. However, this is not needed anymore.

During the beginning of the boot process, you will see lots of text. However, at some point the screen will go blank. You will have to wait for some time, but afterwards you will first see the mouse pointer and then you'll see the GUI. If you are asked for login credentials during the boot process, then you can use the following:

username: pi

password: raspberry

<strong>6. Expand the disk</strong>

At this point, we need to change the disk size so that it expands to the full size that we allocated in step 4 (i.e. to expand the disk by 5GB). In order to do that you need to do the following steps (I'm pasting the exact commands from <a href="https://www.xerxesb.com/2013/06/02/resizing-raspbian-image-for-qemu/">https://www.xerxesb.com/2013/06/02/resizing-raspbian-image-for-qemu/)</a>:

<em>1. &gt; sudo fdisk /dev/sda</em>
<em>2. Print the partition table ("p"). Take note of the starting block of the main partition</em>
<em>3. Delete the main partition ("d"). Should be partition 2.</em>
<em>4. Create (n)ew partition. (P)rimary. Position (2)</em>
<em>5. Start block should be the same as start block from the original partition</em>
<em>6. Size should be the full size of the image file (just press "enter")</em>
<em>7. Now write the partition table (w)</em>
<em>8. Reboot (shutdown -r now). After reboot,</em>
<em>9. &gt; sudo resize2fs /dev/sda2</em>

You can use the following command to verify the new size of the disk:

<em>df -h</em>

<strong>7. Increase the swap file for better performance</strong>

As you start using the emulator, you might observe that it is slow (especially if you have an old CPU). One reason for that is that the memory is only 256MB and the swap file is only 100MB. Unfortunately, there is no way to increase memory, but there is a way to increase the swap file. In order to do so, I'm using the instructions from <a href="https://www.bitpi.co/2015/02/11/how-to-change-raspberry-pis-swapfile-size-on-rasbian/">https://www.bitpi.co/2015/02/11/how-to-change-raspberry-pis-swapfile-size-on-rasbian/</a>

First you need to open the file /etc/<span>dphys-swapfile using your favorite editor, e.g.</span>

<em>sudo nano /etc/dphys-swapfile</em>

Then you need to find the line

<em>CONF_SWAPSIZE=100</em>

and change it to

CONF_SWAPSIZE=1024

After saving the file, you need to restart the service that manages the swapfile for Raspbian using the commands:

<em>sudo /etc/init.d/dphys-swapfile stop</em>
<em>sudo /etc/init.d/dphys-swapfile start</em>

If everything finishes successfully, you can verify the change in the swap file by using the command

<em>free -m</em>

The output should look like the following (the important part is that the line next to "swap" says "1023"):

<em>                   total           used           free            shared          buffers          cached</em>
<em>Mem:        248              213                33                      2                  12                   131</em>
<em>-/+ buffers/cache:        70             177</em>
<em><strong>Swap:      1023             0        1023</strong></em>

<strong>8. Use SSH for better performance</strong>

Another way to improve performance is to access your Raspberry Pi using SSH and not using the GUI. In order to enable this, we have mapped port 2222 from your system to port 22 of the emulator. This was done using the option "<em>-redir tcp:2222::22</em>" in the command that starts the emulator (section #4). So, all you need to do is to ssh in port 2222 of your system.

In order to do that, you need an ssh client, such as putty (which you can download from <a href="https://the.earth.li/~sgtatham/putty/latest/x86/putty.exe">https://the.earth.li/~sgtatham/putty/latest/x86/putty.exe</a>). After you download and run putty, you need to go to the tab "Session" and type pi@127.0.0.1 in the "Host Name (or IP Address)" box, as well as 2222 in the "Port" box. Then you can click on the "Open" button to connect. You can use the following credentials:

username: pi

password: raspberry

All the following steps can be done either from ssh (faster) or from a terminal window inside the GUI (slower).

<strong>9. Overclock the CPU for better performance</strong>

In a terminal window or ssh type

<em>sudo raspi-config</em>

<em>Select option "8 Overclock"</em>

<em>Select "Ok" in the warning message</em>

<em>Select "Turbo 1000MHz ARM"</em>

<em>Select "Ok" in the confirmation message</em>

Exit raspi-config

<strong>10. Change internalization options from British (en-GB) to American (en-US)</strong>

As we said earlier, we are currently using the British (en-GB) locale. In order to change it to American (en-US) or any other locale of your preference we need to execute the following commands from a terminal window or ssh:

<em>export LANGUAGE="en_US"</em>

<em>export LC_ALL="en_US-UTF-8"</em>

<em>export LANG="en_US-UTF-8"</em>

<em>sudo dpkg-reconfigure locales</em>

<em>Uncheck "en_GB-UTF-8"</em>

<em>Check "en_US-UTF-8"</em>

<em>Press Ok</em>

<em>Select "en_US.UTF-8" as the default locale for the system environment</em>

<strong>11. Change the screen resolution</strong>

At this point, your emulator is up and running. However, you might be thinking that the window is too small and the resolution too low. This is because your current resolution is 640x480 at 16-bit color depth. If you want to change it to 800x600 (which will also increase the window size), you need to create the file /etc/X11/xorg.conf. I found the instructions for this at <a href="https://www.linux-mitterteich.de/fileadmin/datafile/papers/2013/qemu_raspiemu_lug_18_sep_2013.pdf">www.linux-mitterteich.de/fileadmin/datafile/papers/2013/qemu_raspiemu_lug_18_sep_2013.pdf</a>

From a terminal window or ssh run your favorite editor, e.g.

<em>sudo nano /etc/X11/xorg.conf</em>

In that file you need to type the following contents:

<em>Section "Screen"</em>

<em>Identifier "Default Screen"</em>

<em>  SubSection "Display"</em>

<em>    Depth 16</em>

<em>    Modes "800x600" "640x480"</em>

<em>  EndSubSection</em>

<em>EndSection</em>

After you save the file you can either close the emulator window or restart using the command

<em>sudo shutdown -r now</em>

<strong>12. Final observations</strong>
<ol>
 	<li>Using the above instructions we can emulate an ARM1176 CPU (which is the same as the one on Raspberry Pi 1) that runs a generic kernel on a Raspbian OS. Technically, this is slightly different than emulating a Raspberry Pi 1, since there are differences in the kernel and the board configuration (e.g. GPIO pins). QEMU does provide support for better Raspberry Pi 1 and Raspberry Pi 2 emulation, but it does not support any network capabilities and I could not make it work (the screen remained black and the system did not boot). Andrew Baumann initially implemented the port for Raspberry Pi 2 at <a href="https://github.com/0xabu/">https://github.com/0xabu/</a> and he also helped me with this tutorial. If you want to try by yourselves (and please do so and let me know, if you make it work), then here are the changes that you need to start with, compared to the above instructions:
<ul>
 	<li>In step #3 you need to use a precompiled kernel for Raspberry Pi 1 or Raspberry Pi 2.
<ul>
 	<li>One option is to download them <a href="https://github.com/raspberrypi/firmware/tree/master/boot">https://github.com/raspberrypi/firmware/tree/master/boot</a>
<ul>
 	<li>kernel.img is the kernel for Raspberry Pi 1</li>
 	<li>kernel7.img is the kernel for Raspberry Pi 2</li>
</ul>
</li>
 	<li>A more difficult option is to install Raspbian on a real SD card, mount it (I'm not sure even if there are tools in Windows to do this) and then copy the kernel from the /boot directory.</li>
</ul>
</li>
 	<li>In order to boot the emulator you need to use the following commands:
<ul>
 	<li>Raspberry Pi 1: <em>qemu-system-arm -M raspi -kernel kernel.img -sd 2016-09-23-raspbian-jessie.img -append "rw earlyprintk loglevel=8   console=ttyAMA0 root=/dev/mmcblk0p2" -serial stdio</em></li>
 	<li>Raspberry Pi 2: <em>qemu-system-arm -M raspi2 -kernel kernel7.img -sd 2016-09-23-raspbian-jessie.img -append "rw earlyprintk loglevel=8   console=ttyAMA0 root=/dev/mmcblk0p2" -serial stdio</em></li>
</ul>
</li>
</ul>
</li>
 	<li>In order to enable SSH, we used the option <em>-redir tcp:2222::22</em> in the <em>qemu-system-arm</em> command. This option is deprecated and replaced by -<em>netdev</em>, that's why it triggers a warning message in the output. However, I could not understand how the -<em>netdev</em> option works. If you know how, please let me know in your comments, so that I can replace the above command.</li>
 	<li>It is not possible to copy data from the QEMU window, because it is an emulated framebuffer. If you know how to paste data to it, please write it in the comments and I will update the post accordingly.</li>
 	<li>If you have any tips regarding how to improve performance, then please post them in the comments. I tried allocating more than 256MB memory (using the -m 512 option in qemu-system-arm) as well as &gt; 1 CPU cores (using the -smp 4 option), but neither works.</li>
 	<li>If you know of any other emulators/simulators for popular IoT devices (running on desktop, browser, etc), feel free to paste them in the comments section.</li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>What's New in Audio for Windows 10</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/whats-new-in-audio-for-windows-10</link>
      <pubDate>Thu, 28 Jan 2016 00:09:00 GMT</pubDate>
      <dc:creator><![CDATA[Ilias Tsigkogiannis]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/2016/01/28/whats-new-in-audio-for-windows-10/</guid>
      <description><![CDATA[In my previous posts I gave a detailed overview of the Windows 8.1 audio stack. If you want to read...]]></description>
      <content:encoded><![CDATA[<p>In my previous posts I gave a detailed overview of the Windows 8.1 audio stack. If you want to read more about the Windows 8.1 audio stack, please look at the following posts:</p>
<ol>
<li><a href="https://blogs.msdn.com/b/iliast/archive/2015/02/16/overview-of-the-windows-8-1-audio-stack.aspx">Overview of the Windows 8.1 audio stack</a></li>
<li><a href="https://blogs.msdn.com/b/iliast/archive/2015/02/16/windows-8-1-audio-streaming-part-1-audio-categories.aspx">Audio categories</a></li>
<li><a href="https://blogs.msdn.com/b/iliast/archive/2015/02/18/windows-8-1-audio-streaming-part-2-power-savings-via-h-w-offload.aspx">H/W offload</a></li>
<li><a href="https://blogs.msdn.com/b/iliast/archive/2016/01/27/windows-8-1-audio-streaming-part-3-audio-processing.aspx">Audio processing (audio effects)</a></li>
<li><a href="https://blogs.msdn.com/b/iliast/archive/2016/01/27/windows-8-1-audio-streaming-part-4-background-playback-volume-policy-routing.aspx">Background audio playback, volume policies and routing</a></li>
</ol>
<p>In this post I will explain the differences between the Windows 8.1 audio stack and the Windows 10 audio stack. During the development of Windows 10, I spent a considerable amount of time working with the MSDN doc writers and the audio developers, in order to update the MSDN documentation for audio. So, in order to avoid duplicating information, I will try in this post to provide a quick summary of each new&nbsp;feature and then point you to the appropriate MSDN article, which will go into more depth.</p>
<p>Also, if you like listening to videos more than reading blog posts and documentation, then you're in luck. I worked with Andy Wen from our PC Ecosystem team and we presented an overview of the changes in WinHEC China 2015. You can find our presentation "<a href="https://channel9.msdn.com/Events/WinHEC/2015/WHT202">Enabling Great Audio Experiences in Windows&nbsp;10</a>"&nbsp;(the video is translated in real-time from Mandarin to English. You can also download the English version of the slides from that page as well).</p>
<p>These are the areas, where the audio stack changed in Windows 10:</p>
<ol>
<li>Low latency Audio</li>
<li>AudioGraph: a new API for Media Creation scenarios</li>
<li>New signal processing modes and audio&nbsp;categories</li>
<li>Offload APOs: APOs can be loaded on top of the offload pin</li>
<li>Cortana Voice Activation</li>
<li>New mechanism for Background Audio Playback</li>
<li>New audio codecs: ALAC, FLAC, AMR-NB</li>
<li>Windows Universal Drivers for Audio: The same driver works in both Windows 10 Desktop SKU and Windows 10 Mobile SKU</li>
<li>Resource management for audio drivers</li>
<li>PNP Rebalance support for audio drivers</li>
</ol>
<p>Looking at the above list of all changes in the Windows 10 audio stack, I just realized that I owned 80% of those features (I'm including a couple that I co-owned)! Not bad :)</p>
<p>In the following sections I will provide a quick&nbsp;overview of the change and point you to the corresponding MSDN links for additional information.</p>
<p><strong>1. Low latency audio</strong></p>
<p>Audio latency is the delay between that time that sound is created and when it is heard. Having low audio latency is very important for several key scenarios, such as the following.</p>
<ul>
<li>Pro Audio</li>
<li>Music Creation</li>
<li>Communications</li>
<li>Virtual Reality</li>
<li>Games</li>
</ul>
<p>The total latency of a device is the sum of the latencies of the following components:</p>
<ul>
<li>OS</li>
<li>APO</li>
<li>Audio driver</li>
<li>H/W</li>
</ul>
<p>In Windows 10 we minimized the latency of the OS to a bare minimum. Without any driver changes, all applications in Windows 10 will have 4.5-16ms lower latency. In addition, if the driver has been updated to take advantage of the new low latency DDIs that use small buffers to process audio data, then the latency can be reduced even more. In fact, as is shown in the following diagram, if a driver supports 3ms audio buffers, then the roundtrip latency is ~10ms. And today there are systems in the market that support &lt;3ms buffers :)</p>
<p>&nbsp;</p>
<p><a href="https://i-msdn.sec.s-msft.com/dynimg/IC816423.png"><img style="max-width: 550px;" src="https://i-msdn.sec.s-msft.com/dynimg/IC816423.png" alt="" border="0" /></a></p>
<p>&nbsp;In order to have a deeper dive of the low latency optimizations in the Windows stack, as well as the new low latency mechanisms that we provide for applications and drivers, please look at the <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt298187(v=vs.85).aspx">Windows 10 low latency whitepaper</a>. Also, you can look at our <a href="https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WindowsAudioSession">WASAPI low latency sample in GitHub</a>.</p>
<p><strong>2. AudioGraph</strong></p>
<p>AudioGraph is a very simple API that reduces lots of the overhead in Media Creation scenarios. It simplifies implementation by using the concept of an "audio graph".</p>
<p>An audio graph is a set of interconnected audio nodes through which audio data flows. Audio input nodes supply audio data to the graph from audio input devices, audio files, or from custom code. Audio output nodes are the destination for audio processed by the graph. Audio can be routed out of the graph to audio output devices, audio files, or custom code. The last type of node is a submix node which takes audio from one or more nodes and combines them into a single output that can be routed to other nodes in the graph. After all of the nodes have been created and the connections between them set up, you simply start the audio graph and the audio data flows from the input nodes, through any submix nodes, to the output nodes. This model makes scenarios like recording from a device's microphone to an audio file, playing audio from a file to a device's speaker, or mixing audio from multiple sources quick and easy to implement.</p>
<p>A good starting point to learn more&nbsp;is the <a href="https://msdn.microsoft.com/en-us/library/windows/apps/mt203787.aspx">MSDN page for AudioGraph</a>.&nbsp;If you want to start experimenting with the AudioGraph API is to use our <a href="https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/AudioCreation">AudioGraph sample in GitHub</a>.</p>
<p><strong>3. New audio categories and signal processing modes</strong></p>
<p>In my previous posts, I explained the concepts of <a href="https://blogs.msdn.com/b/iliast/archive/2015/02/16/windows-8-1-audio-streaming-part-1-audio-categories.aspx">audio categories</a> and <a href="https://blogs.msdn.com/b/iliast/archive/2016/01/27/windows-8-1-audio-streaming-part-3-audio-processing.aspx">signal processing modes</a>.</p>
<p>The following matrix shows the full&nbsp;list of audio categories in Windows 10:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/8204.audio_categories.PNG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/8204.audio_5F00_categories.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/8204.audio_categories.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/8204.audio_5F00_categories.PNG" alt="" border="0" /></a></p>
<p>The following matrix shows the full list of audio processing modes in Windows 10:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/1881.audio_modes.PNG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/1881.audio_5F00_modes.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/1881.audio_modes.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/1881.audio_5F00_modes.PNG" alt="" border="0" /></a></p>
<p>Let me clarify a few things between audio categories and audio signal processing modes:</p>
<ul>
<li>Applications tag each of their streams with one of the 10 audio categories that are provided by Windows</li>
<li>Each audio category is mapped to a specific signal processing mode.</li>
<ul>
<li>Applications do not have the option to change the mapping between an audio category and a signal processing mode.</li>
<li>Applications have no awareness of the concept of an "audio processing mode". They cannot find out what mode is used for each of their streams</li>
<li>Each signal processing mode needs to include audio processing (i.e. APOs) that optimize the audio signal for the scenarios described above.</li>
</ul>
<li>However, it is possible that not all modes might be available for a particular system</li>
<ul>
<li>Windows only mandate that the driver supports raw and/or default signal processing modes</li>
<li>Drivers define which signal processing modes they support (i.e. what types of APOs are installed as part of the driver) and inform Windows accordingly</li>
<li>If a particular mode is not supported by the driver, then Windows will use the next best matching mode</li>
</ul>
<li>It is recommended that IHVs/OEMs utilize the new modes to add audio effects that optimize the audio signal to provide the best user experience</li>
</ul>
<p>The following diagram shows a system that supports multiple modes:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/4137.modes_win10.PNG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/4137.modes_5F00_win10.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/4137.modes_win10.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/4137.modes_5F00_win10.PNG" alt="" border="0" /></a></p>
<p>For additional information about audio categories and audio signal processing modes, please visit the MSDN page for "<a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt243885(v=vs.85).aspx">Audio Processing Object Architecture</a>" and&nbsp;"<a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt186386(v=vs.85).aspx">Audio Signal Processing Modes</a>".</p>
<p><strong>4. Offload APOs</strong></p>
<p>In my <a href="https://blogs.msdn.com/b/iliast/archive/2015/02/18/windows-8-1-audio-streaming-part-2-power-savings-via-h-w-offload.aspx">post about the Windows 8.1 H/W offload</a>, I had written that Windows 8.1 that does not support loading of APOs on top of the offload pin. However, in Windows 10, we added support for this. This change enables some new scenarios, e.g.:</p>
<ol>
<li>In Windows 8.1, if the audio effects cannot be implemented in H/W (e.g. because the DSP is not powerful enough), then there was no practical way for the system to support offload. In Windows 10, these systems would implement the audio effects in S/W, in the form of APOs on top of the offload pin.</li>
<li>In Windows 10, we can split the audio processing between S/W and H/W. Also, the processing can change dynamically (i.e. some/all processing might be moved from the S/W APO to the DSP when there are enough H/W resources and then moved back to the S/W APO when the load in the DSP increases)</li>
</ol>
<p>Here is a diagram showing both the offload pin and the host pin:</p>
<p><a href="https://i-msdn.sec.s-msft.com/dynimg/IC834061.png"><img style="max-width: 550px;" src="https://i-msdn.sec.s-msft.com/dynimg/IC834061.png" alt="" border="0" /></a></p>
<p>For more information about offload APOs, please visit the MSDN page titled "<a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt604857(v=vs.85).aspx">Implementing Hardware Offloaded APO Effects</a>".</p>
<p><strong>5. Cortana Voice Activation</strong></p>
<p>Cortana, the personal assistant technology introduced on Windows Phone 8.1, is now supported on Windows 10 devices. Voice activation is a feature that enables users to invoke a speech recognition engine from various device power states by saying a&nbsp; specific&nbsp; phrase&nbsp; - "Hey Cortana".&nbsp; The&nbsp; "Hey Cortana" Voice Activation (VA) feature allows users to quickly engage an experience (e.g., Cortana) outside of his or her active context (i.e., what is currently on screen) by using his or her voice.</p>
<p>You can find more information about this feature at the MSDN page for <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt593238(v=vs.85).aspx">Voice Activation</a>.</p>
<p><strong>6. Background Audio Playback</strong></p>
<p>&nbsp;In my&nbsp;previous&nbsp;post about <a href="https://blogs.msdn.com/b/iliast/archive/2016/01/27/windows-8-1-audio-streaming-part-4-background-playback-volume-policy-routing.aspx">Windows 8.1 background audio playback</a>,I had explained&nbsp;that there were different mechanisms for apps to render audio from the background between the Desktop SKU and the Mobile SKU. In Windows 10, we have 1 mechanism that works for both SKUs and it is similar to the Windows 8.1 Mobile SKU mechanism.</p>
<p>More specifically, a Windows 10&nbsp;application that wants to play audio from the background&nbsp;needs to consist of two processes. The first process is the main app, which contains the app UI and client logic, running in the foreground. The second process is the background playback task, which implements&nbsp; <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.background.ibackgroundtask.aspx"><strong>IBackgroundTask</strong></a> like all UWP app background tasks. The background task&nbsp; contains the audio playback logic and background services. The background task communicates with the system through the System Media Transport Controls.</p>
<p>The following diagram is an overview of how the system is designed:</p>
<p><a href="https://i-msdn.sec.s-msft.com/dynimg/IC822907.png"><img style="max-width: 550px;" src="https://i-msdn.sec.s-msft.com/dynimg/IC822907.png" alt="" border="0" /></a></p>
<p>For more information, please visit the <a href="https://msdn.microsoft.com/en-us/library/windows/apps/mt282140.aspx">MSDN page for Background Audio</a>.</p>
<p><strong>7. Audio codecs</strong></p>
<p>In Windows 10 we added native support for FLAC, ALAC and AMR-NB codecs.</p>
<p>The list of supported audio codecs is:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/5444.audio_codecs.PNG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/5444.audio_5F00_codecs.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/5444.audio_codecs.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/5444.audio_5F00_codecs.PNG" alt="" border="0" /></a></p>
<p>For more information, please visit the MSDN page for "<a href="https://msdn.microsoft.com/en-us/library/windows/apps/mt282148.aspx">Supported Codecs</a>".</p>
<p><strong>8. Windows Universal&nbsp;Drivers for Audio</strong></p>
<p>Windows 10 supports one driver model that works for PC and 2:1&rsquo;s and Windows 10 for phones and small screen tablets. This means that IHVs can develop their driver in one platform and that driver works in all devices (desktops, laptops, tablets, phones). The result is reduced development time and cost.</p>
<p>In order to develop Universal Audio Drivers, you should take advantage of the following tools:</p>
<ol>
<li><a href="https://www.visualstudio.com/en-us/products/vs-2015-product-editions.aspx">Visual Studio 2015</a>: New driver setting to set &ldquo;Target Platform&rdquo; equal to &ldquo;Universal&rdquo;</li>
<li><a href="https://msdn.microsoft.com/en-us/windows-drivers/develop/validating_universal_drivers">APIValidator</a>: WDK tool that checks whether driver is Universal</li>
<li><a href="https://github.com/Microsoft/Windows-driver-samples/tree/master/audio/sysvad">Audio samples in GitHub</a>: Samples sysvad and SwapAPO have been converted to Universal Drivers</li>
</ol>
<p>For more information, please visit the MSDN page for "<a href="https://msdn.microsoft.com/en-us/library/windows/hardware/dn957852(v=vs.85).aspx">Universal Windows Drivers for Audio</a>".</p>
<p><strong>9. Resource Management for Audio Drivers</strong></p>
<p>One challenge with creating a good audio experience on a low cost mobile device, is that some devices have various concurrency constraints. For example, it is possible that the device can only play up to 6 audio streams concurrently and supports only 2 offload streams. When there is an active phone call on a mobile device, it is possible that the device supports only 2 audio streams. When the device is capturing audio, the device can only play up to 4 audio streams.</p>
<p>Windows&nbsp;10 includes a mechanism to express concurrency constraints to insure that high-priority audio streams and cellular phone calls&nbsp; will be able to play.&nbsp;&nbsp; If the system does not have enough resources, then low priority streams are terminated.&nbsp; This mechanism is only available in phones and tablets not on desktops or laptops.</p>
<p>For more information, please visit the MSDN page for "<a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt188599(v=vs.85).aspx">Audio Hardware Resource Management</a>"</p>
<p>&nbsp;<strong>10. PNP Rebalance for Audio Drivers</strong>&nbsp;</p>
<div id="mainSection">
<p>PNP rebalancing is used in certain PCI scenarios where memory resources need to be reallocated. In that case, some drivers are unloaded, and then reloaded at different memory locations, in order to create free contiguous memory space.</p>
<p>Rebalance can be triggered in two main scenarios:</p>
<dl><dd>1.&nbsp; PCI hotplug: A user plugs in a device and the PCI bus does not have enough resources to load the driver for the new device. Some examples of devices that fall into this category include Thunderbolt, USB-C and NVME Storage. In this scenario, memory resources need to be rearranged and consolidated (rebalanced) to support the additional devices being added.</dd><dd>2. PCI resizeable BARs: After a driver for a device is successfully loaded in memory, it requests additional resources. Some examples of devices include high-end graphics cards and storage devices.</dd></dl></div>
<p>For more information, please visit the MSDN page for "<a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt604858(v=vs.85).aspx">PNP rebalance for Audio drivers</a>".</p>
<p>&nbsp;</p>
<p><strong>MSDN References:</strong></p>
<ol>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt298187(v=vs.85).aspx">Windows 10 low latency whitepaper</a></li>
<ol>
<li><a href="https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WindowsAudioSession">WASAPI low latency sample in GitHub</a></li>
</ol>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/apps/mt203787.aspx">AudioGraph</a></li>
<ol>
<li><a href="https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/AudioCreation">AudioGraph sample in GitHub</a></li>
</ol>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt243885(v=vs.85).aspx">Audio Processing Object Architecture</a></li>
<ol>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt186386(v=vs.85).aspx">Audio Signal Processing Modes</a></li>
</ol>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt604857(v=vs.85).aspx">Implementing Hardware Offloaded APO Effects</a></li>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt593238(v=vs.85).aspx">Voice Activation</a></li>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/apps/mt282140.aspx">Background Audio</a></li>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/apps/mt282148.aspx">Supported Codecs</a></li>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/dn957852(v=vs.85).aspx">Universal Windows Drivers for Audio</a></li>
<ol>
<li><a href="https://github.com/Microsoft/Windows-driver-samples/tree/master/audio/sysvad">Audio samples in GitHub</a></li>
</ol>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt188599(v=vs.85).aspx">Audio Hardware Resource Management</a></li>
<li><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt604858(v=vs.85).aspx">PNP rebalance for Audio drivers</a></li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>Windows 8.1 Audio streaming – Part 4: Background playback, Volume policy, Routing</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/windows-8-1-audio-streaming-part-4-background-playback-volume-policy-routing</link>
      <pubDate>Wed, 27 Jan 2016 03:37:00 GMT</pubDate>
      <dc:creator><![CDATA[Ilias Tsigkogiannis]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/2016/01/27/windows-8-1-audio-streaming-part-4-background-playback-volume-policy-routing/</guid>
      <description><![CDATA[In the last post of this series, I will describe the last 3 types of stream behaviors/capabilities...]]></description>
      <content:encoded><![CDATA[<p>In the last post of this series, I will describe the last 3 types of stream behaviors/capabilities that are controlled by a stream's audio category:</p>
<ol>
<li>Background Audio Playback</li>
<li>Volume/Ducking</li>
<li>Routing</li>
</ol>
<p><strong>1. Background Audio Playback</strong></p>
<p>This policy defines, if the application will keep playing audio when the application goes to the background (e.g. because it is minimized). The application's behavior will differ based on whether it is a Win32 or a Store app. Also, Store apps have different behavior, if they are running on the desktop or on the phone. The following matrix&nbsp;explains the differences:</p>
<table style="width: 540px; height: 203px;" border="0" cellspacing="0" cellpadding="0"><colgroup><col width="82" /></colgroup><colgroup><col width="349" /></colgroup><colgroup><col width="147" /></colgroup>
<tbody>
<tr>
<td class="xl65" width="82" height="20">&nbsp;</td>
<td class="xl66" width="349"><span style="color: #3366ff;"><strong>Desktop</strong></span></td>
<td class="xl66" width="147"><span style="color: #3366ff;"><strong>Phone</strong></span></td>
</tr>
<tr>
<td class="xl67" height="25"><span style="color: #3366ff;"><strong>Win32 app</strong></span></td>
<td class="xl68" width="349">Always&nbsp;plays and captures audio from the background</td>
<td class="xl65">N/A</td>
</tr>
<tr>
<td class="xl67" height="83"><span style="color: #3366ff;"><strong>Store App</strong></span></td>
<td class="xl68" width="349">Only&nbsp;render streams that use the BackgroundCapableMedia or Communications&nbsp;categories will play audio when the app is in the background. No support for background&nbsp;capture</td>
<td class="xl68" width="147">Background capability not affected by audio categories. Instead, background-capable apps use the <a href="https://msdn.microsoft.com/en-us/library/windows/apps/hh394039(v=vs.105).aspx">Background Audio Player API</a>.</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong>2. Volume/Ducking Policy</strong></p>
<p>At any given point in time, there might be lots of streams running in a system. Each stream could have a different audio category. For example, let's assume that a user receives a Skype call, as he is listening to music.</p>
<ol>
<li>Xbox Music stream is using the BackgroundCapableMedia category</li>
<li>Skype stream is using the Communications category</li>
</ol>
<div>In order to make sure that the user can listen to the other party in the Skype call, Windows decides to attenuate (i.e. lower the volume) of the Xbox Music stream. These decisions are made based on internal audio stream policies that are based on the audio stream categories. Due to high number of combinations in the system (there are 8 audio categories in Windows 8.1), it would not be practical for Windows to allow the user to define the behavior for all potential stream combinations. However, users do have the option to control system behavior in the case of Communication streams by going to:</div>
<p>&nbsp;</p>
<div>Control Panel -&gt; Sound -&gt; Communications tab</div>
<div><span><br /></span></div>
<div><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/6646.communications_tab.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/6646.communications_5F00_tab.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/6646.communications_tab.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/6646.communications_5F00_tab.png" alt="" border="0" /></a></div>
<div>&nbsp;</div>
<div>There is additional information about ducking policies in <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd316773(v=vs.85).aspx">this MSDN page</a>.</div>
<p>&nbsp;</p>
<div><strong>3. Routing</strong></div>
<div>Stream routing is the mechanism that is used to switch streams between different endpoints with minimal interruption to the playback or the capture section. For example, if the user is listening to music from the internal speakers and plugs in a headphone, then audio is expected to switch to the headphone. Since there are multiple endpoints for audio render (internal speakers, external speakers that use the 3.5mm audio jack, USB speakers, HDMI speakers, BT speakers, etc) and for audio capture, Windows determines which endpoint is expected to be used. However, the mechanisms for audio routing and stream switching are different between the Destop SKU and the Mobile SKU:</div>
<div><ol>
<li>In the Desktop SKU, Windows notifies all applications that render/capture audio that they should switch to a different endpoint (e.g. because the user plugged/unplugged a headset). However, it up to the application to listen to these notifications, tear down the existing streams in the old endpoint and re-create them in the new endpoint</li>
<ol>
<li>For more information, please visit <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd756610(v=vs.85).aspx">this page</a>.</li>
</ol>
<li>In the Mobile SKU, all the work is done by the audio driver. Applications always render/capture from the same virtual endpoint. The driver switches the physical input/output between internal speakers, external speakers, etc.</li>
<ol>
<li>For more information, please visit <a href="https://sysdev.microsoft.com/en-us/Hardware/oem/docs/Driver_Components/Audio_routing">this page</a>.</li>
</ol></ol></div>]]></content:encoded>
    </item>
    <item>
      <title>Windows 8.1 Audio streaming – Part 3: Audio processing</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/windows-8-1-audio-streaming-part-3-audio-processing</link>
      <pubDate>Wed, 27 Jan 2016 01:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Ilias Tsigkogiannis]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/2016/01/27/windows-8-1-audio-streaming-part-3-audio-processing/</guid>
      <description><![CDATA[What type of audio processing processing is included in Windows? Does Windows support Echo...]]></description>
      <content:encoded><![CDATA[<p><strong>What type of audio processing processing is included in Windows? Does Windows support Echo Cancellation? Noise Suppression? Some other type of audio processing?</strong></p>
<p>One common misconception about the Windows audio stack is that Windows natively includes audio effects that modify the audio signal, e.g. acoustic echo cancellation, noise reduction, gain control, etc. However, in reality the audio stack just passes the unmodified raw signal from the application to the speakers or from the microphone to the application. The signal is not modified by any Windows component. In fact, the audio stack loads external components (called "Audio Processing Objects" or APOs) that modify the audio signal. There are multiple companies that create APOs for Windows, such as Dolby, DTS, Waves, Conexant, ForteMedia, Realtek, etc. All commercial systems for the well-known OEMs include at least one APO in the system. It is up to the OEM to decide what type of processing they want in each model and which company will create the APO for that model. In Windows 8.1 the APOs are bundled and installed together with the audio driver.</p>
<p>All APOs are required to declare the type of processing that they do, so that the applications can be informed about the type of processing that is available in each system. Windows provides a list of 18 types of audio effects (as is shown in this <a href="https://msdn.microsoft.com/en-us/windows.media.effects.audioeffecttype">MSDN link</a>):</p>
<ol>
<li>Acoustic Echo Cancellation</li>
<li>Noise Suppression</li>
<li>Automatic Gain Control</li>
<li>Beam Forming</li>
<li>Constant Tone Removal</li>
<li>Equalizer</li>
<li>Loudness Equalizer</li>
<li>Bass Boost</li>
<li>Virtual Surround</li>
<li>Virtual Headphones</li>
<li>Speaker Fill</li>
<li>Room Correction</li>
<li>Bass Management</li>
<li>Environmental Effects</li>
<li>Speaker Protection</li>
<li>Speaker Compensantion</li>
<li>Dynamic Range Compression</li>
<li>Other</li>
</ol>
<div>Each audio effect category is described in more detail <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt186386(v=vs.85).aspx">here</a>&nbsp;(just note that this link is for Windows 10).</div>
<div>&nbsp;</div>
<div><strong>How can I find the type of processing that was selected by the OEM for my system?</strong></div>
<div><ol>
<li>For playback processing: Control Panel -&gt; Sound -&gt; Playback tab -&gt; Right click on speakers -&gt; Properties -&gt; Enhancements</li>
<li>For capture processing:&nbsp;Control Panel -&gt; Sound -&gt; Recording tab -&gt; Right click on microphone -&gt; Properties -&gt; Enhancements</li>
</ol>
<div>Alternatively, if you don't want to go to control panel, then you can right lick on the speaker icon (at the bottom right of the screen) and select "Playback devices" (opens the "Playback tab" directly) or "Recording devices' (opens the "Recording tab" directly).</div>
<div><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/4606.speaker.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/4606.speaker.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/4606.speaker.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/4606.speaker.png" alt="" border="0" /></a></div>
<div>&nbsp;</div>
</div>
<div>If there is no Enhancements tab, then this PROBABLY means that there are no APOs in your system. I used the word "probably", because the Enhancements tab is actually a page that is created by the party supplying the APOs. So, it is up to them to create this page. Also, this means that they content of the page is totally up to them and they can decide how they want to name the audio effects that they provide (that's why the names in the list that you will see there do not always correspond with the above list with 18 audio effect types).</div>
<div>&nbsp;</div>
<div>You can enable/disable individual effects from that list and listen to the impact that it has on the output in your system. However, typically the OEM has tuned the default settings to be optimal for your device, so be careful about what you are changing.</div>
<div>&nbsp;</div>
<div>Typically, the 3rd parties also provide a box with titles, such as "Disable all enhancements" or "Disable all sound effects", etc. If you want to understand the impact of all these audio effects in your system, you can select that box (click "Apply") and play sounds. Most probably you will find that the audio will now be lower quality (e.g. lower volume). Remember to uncheck the box afterwards, so that the audio effects are enabled again.</div>
<div>&nbsp;</div>
<div><strong>Are all audio effects applied to all streams? Which effect is applied first?</strong></div>
<div>In order to explain this easily, let's take a look at the following diagram of the audio stack:</div>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/5582.modes.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/5582.modes.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/5582.modes.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/5582.modes.jpg" alt="" border="0" /></a></p>
<div>
<p>Applications have the option to select if they want to open a stream using default mode or raw mode:</p>
<ul>
<li>Default mode is appropriate for most applications. The stream will go through all audio effects (SFX, MFX, EFX) that have been selected by the OEM, in order to optimize audio quality</li>
<li>Raw mode will avoid most processing (only EFX are applied to raw streams). This should be used by applications who want to have unprocessed audio signal (e.g. Pro Audio applications)</li>
</ul>
</div>
<div>Audio effects can be applied to:</div>
<ol>
<li>An individual stream: Stream effects (SFX)</li>
<li>All streams that&nbsp;use same mode (explained below): Mode effects (MFX)</li>
<li>All streams that use the same endpoint (e.g. speakers, microphone, etc): Endpoint effects (EFX)</li>
</ol>
<p>Each of the 18 audio effect types from the above list can be applied to any of the 3 positions (SFX, MFX, EFX). Also, each position (SFX, MFX, EFX) can have processing for multiple effect types.</p>
<p>Audio effects can be implemented in S/W, in H/W or a combination of both.</p>
<p>If you want more information about this topic, you can look at the <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt243885(v=vs.85).aspx">Audio Processing Object Architecture </a>page in in MSDN. Just note that the MSDN page is describing the Windows 10 architecture, which is slightly different than the Windows 8.1 architecture that is described in this post.</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows 8.1 Audio streaming – Part 2: Power savings via H/W offload</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/windows-8-1-audio-streaming-part-2-power-savings-via-hw-offload</link>
      <pubDate>Wed, 18 Feb 2015 22:17:00 GMT</pubDate>
      <dc:creator><![CDATA[Ilias Tsigkogiannis]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/2015/02/18/windows-8-1-audio-streaming-part-2-power-savings-via-hw-offload/</guid>
      <description><![CDATA[&nbsp;
Overview
As I mentioned in my previous blog post, one of the policies that is determined...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p><strong>Overview</strong></p>
<p><span style="font-family: Calibri; font-size: small;">As I mentioned in my previous </span><a href="https://blogs.msdn.com/b/iliast/archive/2015/02/16/windows-8-1-audio-streaming-part-1-audio-categories.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">blog post</span></a><span style="font-family: Calibri; font-size: small;">, one of the policies that is determined based on the audio categories is related to power savings. In order to lower power consumption for audio, we need to wake up the CPU less frequently and put less load on the CPU (by offloading more functionality to H/W that is dedicated to audio, such as the audio codec or the audio DSP). This feature is called </span><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/dn302038%28v=vs.85%29.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">Hardware-Offloaded Audio Processing (HAP)</span></a><span style="font-family: Calibri; font-size: small;"> or simply audio offload.</span></p>
<p>&nbsp;</p>
<p><strong>Audio buffer sizes in Windows 8.1</strong></p>
<p><span style="font-family: Calibri; font-size: small;">In order to explain this functionality better, it makes sense to start by explaining the first step while streaming audio: the application writes the audio data in a buffer, so that it can be processed by the audio stack. There are 2 available buffer sizes:</span></p>
<ol>
<li>
<p>10 ms (this is called the &ldquo;host pin&rdquo; or the &ldquo;system pin&rdquo;)</p>
<ol>
<li>
<p>The CPU wakes up every 10ms, fills in the 10ms buffer and can go to lower power states.</p>
</li>
</ol></li>
<li>
<p>1 second (this is called the &ldquo;offload pin&rdquo;)</p>
<ol>
<li>
<p>The CPU wakes up every 1sec, fills in the 1-second buffer and can go to lower power states.</p>
</li>
</ol></li>
</ol>
<p><span style="font-family: Calibri; font-size: small;">There is a trade-off between using each of the two buffer sizes. </span></p>
<p><span style="font-family: Calibri; font-size: small;">The 10ms buffer leads to:</span></p>
<ol>
<li>
<p>Lower latency (imagine that if the application fills in the buffer and immediately needs to play &ldquo;ding&rdquo; tone, then it only needs to wait for 10ms until the next pass),</p>
</li>
<li>
<p>High power consumption (we need to wake up the CPU every 10ms to write data into the audio buffer)</p>
</li>
</ol>
<p><span style="font-family: Calibri; font-size: small;">In general, we want to use this buffer for anything that requires low latency, such as VOIP calls, alerts, sound effects, etc.</span></p>
<p><span style="font-family: Calibri; font-size: small;">The 1 second buffer leads to:</span></p>
<ol>
<li>
<p>High latency (after the data is written into the buffer, we need to wait 1 second before being able to write the next &ldquo;ding&rdquo; into the buffer)</p>
</li>
<li>
<p>Low power consumption (we wake up the CPU every 1 second)</p>
</li>
</ol>
<p><span style="font-family: Calibri; font-size: small;">In general, we want to use the 1 second buffer, when we play audio files or movies. In that case, we want the battery to last as long as possible and waiting for a few seconds until the beginning of an mp3 file or a movie is not important.</span></p>
<p>&nbsp;</p>
<p><strong></strong><strong>H/W and S/W requirements to support audio offload</strong></p>
<p><span style="font-family: Calibri; font-size: small;">Hopefully, with the above use cases, it now makes sense why we&rsquo;ve tied the 1-second buffers with the usage of the following 2 categories:</span></p>
<ol>
<li>
<p>BackgroundCapableMedia: Mostly used for audio playback</p>
</li>
<li>
<p>ForegroundOnlyMedia: Mostly used for video playback</p>
</li>
</ol>
<p><span style="font-family: Calibri; font-size: small;">More specifically, one of the requirements in order to use the 1-second buffers is to use the two categories above. However, things become a little more complicated, when we take into consideration that not all H/W and drivers support this feature, and when we include both &ldquo;screen-on&rdquo; and &ldquo;screen-off&rdquo; scenarios.</span></p>
<p><span style="font-family: Calibri; font-size: small;">So, here are the requirements, in order for an application to use the 1-second buffer, when the screen is ON:</span></p>
<ol>
<li>
<p>The application needs to be a Store application (offload is not available to Win32 apps. I will explain the reasons below)</p>
</li>
<li>
<p>The application needs to set the audio category of a stream as BackgroundCapableMedia or ForegroundOnlyMedia</p>
</li>
<li>
<p>The H/W needs to be offload-capable (either the DSP or the audio codec)</p>
</li>
<li>
<p>The driver needs to support audio offload.</p>
<ol>
<li>
<p>Note: Even though I have not talked much about audio drivers yet, I&rsquo;d like to point out that only that use the <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/ff538837%28v=vs.85%29.aspx"><span style="color: #0563c1;">WaveRT audio miniport model</span></a> can support audio offload</p>
</li>
</ol></li>
</ol>
<p><span style="font-family: Calibri;"><span style="font-size: small;"><span style="text-decoration: underline;">In addition to the all the above requirements</span>, in order for an application to use the 1-second buffer, when the screen is off &nbsp;(also known as </span></span><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/dn621143%28v=vs.85%29.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">Low Power Audio or LPA</span></a><span style="font-family: Calibri; font-size: small;">), the following requirements need to be met:</span></p>
<ol>
<li>
<p>The application needs to set the audio category of a stream as BackgroundCapableMedia</p>
</li>
<li>
<p>The application needs to declare in its manifest that it is background-capable (for more information: <a href="https://msdn.microsoft.com/en-us/library/windows/apps/hh700367.aspx"><span style="color: #0563c1;">https://msdn.microsoft.com/en-us/library/windows/apps/hh700367.aspx</span></a>)</p>
</li>
<li>
<p>The H/W needs to support the Connected Standby (CS) low power state</p>
</li>
</ol>
<p><span style="font-family: Calibri; font-size: small;">Intel has a whitepaper for LPA at </span><a href="https://software.intel.com/en-us/articles/low-power-audio-playback-windows-store-whitepaper"><span style="color: #0563c1; font-family: Calibri; font-size: small;">https://software.intel.com/en-us/articles/low-power-audio-playback-windows-store-whitepaper</span></a></p>
<p>&nbsp;</p>
<p><strong>Offload diagram</strong></p>
<p><span style="font-family: Calibri; font-size: small;">Apart from waking up the CPU less often (which is achieved by using a larger buffer), in order to achieve lower power consumption, we also need to ask the CPU to do less work. In the diagram that I included in my </span><a href="https://blogs.msdn.com/b/iliast/archive/2015/02/16/windows-8-1-audio-streaming-part-1-audio-categories.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">previous post</span></a><span style="font-family: Calibri;"><span style="font-size: small;">, I showed that the audio data is passed from the application to the Audio Device Graph (audiodg). AudioDG loads the Audio Engine (AudioEng), which allows 3</span><sup><span style="font-size: x-small;">rd</span></sup><span style="font-size: small;"> party dlls called APOs (Audio Processing Objects) to process the audio stream. Actually, this is the correct path when we use 10ms buffers. However, for 1-second buffers, Windows expects that all the processing will be done in H/W. As a result, for Windows 8.1, we do not load APOs, when we use the offload pin (1-second buffers). Here is a diagram that shows this:</span></span></p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/8371.offload_diagram.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/8371.offload_5F00_diagram.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/8371.offload_diagram.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/8371.offload_5F00_diagram.png" alt="" border="0" /></a></p>
<p><span style="font-family: Calibri; font-size: small;">Here I wanted to clarify that audio effects can be implemented:</span></p>
<ol>
<li>
<p>In S/W: Audio Device Graph (audiodg) loads 3<sup>rd</sup> party dlls, which are called Audio Processing Objects</p>
<ol>
<li>
<p>This option is only available, when there is no offload (i.e. for 10ms buffers)</p>
</li>
</ol></li>
<li>
<p>In H/W: By the audio codec or the DSP</p>
<ol>
<li>
<p>This option is available regardless of whether we use offload (1 second buffers) or not (10ms buffers)</p>
</li>
</ol></li>
</ol>
<p>&nbsp;</p>
<p><strong>FAQ: Why is offload not supported&nbsp;for Win32 apps?</strong></p>
<p><span style="font-family: Calibri;"><span style="font-size: small;">One more point that I&rsquo;d like to make here is that Windows only requires drivers to support 2 offload pins. It&rsquo;s up to H/W developers to determine, if they want/can support more. Each offload pin corresponds to one stream that can be offloaded. So, if the H/W has 2 offload pins, this means that 2 streams can be offloaded (i.e. use the 1-second buffer) at any point in time. The 3</span><sup><span style="font-size: x-small;">rd</span></sup><span style="font-size: small;"> stream (and all streams after that) that tries to use the offload pin will actually be switched to the non-offloaded path (10ms buffers). Implementing an offload pin takes a lot of H/W resources, that&rsquo;s why most H/W cannot simultaneously support many (i.e. 3+) offloaded streams.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">So, this makes it easier to understand why we offer support for offload only to Store apps and not to Win32 apps. Most Store apps are not background-capable, so we can suspend their audio streams when they go into the background (or are minimized, etc). This means that the offload pin that they occupied is now available for other apps to use. However, Win32 apps do not get suspended when they go into the background. So, if a Win32 application, such as Windows Media Player is sitting in the background with a paused stream, we cannot take its offload pin and make it available to other apps. Since most Win32 apps have a long process lifetime (i.e. users let them run in the background), if we allowed them to offload audio streams, then they would easily grab the two offload pins and keep them unused for long periods of time.</span></p>
<p><strong><span style="font-family: Calibri; font-size: small;">FAQ: Can a system have only S/W audio effects and support audio offload?</span></strong></p>
<p><span style="font-family: Calibri; font-size: small;">The last topic that is often asked from H/W manufacturers is whether the following combination is possible:</span></p>
<ol>
<li>
<p>Support audio offload</p>
</li>
<li>
<p>Implement audio effects in S/W (as APOs that are loaded by audiodg)</p>
</li>
<li>
<p>Do not implement any audio effects in H/W</p>
</li>
</ol>
<p><span style="font-family: Calibri; font-size: small;">Unfortunately, this combination is not possible in Windows 8.1. All systems that support audio offload, need to have their audio effects implemented in H/W. If the audio effects were implemented as APOs that are loaded by audiodg, then sometimes they would be applied on the audio stream (when the audio stream is going through audiodg) and sometimes they would not be applied (when the audio stream is being offloaded). As a result, the user would see inconsistent behavior (the same file would sound differently based on whether the stream is offloaded or not). </span></p>
<p><span style="font-family: Calibri; font-size: small;">If a H/W manufacturer cannot implement the audio effects in H/W and still wants to support audio offload, then he can choose to implement the audio effects in kernel-mode (loaded by the audio drivers). This is a more complicated process, as it complicates driver development, but this option is provided by Windows.</span></p>
<p><strong><span style="font-family: Calibri; font-size: small;">Additional resources:</span></strong></p>
<ol>
<li>
<p>MSDN link for Audio offload: <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/dn302038%28v=vs.85%29.aspx"><span style="color: #0563c1;">https://msdn.microsoft.com/en-us/library/windows/hardware/dn302038%28v=vs.85%29.aspx</span></a></p>
</li>
<li>
<p>MSDN link for Low Power Audio (LPA): <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/dn621143(v=vs.85).aspx"><span style="color: #0563c1;">https://msdn.microsoft.com/en-us/library/windows/hardware/dn621143(v=vs.85).aspx</span></a></p>
</li>
<li>
<p>Intel&rsquo;s whitepaper for Low Power Audio: <a href="https://software.intel.com/en-us/articles/low-power-audio-playback-windows-store-whitepaper"><span style="color: #0563c1;">https://software.intel.com/en-us/articles/low-power-audio-playback-windows-store-whitepaper</span></a></p>
</li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>Windows 8.1 Audio streaming – Part 1: Audio categories</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/windows-8-1-audio-streaming-part-1-audio-categories</link>
      <pubDate>Mon, 16 Feb 2015 17:30:00 GMT</pubDate>
      <dc:creator><![CDATA[Ilias Tsigkogiannis]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/2015/02/16/windows-8-1-audio-streaming-part-1-audio-categories/</guid>
      <description><![CDATA[Applications create audio streams for a variety of reasons. For example:


Games might have soft...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Calibri; font-size: small;">Applications create audio streams for a variety of reasons. For example:</span></p>
<ul>
<li>
<p><strong>Games</strong> might have soft music playing in the background, as well loud game effects (e.g. when a user fires a bullet)</p>
</li>
<li>
<p><strong>Media players</strong> play audio and video files</p>
</li>
<li>
<p><strong>Communication applications</strong> (e.g. Skype, Lync) allow users to talk to each other remotely</p>
</li>
<li>
<p><strong>Sound recorders </strong>record audio from other applications or from the environment</p>
<p>&nbsp;</p>
</li>
</ul>
<p><span style="font-family: Calibri; font-size: small;">In order to inform the system about the usage of an audio stream, applications have the option to tag the stream with a specific &ldquo;audio category&rdquo;. &nbsp;Applications can set the audio category, using any of the audio APIs, just after creating the audio stream.</span></p>
<p><span style="font-family: Calibri; font-size: small;">Windows 8.1 supports the following 8 </span><a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.audiocategory"><span style="color: #0563c1; font-family: Calibri; font-size: small;">audio categories</span></a><span style="font-family: Calibri; font-size: small;">:</span></p>
<ol>
<li>
<p><strong>ForegroundOnlyMedia</strong>: Games or other sounds designed to work only in the foreground, but will mute existing background media sounds. Examples include game audio needed for a game (dancing games, music games), feature films (designed to pause when they go to the background)</p>
</li>
<li>
<p><strong>BackgroundCapableMedia</strong>: For audio that needs to continue playing in the background. Examples include: Local media playback, local playlist, streaming radio, streaming playlist, music videos, streaming audio/radio (e.g. YouTube, Netflix, etc)</p>
</li>
<li>
<p><strong>Communications</strong>: For audio streaming communication audio such as Voice over IP (VoIP), real-time chat or other type of phone call</p>
</li>
<li>
<p><strong>Alerts</strong>: Looping or longer running alert sounds, such as alarm, ring tones, ringing notification, sounds that need to decrease existing audio</p>
</li>
<li>
<p><strong>SoundEffects</strong>: Sounds designed to mix with existing audio, such as beeps, dings, and other brief sounds</p>
</li>
<li>
<p><strong>GameEffects</strong>: Game sound effects designed to mix with existing audio, such as balls bouncing, engine sounds, characters talking, all non-music sounds</p>
</li>
<li>
<p><strong>GameMedia</strong>: Background music played by a game</p>
</li>
<li>
<p><strong>Other</strong>: Default stream category used for uncategorized streams</p>
</li>
</ol>
<p><span style="font-family: Calibri; font-size: small;">This information allows the audio stack to optimize the user experience. More specifically, the stream audio category defines several characteristics of the way that the system interacts with the audio stream, such as:</span></p>
<ol>
<li>
<p><a href="https://blogs.msdn.com/b/iliast/archive/2016/01/27/windows-8-1-audio-streaming-part-4-background-playback-volume-policy-routing.aspx">Audio routing</a></p>
<ul>
<li>
<p>Which endpoint should we use to play or capture sounds related to that stream?</p>
</li>
<li>
<p>Example: When a user connects/disconnects new device (e.g. headset, Miracast, BT, USB, etc), should a particular audio stream switch to it or not?</p>
</li>
</ul>
</li>
<li>
<p><a href="https://blogs.msdn.com/b/iliast/archive/2016/01/27/windows-8-1-audio-streaming-part-4-background-playback-volume-policy-routing.aspx">Volume</a></p>
<ul>
<li>
<p>When a user starts a new stream, do we need to attenuate/mute any of the streams that are already playing or capturing audio?</p>
</li>
<li>
<p>Example: When a user starts speaking on Skype, it is ok if a YouTube video keeps playing in the background at full volume?</p>
</li>
</ul>
</li>
<li>
<p><a href="https://blogs.msdn.com/b/iliast/archive/2016/01/27/windows-8-1-audio-streaming-part-3-audio-processing.aspx">Audio processing</a></p>
<ul>
<li>
<p>What types of audio effects should the system apply to each audio stream?</p>
</li>
<li>
<p>Example: communication streams might need not only to reduce unneeded ambient noises by enabling Acoustic Echo Cancelation and Noise Suppression, but also to capture the user&rsquo;s voice clearly by enabling Beam Forming and Acoustic Gain Control.</p>
</li>
</ul>
</li>
<li>
<p><a href="https://blogs.msdn.com/b/iliast/archive/2015/02/18/windows-8-1-audio-streaming-part-2-power-savings-via-h-w-offload.aspx">Power savings (via H/W offload)</a></p>
<ul>
<li>
<p>Should the processing of the stream be offloaded to the H/W, so that we can lower power consumption of the device?</p>
</li>
<li>
<p>Example: When a user watches a movie, the system has the option to prefetch big audio buffers and send them to the H/W for processing, in order to avoid waking up the CPU very often</p>
</li>
</ul>
</li>
<li>
<p><a href="https://blogs.msdn.com/b/iliast/archive/2016/01/27/windows-8-1-audio-streaming-part-4-background-playback-volume-policy-routing.aspx">Background Audio Playback</a></p>
<ul>
<li>
<p>When the application goes into the background, should audio keep playing?</p>
</li>
<li>
<p>Example: When a user is playing a game and he minimizes the window, in order to open a new tab in Internet Explorer, should the audio from the game still be audible?</p>
</li>
</ul>
</li>
</ol>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>
<p><span style="font-family: Calibri; font-size: small;">In the next few posts I will dive deeper into each of the 5 policies mentioned above.</span></p>
<p>&nbsp;</p>
<p><strong>Code samples: How to set an audio category</strong></p>
<p><span style="text-decoration: underline;">1. XAML: MediaElement</span></p>
<p>&lt;MediaElement&nbsp;x:Name="mediaplayer"&nbsp;&nbsp;AudioCategory="Communications"&nbsp;/&gt;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;">2. HTML: Audio Tag</span></p>
<p>&lt;audio msAudioCategory="Communications&ldquo;&gt;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;">3. C++: WASAPI</span></p>
<p>// Instantiate the interface to set the audio categories</p>
<p>IAudioClient2 *pAudioClient2;</p>
<p>pMMDevice-&gt;Activate(__uuidof(IAudioClient2), CLSCTX_ALL, NULL, (void **)&amp;pAudioClient2));</p>
<p>&nbsp;</p>
<p>// Set the category of the stream to be Communications</p>
<p>AudioClientProperties props = {};</p>
<p>props.cbSize = sizeof(props);</p>
<p>props.eCategory = AudioCategory_Communications;</p>
<p>pAudioClient2-&gt;SetClientProperties(&amp;props);<strong><br /></strong></p>]]></content:encoded>
    </item>
    <item>
      <title>Overview of the Windows 8.1 Audio Stack</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/overview-of-the-windows-8-1-audio-stack</link>
      <pubDate>Mon, 16 Feb 2015 17:21:00 GMT</pubDate>
      <dc:creator><![CDATA[Ilias Tsigkogiannis]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/2015/02/16/overview-of-the-windows-8-1-audio-stack/</guid>
      <description><![CDATA[As a Program Manager in the Audio team, one of my goals is to improve visibility into the Windows...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Calibri; font-size: small;">As a Program Manager in the Audio team, one of my goals is to improve visibility into the Windows audio stack. As a result, I&rsquo;ve decided to start a series of posts that provide a high-level overview of the Windows 8.1 audio stack. As time progresses, my goal is to enhance this information and go into more depth.</span></p>
<p><span style="font-family: Calibri; font-size: small;">From a high level perspective, the audio stack has 6 main components:</span></p>
<ol>
<li>
<p>APIs</p>
</li>
<ol>
<li>
<p>High-level APIs:</p>
<ol>
<li>
<p>Supported APIs:</p>
<ol>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.mediaelement"><span style="color: #0563c1;">XAML MediaElement</span></a> (C#, VB, C++)</p>
</li>
<li>
<p>HTML <a href="https://msdn.microsoft.com/en-us/library/ie/ff975061(v=vs.85).aspx"><span style="color: #0563c1;">&lt;audio&gt;</span></a> and <a href="https://msdn.microsoft.com/en-us/library/ie/ff975073(v=vs.85).aspx"><span style="color: #0563c1;">&lt;video&gt;</span></a> tags (used by websites and Windows Web Apps)</p>
</li>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms694197(v=vs.85).aspx"><span style="color: #0563c1;">Media Foundation</span></a> (C++)</p>
</li>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/ie/windows.media.capture"><span style="color: #0563c1;">Windows.Media.Capture</span></a> (C#, VB, C++)</p>
</li>
</ol></li>
<li>
<p>Deprecated APIs:</p>
<ol>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd375454(v=vs.85).aspx"><span style="color: #0563c1;">DirectShow</span></a></p>
</li>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb318665(v=vs.85).aspx"><span style="color: #0563c1;">DirectSound</span></a></p>
</li>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd743680(v=vs.85).aspx"><span style="color: #0563c1;">PlaySound</span></a></p>
</li>
<li>
<p><a href="https://msdn.microsoft.com/library/windows/apps/hh700786"><span style="color: #0563c1;">Windows.Media.MediaControl</span></a></p>
</li>
</ol></li>
</ol></li>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd370805%28v=vs.85%29.aspx"><span style="color: #0563c1;">Low-level APIs</span></a>:</p>
<ol>
<li>
<p>Recommended:</p>
<ol>
<li>
<p>For Streaming:</p>
<ol>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd371455(v=vs.85).aspx"><span style="color: #0563c1;">WASAPI</span></a> (high performance, but more complicated)</p>
</li>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/hh405049(v=vs.85).aspx"><span style="color: #0563c1;">XAudio2</span></a> (games)</p>
</li>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/dd742875(v=vs.85).aspx"><span style="color: #0563c1;">MIDI</span></a></p>
</li>
</ol></li>
<li>
<p>For Device Enumeration:</p>
<ol>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/ie/windows.devices.enumeration"><span style="color: #0563c1;">Windows.Devices.Enumeration</span></a></p>
</li>
</ol></li>
</ol></li>
<li>
<p>Not recommended for Windows applications:</p>
<ol>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd316556(v=vs.85).aspx"><span style="color: #0563c1;">MMDevice API</span></a> (replaced by Windows.Devices.Enumeration)</p>
</li>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd370809(v=vs.85).aspx"><span style="color: #0563c1;">DeviceTopology API</span></a></p>
</li>
<li>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd370832(v=vs.85).aspx"><span style="color: #0563c1;">EndpointVolume API</span></a></p>
</li>
</ol></li>
</ol></li>
</ol>
<li>
<p>Audio Device Graph (audiodg.exe), which loads the Audio Engine (audioeng.dll)</p>
<ol>
<li>
<p>Corresponds to Android&rsquo;s AudioFlinger</p>
</li>
<li>
<p>Mixes and processes audio streams</p>
</li>
<li>
<p>Loads &ldquo;Audio Processing Objects&rdquo; (APOs), which are H/W-specific plugins that process the audio signal. Android has a similar element called &ldquo;audio effects&rdquo;</p>
</li>
</ol></li>
<li>
<p>Audio Service (audiosrv.dll)</p>
<ol>
<li>
<p>Used to setup and control audio streams</p>
</li>
<li>
<p>Implements Windows policies for background audio playback, ducking, etc</p>
</li>
</ol></li>
<li>
<p>Audio Endpoint Builder (audioendpointbuilder.exe)</p>
<ol>
<li>
<p>Used to discover new audio devices and create S/W audio endpoints</p>
</li>
</ol></li>
<li>
<p>Audio drivers</p>
<ol>
<li>
<p>They follow the port-miniport model (corresponds to the Advanced Linux Sound Architecture - ALSA)</p>
</li>
<li>
<p>Allow the audio stack to render and capture audio from several audio devices, including: integrated speakers and microphones, headsets/headphones, USB devices, Bluetooth devices, HDMI, etc</p>
</li>
</ol></li>
<li>
<p>H/W</p>
<ol>
<li>
<p>Audio codec</p>
</li>
<li>
<p>DSP (optionally)</p>
</li>
<li>
<p>Integrated speakers, microphone, etc</p>
</li>
<li>
<p>External devices: USB audio devices, Bluetooth audio devices, HDMI audio, etc</p>
</li>
<li>
<p>Signal processing can also be implemented in the H/W (e.g. the codec or the DSP), instead of or in addition to the APOs</p>
</li>
</ol></li>
</ol>
<p><span style="font-family: Calibri; font-size: small;">The following diagram shows a graphical view of all the above items:</span></p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>
<p><span style="font-family: Calibri;"><span style="font-size: small;">&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/0815.audio_stack.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/0815.audio_5F00_stack.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/72/41/0815.audio_stack.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-72-41/0815.audio_5F00_stack.png" alt="" border="0" /></a></span></span></p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>
<p><span style="font-family: Calibri; font-size: small;">In the following blog posts I will dive deeper into each of the audio components that were described above.</span></p>
<p><span style="font-family: Calibri; font-size: small;">Finally, I would like to thank Frank Yerrace and Kishore Kotteri from the Audio dev team for their contributions to this article.</span></p>]]></content:encoded>
    </item>
    <item>
      <title>I'm back!</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/im-back</link>
      <pubDate>Mon, 28 Oct 2013 21:08:00 GMT</pubDate>
      <dc:creator><![CDATA[Ilias Tsigkogiannis]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/2013/10/28/im-back/</guid>
      <description><![CDATA[Hey everybody! Long time no see :)
After 3 years of absence, I returned to Microsoft! I'm back as a...]]></description>
      <content:encoded><![CDATA[<p>Hey everybody! Long time no see :)</p>
<p>After 3 years of absence, I returned to Microsoft! I'm back as a PM in the Windows team, working on audio.&nbsp;My team owns the whole audio stack, from the high-level audio-related APIs to the audio driver stack. It feels great to be back in such a great company and an amazing team! Anytime that you hear a sound from your Windows device, you're utilizing my team's hard efforts :) My teammate Matthew van Eerde also has <a href="https://blogs.msdn.com/b/matthew_van_eerde/">a blog with great information</a> about Windows audio.</p>
<p>From this point on, I'll be mostly focusing on posts related to Windows audio (even though I'll also try to include posts about driver development). As always, I'm open for questions and feedback! Especially if you have feedback about areas that are broken and need our attention, this is the best time to let us know!</p>
<p>I'm really excited to be back! My goal is to keep up with useful blogs posts, as before.</p>]]></content:encoded>
    </item>
    <item>
      <title>So Long, Farewell, Auf Wiedersehen, Good-bye...</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/so-long-farewell-auf-wiedersehen-good-bye</link>
      <pubDate>Wed, 01 Sep 2010 16:10:19 GMT</pubDate>
      <dc:creator><![CDATA[iliast]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/2010/09/01/so-long-farewell-auf-wiedersehen-good-bye/</guid>
      <description><![CDATA[This is my last post in this blog. After 4 years at Microsoft, it's time for me to move on. This...]]></description>
      <content:encoded><![CDATA[<p>This is my last post in this blog. After 4 years at Microsoft, it's time for me to move on. This fall I'm starting a MBA degree at Northwestern University's Kellogg School of Management (Go Wildcats!). My experiences at Microsoft have been excellent, but at some point all good things need to come to an end. Hopefully, my blog will still be informative for everybody, who wants to find concentrated information about driver development.</p>
<p>So Long, Farewell, Auf Wiedersehen, Good-bye...</p>]]></content:encoded>
    </item>
    <item>
      <title>New Blog: USB Core Team</title>
      <link>https://docs.microsoft.com/archive/blogs/iliast/new-blog-usb-core-team</link>
      <pubDate>Tue, 06 Oct 2009 19:37:00 GMT</pubDate>
      <dc:creator><![CDATA[iliast]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/iliast/2009/10/06/new-blog-usb-core-team/</guid>
      <description><![CDATA[The USB core team has started a new blog: https://blogs.msdn.com/usbcoreblog/. They'll be discussing...]]></description>
      <content:encoded><![CDATA[<P>The USB core team has started a new blog: <A href="https://blogs.msdn.com/usbcoreblog/" mce_href="https://blogs.msdn.com/usbcoreblog/">https://blogs.msdn.com/usbcoreblog/</A>. They'll be discussing about everything that&nbsp;is related to USB.</P>
<P>Welcome to the blogosphere USB Team :)</P>]]></content:encoded>
    </item>
  </channel>
</rss>