Windows IoT


Microsoft example solution called AudioCreation produces glitching sounds with audio


I am running the Microsoft example solution called AudioCreation. I am very interested in Scenario 3 ( Using A FrameInput Node ) This example generates a sine wave in C# code and puts that sine wave data into AudioFrame objects using an IMemoryBufferReference.
Very cool, but when you listen to it there is a glitch sound in the audio every 4-10 seconds. I put the audio on an Oscilloscope and captured a glitch. It looks like the sine wave just suddenly and completely stops for several cycles and starts up again (See
Picture). I am wondering if this has to do with windows being a non real time operating system. My only guess is that windows stops playing the audio every few seconds to do its own thing. Perhaps this project needs a critical priority thread that will
not get interrupted. But is there any such thing in window IoT ? Note: I get the same glitch sounds if I use my Sabrent USB Sound Card or if I use the Raspberry Pi 2 audio jack so it is not my USB Sound Card.
I am using
OS Version 10.0.10586.0
Raspberry Pi 2
Sabrent USB Audio Device AU-MMSA recommended by Microsoft
Hi Jim,
The sample owner is reviewing it now and I will let you know if I hear anything further. However, they will likely push any resulting updates to the sample directly.
See the solution at
https://social.msdn.microsoft.com/Forums/en-US/c1019bcb-9f1f-47c3-b250-7b47088c1ac0/executing-background-audio-from-a-seperate-background-task?forum=WindowsIoT as well.
Sincerely,
IoTGirl
Hi Jim,
OS Version 10586 was released in November 2015. Would you consider joining
Windows Insiders and testing your code against the latest pre-release bits, 14322?
Sincerely,
IoTGirl
Will Do.
Hi Jim,
Note that we have a known issue with the DragonBoard Audio driver as mentioned here.
https://social.msdn.microsoft.com/Forums/en-US/63c8f470-7f63-4ea3-929f-c11bd61d1929/accelerated-video-on-dragonboard-410c?forum=WindowsIoT.
However, you are using a Raspberry Pi2 so I don't have a known issue around that boardset at this point. You can attempt to debug at the driver level if you build your own image as described here
https://msdn.microsoft.com/en-us/windows/hardware/commercialize/manufacture/iot/index
Sincerely,
IoTGirl
PS: If you do reproduce this issue on the latest build, can you please fill out the following template with as much detail as you can so that we might see your issue here?
ENVIRONMENT:
What Computers, OS and devices are involved with this repro? How are they connected? What company manufactured your hardware?
REPRO STEPS:
What steps would someone else need to follow to see the issue?
RESULTS:
What did you Expect to happen?
What did Actually happen?
NOTES:
Any other details/workarounds potentially related info
ENVIRONMENT:
Raspberry Pi 3 ( I upgraded )
IoT version 14322
REPRO STEPS:
1) Download Windows-universal-samples-master
2) Build and run AudioCreation
3) Click on Scenario 3 using A FrameInput Node
4) Put head phones in audio jack and listen. You can use the Raspberry Pi Audio Jack or Sabrent USB Audio Device AU-MMSA. The glitch is the same.
RESULTS:
Expected) Clean sine wave sound 1kHz.
Actually got) sine wave sound 1kHz, with a glitch every 4-5 seconds
NOTES:
I made my own version of AudioGraph except I managed to get the audio working on a higher priority thread. The glitch sound was still there, but now it occurred less often about every 30-50 seconds. A significant improvement, but it would never work for anything
musical like a music synthesizer. This makes me think even more that AudioGraph gets interrupted by the operating system when using a AudioFrameInputNode and generating AudioFrames in C# code. In a nut shell I changed
await CreateAudioGraph();
to
ThreadPool.RunAsync(CreateAudioGraph, WorkItemPriority.High, WorkItemOptions.None);
Hi Jim,
I have asked the IoT Team to review your reproduction steps and they think this may be due to the lack of loop waveform buffer hardware on both the Pi & DB410c. (DirectX
or DirectSound capable sound cards can do this, but neither RPi2 nor DB410c are those).
So in this case software emulates missing features of hardware and thus is subject to pre-emption interruption (like any user mode process). The person wants to play uninterrupted
note indefinitely long, in reality it plays uninterrupted for some time then scheduler kicks it out, then after a gap allows it to play again. I would say it is expected without DirectSound.
Our supposition is that in a device scenario, it is unlikely that you would need a generated sound to last indefinitely.
I believe this issue only hits, when generating the audio rather than playing back recorded buffers and so should be pretty rare for consumer devices. Even the speech synthesis
APIs generate the audio and send over larger buffers and so can handle small glitches in the app thread. I wouldn’t expect this to hit playback of sound files.
Would you consider attempting to rework your code as suggested to see if it lessens or eliminates the issue?
Modify the app and give as much length of sine wave to play as it has to be (say 10 seconds) and don’t repeat it in a loop – repeating must be done in hardware if they want to re-use same buffer without interruption.
In other words : instead of
FOR(int j=0; j<50; j++)
{
PlayOneBuffer(1 second buffer);
}
do it this way
PlayOneBuffer(50 second buffer);
Sincere thanks,
IoTGirl
Hi IoTGirl and IoT Team
Hi IoTGirl and IoT Team
My goal was to make a music synthesizer. Like a Moog synthesizer, but instead of building it out of analog circuits I was hoping to emulate it digitally with a Raspberry Pi. That would require playing the sounds almost as fast as they are generated in
C# code. A delay of 10 mS would be OK. However it looks like the idea of generating AudioFrame objects and trying to play them continually on a Raspberry Pi will not fly. I am open to any ideas you may have on playing sounds as they are generated in code.
Hi Jim,
When you tried the code change suggested by the team, what was the result? You are telling me about your scenario but that doesn't let me know what you have tried as a result of the previous answer.
Unfortunately, the answer is clear and hardware for Raspberry Pi does not have the support for you to call the Audio system in a loop but you should be able to rework your code to play longer generated snips without interruption as shown above.
(To make an audio synthesizer they may need to modify the sample so it generates the data for the next buffer, while the current buffer is playing.)
Sincerely,
IoTGirl
Hi IoT Girl
I did not try your suggestion because I was not using any kind of loop in the first place. I am running Microsoft Example code: (AudioCreation Scenario3) from Windows-universal-samples-master. It connects a FrameInputNode to a FrameOutputNode. Then It uses
a callback mechanism called FrameInputNode.QuantumStarted to keep the Audio buffer loaded with PCM data. When there is a FrameInputNode.QuantumStarted event, It generates a small amount of signal and puts it into a AudioFrame, and then adds that frame to the
FrameInputNode.
Hi Jim,
The sample owner is reviewing it now and I will let you know if I hear anything further. However, they will likely push any resulting updates to the sample directly.
See the solution at
https://social.msdn.microsoft.com/Forums/en-US/c1019bcb-9f1f-47c3-b250-7b47088c1ac0/executing-background-audio-from-a-seperate-background-task?forum=WindowsIoT as well.
Sincerely,
IoTGirl

