Add Universal Windows Platform example using Audio Graph API
|
@ -0,0 +1,330 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
**/Properties/launchSettings.json
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29519.87
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepSpeechUWP", "DeepSpeechUWP\DeepSpeechUWP.csproj", "{49AAC24D-6A76-4910-913A-94D2D67B6226}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|ARM = Release|ARM
|
||||
Release|ARM64 = Release|ARM64
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|x64.Build.0 = Debug|x64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|x86.Build.0 = Debug|x86
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|ARM.Build.0 = Release|ARM
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|x64.ActiveCfg = Release|x64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|x64.Build.0 = Release|x64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|x64.Deploy.0 = Release|x64
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|x86.ActiveCfg = Release|x86
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|x86.Build.0 = Release|x86
|
||||
{49AAC24D-6A76-4910-913A-94D2D67B6226}.Release|x86.Deploy.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D6764C5D-937A-4FF8-AE1F-29EC004C905C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1 @@
|
|||
models/*
|
|
@ -0,0 +1,7 @@
|
|||
<Application
|
||||
x:Class="DeepSpeechUWP.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:DeepSpeechUWP">
|
||||
|
||||
</Application>
|
|
@ -0,0 +1,103 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace DeepSpeechUWP
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
sealed partial class App : Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Suspending += OnSuspending;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the application is launched normally by the end user. Other entry points
|
||||
/// will be used such as when the application is launched to open a specific file.
|
||||
/// </summary>
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||
{
|
||||
Frame rootFrame = Window.Current.Content as Frame;
|
||||
|
||||
// Do not repeat app initialization when the Window already has content,
|
||||
// just ensure that the window is active
|
||||
if (rootFrame == null)
|
||||
{
|
||||
// Create a Frame to act as the navigation context and navigate to the first page
|
||||
rootFrame = new Frame();
|
||||
|
||||
rootFrame.NavigationFailed += OnNavigationFailed;
|
||||
|
||||
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
|
||||
{
|
||||
//TODO: Load state from previously suspended application
|
||||
}
|
||||
|
||||
// Place the frame in the current Window
|
||||
Window.Current.Content = rootFrame;
|
||||
}
|
||||
|
||||
if (e.PrelaunchActivated == false)
|
||||
{
|
||||
if (rootFrame.Content == null)
|
||||
{
|
||||
// When the navigation stack isn't restored navigate to the first page,
|
||||
// configuring the new page by passing required information as a navigation
|
||||
// parameter
|
||||
rootFrame.Navigate(typeof(MainPage), e.Arguments);
|
||||
}
|
||||
ApplicationView.PreferredLaunchViewSize = new Size(760, 640);
|
||||
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
|
||||
// Ensure the current window is active
|
||||
Window.Current.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when Navigation to a certain page fails
|
||||
/// </summary>
|
||||
/// <param name="sender">The Frame which failed navigation</param>
|
||||
/// <param name="e">Details about the navigation failure</param>
|
||||
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when application execution is being suspended. Application state is saved
|
||||
/// without knowing whether the application will be terminated or resumed with the contents
|
||||
/// of memory still intact.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the suspend request.</param>
|
||||
/// <param name="e">Details about the suspend request.</param>
|
||||
private void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
{
|
||||
var deferral = e.SuspendingOperation.GetDeferral();
|
||||
//TODO: Save application state and stop any background activity
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
}
|
После Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 7.5 KiB |
После Ширина: | Высота: | Размер: 2.9 KiB |
После Ширина: | Высота: | Размер: 1.6 KiB |
Двоичные данные
uwp/DeepSpeechUWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 1.2 KiB |
После Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 3.1 KiB |
|
@ -0,0 +1,190 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{49AAC24D-6A76-4910-913A-94D2D67B6226}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DeepSpeechUWP</RootNamespace>
|
||||
<AssemblyName>DeepSpeechUWP</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
|
||||
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
|
||||
<OutputPath>bin\ARM64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
<Content Include="Assets\LockScreenLogo.scale-200.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-200.png" />
|
||||
<Content Include="Assets\Square150x150Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Content Include="Assets\StoreLogo.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DeepSpeech">
|
||||
<Version>0.7.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||
<Version>6.2.9</Version>
|
||||
</PackageReference>
|
||||
<Reference Include="DeepSpeechClient, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
||||
<HintPath>..\packages\DeepSpeech.0.7.0\lib\net46\DeepSpeechClient.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="models\deepspeech-0.7.0-models.pbmm">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="models\deepspeech-0.7.0-models.scorer">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,51 @@
|
|||
<Page
|
||||
x:Class="DeepSpeechUWP.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:DeepSpeechUWP"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid Margin="50">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0">
|
||||
<TextBlock FontSize="30" FontWeight="Bold">DeepSpeech UWP Demo</TextBlock>
|
||||
<TextBlock FontSize="20" Margin="0 4 0 40">powered by Audio Graph API</TextBlock>
|
||||
<TextBlock Margin="0 0 0 10">Select an audio for transcription:</TextBlock>
|
||||
<Grid ColumnSpacing="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="100" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" HorizontalAlignment="Stretch" x:Name="selectFileButton" Click="selectFileButton_Click">Select File</Button>
|
||||
<TextBlock Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" x:Name="selectedFile">No file selected...</TextBlock>
|
||||
<Button Grid.Column="2" HorizontalAlignment="Stretch" x:Name="playAudioFileButton" Click="playAudioFileButton_Click" IsEnabled="False">Play</Button>
|
||||
<Button Grid.Column="3" HorizontalAlignment="Stretch" x:Name="fileTranscribeButton" Click="fileTranscribeButton_Click" IsEnabled="False">Transcribe</Button>
|
||||
</Grid>
|
||||
<Border Height="1" Margin="0 20" Background="#ddd"/>
|
||||
<TextBlock Margin="0 0 0 10">Select an audio input:</TextBlock>
|
||||
<Grid ColumnSpacing="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="100" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox Grid.Column="0" HorizontalAlignment="Stretch" x:Name="inputDeviceList" SelectionChanged="inputDeviceList_SelectionChanged" />
|
||||
<Button Grid.Column="1" HorizontalAlignment="Stretch" x:Name="recordButton" Click="recordButton_Click">Record</Button>
|
||||
<Button Grid.Column="2" HorizontalAlignment="Stretch" x:Name="stopRecordButton" IsEnabled="False" Click="stopRecordButton_Click">Stop</Button>
|
||||
</Grid>
|
||||
<Border Height="1" Margin="0 20" Background="#ddd"/>
|
||||
<TextBlock Margin="0 0 0 10" FontWeight="Bold">Results</TextBlock>
|
||||
</StackPanel>
|
||||
<TextBox Grid.Row="1" x:Name="result" TextWrapping="Wrap" IsReadOnly="True" />
|
||||
<TextBlock Grid.Row="2" x:Name="error" Margin="0 10 0 0" Foreground="Red" />
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,343 @@
|
|||
using DeepSpeechClient.Interfaces;
|
||||
using DeepSpeechClient.Models;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Enumeration;
|
||||
using Windows.Foundation;
|
||||
using Windows.Media;
|
||||
using Windows.Media.Audio;
|
||||
using Windows.Media.Capture;
|
||||
using Windows.Media.MediaProperties;
|
||||
using Windows.Media.Render;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace DeepSpeechUWP
|
||||
{
|
||||
[ComImport]
|
||||
[Guid("5B0D3235-4DBA-4D44-865E-8F1D0E4FD04D")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
unsafe interface IMemoryBufferByteAccess
|
||||
{
|
||||
void GetBuffer(out byte* buffer, out uint capacity);
|
||||
}
|
||||
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
private bool isFeeding = false;
|
||||
|
||||
private StorageFile audioFile;
|
||||
private DeviceInformation selectedInputDevice;
|
||||
private DeviceInformationCollection inputDevices;
|
||||
private IDeepSpeech client;
|
||||
private DeepSpeechStream stream;
|
||||
private MediaEncodingProfile encoding;
|
||||
private AudioGraph graph;
|
||||
|
||||
private ConcurrentQueue<short[]> bufferQueue = new ConcurrentQueue<short[]>();
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
InitDeepSpeech();
|
||||
ListAudioInputDevices();
|
||||
InitAudioGraph();
|
||||
}
|
||||
|
||||
private async void InitAudioGraph()
|
||||
{
|
||||
try
|
||||
{
|
||||
await CreateAudioGraph();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
error.Text = exception.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitDeepSpeech()
|
||||
{
|
||||
string projectFolder = Directory.GetCurrentDirectory();
|
||||
string modelsFolder = Path.Combine(projectFolder, "models");
|
||||
string acousticModelPath = Path.Combine(modelsFolder, "deepspeech-0.7.0-models.pbmm");
|
||||
string scorerPath = Path.Combine(modelsFolder, "deepspeech-0.7.0-models.scorer");
|
||||
|
||||
client = new DeepSpeechClient.DeepSpeech(acousticModelPath);
|
||||
client.EnableExternalScorer(scorerPath);
|
||||
}
|
||||
|
||||
private async void ListAudioInputDevices()
|
||||
{
|
||||
inputDeviceList.Items.Clear();
|
||||
inputDevices = await DeviceInformation.FindAllAsync(DeviceClass.AudioCapture);
|
||||
|
||||
foreach (var device in inputDevices)
|
||||
{
|
||||
inputDeviceList.Items.Add(device.Name);
|
||||
}
|
||||
|
||||
inputDeviceList.SelectedIndex = 0;
|
||||
selectedInputDevice = inputDevices[0];
|
||||
}
|
||||
|
||||
private async Task ResetAudioGraph()
|
||||
{
|
||||
if (graph != null)
|
||||
{
|
||||
graph.Stop();
|
||||
graph.Dispose();
|
||||
}
|
||||
|
||||
await CreateAudioGraph();
|
||||
}
|
||||
|
||||
private async Task CreateAudioGraph()
|
||||
{
|
||||
encoding = MediaEncodingProfile.CreateWav(AudioEncodingQuality.Low);
|
||||
encoding.Audio = AudioEncodingProperties.CreatePcm(16000, 1, 16);
|
||||
|
||||
AudioGraphSettings settings = new AudioGraphSettings(AudioRenderCategory.Speech);
|
||||
settings.EncodingProperties = encoding.Audio;
|
||||
CreateAudioGraphResult result = await AudioGraph.CreateAsync(settings);
|
||||
|
||||
if (result.Status != AudioGraphCreationStatus.Success)
|
||||
{
|
||||
throw new Exception($"AudioGraph creation failed because {result.Status.ToString()}");
|
||||
}
|
||||
|
||||
graph = result.Graph;
|
||||
|
||||
graph.UnrecoverableErrorOccurred += async (AudioGraph sender, AudioGraphUnrecoverableErrorOccurredEventArgs args) =>
|
||||
{
|
||||
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
|
||||
error.Text = "Audio graph: UnrecoverableErrorOccurred";
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
private async Task<AudioFileInputNode> AttachFileInputNode(StorageFile file, TypedEventHandler<AudioFileInputNode, object> OnFileCompleted)
|
||||
{
|
||||
var fileInputNodeResult = await graph.CreateFileInputNodeAsync(file);
|
||||
if (fileInputNodeResult.Status != AudioFileNodeCreationStatus.Success)
|
||||
{
|
||||
error.Text = String.Format("FileInputNode creation failed because {0}", fileInputNodeResult.Status.ToString());
|
||||
}
|
||||
var fileInputNode = fileInputNodeResult.FileInputNode;
|
||||
fileInputNode.FileCompleted += OnFileCompleted;
|
||||
|
||||
return fileInputNode;
|
||||
}
|
||||
|
||||
private async Task<AudioDeviceOutputNode> AttachDeviceOutputNode(IAudioInputNode inputNode)
|
||||
{
|
||||
var deviceOutputNodeResult = await graph.CreateDeviceOutputNodeAsync();
|
||||
if (deviceOutputNodeResult.Status != AudioDeviceNodeCreationStatus.Success)
|
||||
{
|
||||
error.Text = String.Format("DeviceOutputNode creation failed because {0}", deviceOutputNodeResult.Status.ToString());
|
||||
}
|
||||
var deviceOutputNode = deviceOutputNodeResult.DeviceOutputNode;
|
||||
|
||||
inputNode.AddOutgoingConnection(deviceOutputNode);
|
||||
|
||||
return deviceOutputNode;
|
||||
}
|
||||
|
||||
private short convertFloatToShort(float f)
|
||||
{
|
||||
float k = (float)0.0000305;
|
||||
float y = f - (float)(Math.Floor(f * 128) / (float)128);
|
||||
byte a = (byte)Math.Round(y / k);
|
||||
float x = f - a * k;
|
||||
byte b;
|
||||
|
||||
if (x > 0) b = (byte)(x * 128);
|
||||
else if (x < 0) b = (byte)(256 + x * 128);
|
||||
else b = 0;
|
||||
|
||||
short s = BitConverter.ToInt16(new byte[2] { a, b }, 0);
|
||||
return s;
|
||||
}
|
||||
|
||||
unsafe private void ProcessFrameOutput(AudioFrame frame)
|
||||
{
|
||||
using (AudioBuffer buffer = frame.LockBuffer(AudioBufferAccessMode.Read))
|
||||
using (IMemoryBufferReference reference = buffer.CreateReference())
|
||||
{
|
||||
((IMemoryBufferByteAccess)reference).GetBuffer(out byte* dataInBytes, out uint capacityInBytes);
|
||||
|
||||
if (capacityInBytes > 0)
|
||||
{
|
||||
float* dataInFloats = (float*)dataInBytes;
|
||||
short[] shorts = new short[capacityInBytes / 4];
|
||||
|
||||
for (int i = 0; i < capacityInBytes / 4; i++)
|
||||
{
|
||||
shorts[i] = convertFloatToShort(dataInFloats[i]);
|
||||
}
|
||||
|
||||
bufferQueue.Enqueue(shorts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private AudioFrameOutputNode AttachSpeechRecognitionMode(IAudioInputNode inputNode)
|
||||
{
|
||||
var speechRecognitionNode = graph.CreateFrameOutputNode(encoding.Audio);
|
||||
graph.QuantumStarted += (AudioGraph sender, object args) =>
|
||||
{
|
||||
AudioFrame frame = speechRecognitionNode.GetFrame();
|
||||
ProcessFrameOutput(frame);
|
||||
};
|
||||
|
||||
inputNode.AddOutgoingConnection(speechRecognitionNode);
|
||||
return speechRecognitionNode;
|
||||
}
|
||||
|
||||
private void startSpeechRecognition()
|
||||
{
|
||||
isFeeding = true;
|
||||
stream = client.CreateStream();
|
||||
var feedCount = 0;
|
||||
var decodeRate = 100; // decode every 100 feeds
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
while (isFeeding || !bufferQueue.IsEmpty)
|
||||
if (!bufferQueue.IsEmpty && bufferQueue.TryDequeue(out short[] buffer))
|
||||
{
|
||||
client.FeedAudioContent(stream, buffer, Convert.ToUInt32(buffer.Length));
|
||||
|
||||
if (++feedCount % decodeRate == 0)
|
||||
{
|
||||
var transcription = client.IntermediateDecode(stream);
|
||||
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
result.Text = transcription;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async Task stopSpeechRecognition()
|
||||
{
|
||||
isFeeding = false;
|
||||
while (!bufferQueue.IsEmpty) await Task.Delay(90);
|
||||
var transcription = client.FinishStream(stream);
|
||||
|
||||
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
result.Text = transcription;
|
||||
});
|
||||
}
|
||||
|
||||
private async Task<AudioDeviceInputNode> AttachDeviceInputNode()
|
||||
{
|
||||
var deviceInputNodeResult = await graph.CreateDeviceInputNodeAsync(MediaCategory.Speech, encoding.Audio, selectedInputDevice);
|
||||
|
||||
if (deviceInputNodeResult.Status != AudioDeviceNodeCreationStatus.Success)
|
||||
{
|
||||
error.Text = String.Format("DeviceInputNode creation failed because {0}", deviceInputNodeResult.Status.ToString());
|
||||
}
|
||||
|
||||
var deviceInputNode = deviceInputNodeResult.DeviceInputNode;
|
||||
return deviceInputNode;
|
||||
}
|
||||
|
||||
private async void selectFileButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var picker = new Windows.Storage.Pickers.FileOpenPicker
|
||||
{
|
||||
ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail,
|
||||
SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Downloads
|
||||
};
|
||||
picker.FileTypeFilter.Add(".wav");
|
||||
|
||||
audioFile = await picker.PickSingleFileAsync();
|
||||
selectedFile.Text = audioFile.Path;
|
||||
|
||||
playAudioFileButton.IsEnabled = true;
|
||||
transcribeAudioFileButton.IsEnabled = true;
|
||||
}
|
||||
|
||||
private async void playAudioFileButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await ResetAudioGraph();
|
||||
|
||||
var fileInputNode = await AttachFileInputNode(audioFile, async (AudioFileInputNode senderNode, object args) =>
|
||||
{
|
||||
graph.Stop();
|
||||
senderNode.Reset();
|
||||
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
playAudioFileButton.IsEnabled = true;
|
||||
transcribeAudioFileButton.IsEnabled = true;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
await AttachDeviceOutputNode(fileInputNode);
|
||||
|
||||
graph.Start();
|
||||
playAudioFileButton.IsEnabled = false;
|
||||
transcribeAudioFileButton.IsEnabled = false;
|
||||
}
|
||||
|
||||
private async void transcribeAudioFileButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await ResetAudioGraph();
|
||||
|
||||
var fileInputNode = await AttachFileInputNode(audioFile, async (AudioFileInputNode senderNode, object args) =>
|
||||
{
|
||||
graph.Stop();
|
||||
senderNode.Reset();
|
||||
await stopSpeechRecognition();
|
||||
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
|
||||
{
|
||||
playAudioFileButton.IsEnabled = true;
|
||||
transcribeAudioFileButton.IsEnabled = true;
|
||||
});
|
||||
});
|
||||
|
||||
var speechRecognitionNode = AttachSpeechRecognitionMode(fileInputNode);
|
||||
|
||||
startSpeechRecognition();
|
||||
graph.Start();
|
||||
|
||||
playAudioFileButton.IsEnabled = false;
|
||||
transcribeAudioFileButton.IsEnabled = false;
|
||||
}
|
||||
|
||||
private async void recordButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await ResetAudioGraph();
|
||||
var deviceInputNode = await AttachDeviceInputNode();
|
||||
AttachSpeechRecognitionMode(deviceInputNode);
|
||||
|
||||
stopRecordButton.IsEnabled = true;
|
||||
recordButton.IsEnabled = false;
|
||||
|
||||
startSpeechRecognition();
|
||||
graph.Start();
|
||||
}
|
||||
private async void stopRecordButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
stopRecordButton.IsEnabled = false;
|
||||
recordButton.IsEnabled = true;
|
||||
|
||||
graph.Stop();
|
||||
await stopSpeechRecognition();
|
||||
}
|
||||
|
||||
private void inputDeviceList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
selectedInputDevice = inputDevices[inputDeviceList.SelectedIndex];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity
|
||||
Name="a79d1931-db08-441d-b5ce-1c9cf6b1c8ff"
|
||||
Publisher="CN=erikz"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="a79d1931-db08-441d-b5ce-1c9cf6b1c8ff" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>DeepSpeechUWP</DisplayName>
|
||||
<PublisherDisplayName>erikz</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="DeepSpeechUWP.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="DeepSpeechUWP"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||
Description="DeepSpeechUWP"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
<DeviceCapability Name="microphone"/>
|
||||
</Capabilities>
|
||||
</Package>
|
|
@ -0,0 +1,29 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DeepSpeechUWP")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DeepSpeechUWP")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: ComVisible(false)]
|
|
@ -0,0 +1,31 @@
|
|||
<!--
|
||||
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
|
||||
developers. However, you can modify these parameters to modify the behavior of the .NET Native
|
||||
optimizer.
|
||||
|
||||
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
|
||||
|
||||
To fully enable reflection for App1.MyClass and all of its public/private members
|
||||
<Type Name="App1.MyClass" Dynamic="Required All"/>
|
||||
|
||||
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
|
||||
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
|
||||
|
||||
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
|
||||
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
|
||||
-->
|
||||
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Application>
|
||||
<!--
|
||||
An Assembly element with Name="*Application*" applies to all assemblies in
|
||||
the application package. The asterisks are not wildcards.
|
||||
-->
|
||||
<Assembly Name="*Application*" Dynamic="Required All" />
|
||||
|
||||
|
||||
<!-- Add your application specific runtime directives here. -->
|
||||
|
||||
|
||||
</Application>
|
||||
</Directives>
|