Related Links

Language support for TTS on windows IoT
Windows 10 IOT Speech languages
Proper setup to generate IoT Image
Cannot Add New Python Project
Daylight Saving Time Issue
Write and read to text file on usb drive in windows iot
failing at the time of driver deployment
Keyboard filter's ForceOffAccessibility does not prevent High Contrast dialog
How to turn off the HDMI USB powered 7" screen
Changing Page Code for Raspberry Pi 3, Visual Studio
Uwp app deployment Raspberry 3
Unable to Preinstall apps on Windows IoT Pro & Update it via Windows Store
Door Ajar/Raspberry/GPIO/Python/C#
Windows 10 IoT Core Pricing
WiFi support for USB devices with external antenna
WifiDirect API fails to pair with device

Categories

MSDN
Game Development
BizTalk Server
JScript and Scripting
Machine Translation an...
Windows Hardware Devel...
Bing Ads API: Development
Archived Forums SN-SZ
Windows Phone Preview ...
Kinect for Windows SDKs
Forums Issues (not pro...
Visual Studio General ...
Visual Studio Setup an...
Developing Universal W...
Publishing Windows Sto...
Dev Center App
Promote Your App
AdSDK Integration & Ad...
Windows Desktop Search...
Windows Desktop SDK
SharePoint 2013 - Deve...
Pricing & Billing
Azure App Service - We...
Azure Search
Azure Scheduler
Azure Log Integration
Azure Time Series Insi...
Windows Communication ...
Team Foundation Server...
Team Foundation Server...
Architecture General
ADO.NET Managed Providers
ADO.NET DataSet
LINQ to SQL
Microsoft Translator D...
Microsoft Robotics - V...
Microsoft Device Emulator
Visual Studio Smart De...
.NET Framework inside ...
SQL Server Compact
Getting started with S...
SQL Server Express
Microsoft Drivers for ...
SQL Server PowerPivot ...
SQL Server Data Tools
Standard 7: Tools
Standard 7: Servicing ...
SQL Server 2012 Spatia...
Windows Server 2008 Ap...
SDK for Home Server 20...
Windows Live ID: Devel...
Windows Live Writer: D...
MSDN, TechNet and Expr...
Developing for the Mob...
Windows File Sharing P...
Microsoft Unified Comm...
Getting Started with S...
Report a Silverlight Bug
Expression Media
Retired SharePoint Exc...
.NET Remoting and Runt...
Chart Controls for .NE...
Game Technologies: Aud...
Getting Started With V...
Innovate on Office
LightSwitch HTML Clien...
Microsoft ESP Platform...
Moderator Posting Only...
Multimap API Developme...
Microsoft "Data Explor...
Monitor, Alert and Aut...
Network Class Library ...
Office Development wit...
Office Live Small Busi...
Parallel Computing Pla...
Popfly General Discussion
Regular Expressions
NUI API and Programmin...
POS for .NET
Search Server: Known B...
Storage Platform – ATA
SQL Server 2014 Data Q...
Team Foundation Server...
Team Foundation Server...
Visual Basic 2008 (Pre...
Visual Basic Language
Visual Basic Power Packs
Visual C# 2008 (Pre-re...
Visual C++ Express 200...
Visual Studio Code Ana...
Visual Studio Team Sys...
Windows MultiPoint Mou...
Windows MultiPoint Mou...
Working with Data and ...
Building Windows Store...
Building Windows Store...
Tools for Windows Stor...
Expression Blend for W...
XML in Visual Studio 2...
XNA Framework
Ad Revenue, Payout & T...
Kinect for Windows v1 SDK
Azure N-Series Virtual...
Cortana Skills Kit

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile