8 |
9 |
10 | One Microsoft Way
11 | Redmond, WA 98052-6399
12 | P:
13 | 425.555.0100
14 |
15 |
16 |
17 | Support:Support@example.com
18 | Marketing:Marketing@example.com
19 |
20 |
--------------------------------------------------------------------------------
/SignalRChat/wwwroot/lib/jquery-validation-unobtrusive/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation-unobtrusive",
3 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
4 | "version": "3.2.9",
5 | "_release": "3.2.9",
6 | "_resolution": {
7 | "type": "version",
8 | "tag": "v3.2.9",
9 | "commit": "a91f5401898e125f10771c5f5f0909d8c4c82396"
10 | },
11 | "_source": "https://github.com/aspnet/jquery-validation-unobtrusive.git",
12 | "_target": "^3.2.9",
13 | "_originalSource": "jquery-validation-unobtrusive",
14 | "_direct": true
15 | }
--------------------------------------------------------------------------------
/AndroidClient/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/SignalRChat/Stream/SpeechAPIConnection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.CognitiveServices.Speech;
6 | using Microsoft.CognitiveServices.Speech.Audio;
7 | using Microsoft.Extensions.Configuration;
8 |
9 | namespace SignalRChat.Stream
10 | {
11 | public class SpeechAPIConnection
12 | {
13 | public string SessionId { get; set; }
14 | public VoiceAudioStream AudioStream { get; set; }
15 | public SpeechRecognizer Recognizer { get; set; }
16 | public string Language { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/SignalRChat/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) .NET Foundation. All rights reserved.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 | these files except in compliance with the License. You may obtain a copy of the
5 | License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software distributed
10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the
12 | specific language governing permissions and limitations under the License.
13 |
--------------------------------------------------------------------------------
/SignalRChat/Hubs/AttendeeInfo.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.SignalR;
2 | using Microsoft.CognitiveServices.Speech;
3 | using Microsoft.CognitiveServices.Speech.Audio;
4 | using Microsoft.Extensions.Configuration;
5 | using Newtonsoft.Json.Linq;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Diagnostics;
9 | using System.Linq;
10 | using System.Threading.Tasks;
11 |
12 | namespace SignalRChat.Hubs
13 | {
14 | public class AttendeeInfo{
15 | public string ID {get;set;}
16 | public string ConnectionID{get;set;}
17 | public string SpeakingLanguage{get;set;}
18 |
19 | public string PreferredLanguage{get;set;}
20 |
21 | }
22 | }
--------------------------------------------------------------------------------
/SignalRChat/wwwroot/lib/jquery/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery",
3 | "main": "dist/jquery.js",
4 | "license": "MIT",
5 | "ignore": [
6 | "package.json"
7 | ],
8 | "keywords": [
9 | "jquery",
10 | "javascript",
11 | "browser",
12 | "library"
13 | ],
14 | "homepage": "https://github.com/jquery/jquery-dist",
15 | "version": "3.3.1",
16 | "_release": "3.3.1",
17 | "_resolution": {
18 | "type": "version",
19 | "tag": "3.3.1",
20 | "commit": "9e8ec3d10fad04748176144f108d7355662ae75e"
21 | },
22 | "_source": "https://github.com/jquery/jquery-dist.git",
23 | "_target": "^3.3.1",
24 | "_originalSource": "jquery",
25 | "_direct": true
26 | }
--------------------------------------------------------------------------------
/AndroidClient/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/SignalRChat/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace SignalRChat
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | CreateWebHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/NetCoreClient/SignalRConsoleClient/SignalRConsoleClient.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp2.1
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Always
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/SignalRChat/Pages/Error.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.Mvc.RazorPages;
8 |
9 | namespace SignalRChat.Pages
10 | {
11 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
12 | public class ErrorModel : PageModel
13 | {
14 | public string RequestId { get; set; }
15 |
16 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
17 |
18 | public void OnGet()
19 | {
20 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/AndroidClient/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.2.1'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | maven { url 'https://csspeechstorage.blob.core.windows.net/maven/' }
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
--------------------------------------------------------------------------------
/SignalRChat/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:31047",
7 | "sslPort": 44354
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "SignalRChat": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | Signalr voice recognition backend
2 | =================================
3 | - Reference
4 | - https://stackoverflow.com/questions/15349987/stream-live-android-audio-to-server
5 | - https://github.com/msimecek/Sample-Continuous-S2T
6 | - https://github.com/msimecek/Sample-Continuous-S2T/tree/master/VideoAudioStreamerAPI
7 |
8 | Overview
9 | ========
10 |
11 | In this sample I created a SignalR backend that receives audio data from and android device. The server streams audio data to Azure Speech API to translate voice to text and send back to Android device.
12 |
13 | To simplify backend design. I have a collection that holds Speech API client for each preferred language instead of each attendees, so that in the future this can be extended to a online conference translation service.
14 |
--------------------------------------------------------------------------------
/AndroidClient/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AndroidClient/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/AndroidClient/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/AndroidClient/app/src/androidTest/java/com/example/michi/videosample/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.michi.videosample;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.michi.videosample", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/SignalRChat/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ErrorModel
3 | @{
4 | ViewData["Title"] = "Error";
5 | }
6 |
7 |
Error.
8 |
An error occurred while processing your request.
9 |
10 | @if (Model.ShowRequestId)
11 | {
12 |
13 | Request ID:@Model.RequestId
14 |
15 | }
16 |
17 |
Development Mode
18 |
19 | Swapping to Development environment will display more detailed information about the error that occurred.
20 |
21 |
22 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
23 |
24 |
--------------------------------------------------------------------------------
/AndroidClient/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/SignalRChat/Properties/PublishProfiles/michi-qnamaker-demo - Web Deploy.pubxml.user:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 | AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA7ZJ1Ld3kYUCV9k6mdy2t8QAAAAACAAAAAAADZgAAwAAAABAAAAB7+Irud2H7r06EvH/0UPAkAAAAAASAAACgAAAAEAAAAFKhE3bOzfjhQXikhnBkylCAAAAArJjrttKtONnDHFwm/kl+JrvPLQ/3k844/s0aLklYnn2zJ1JUNNaPNVbfCBZWdxkmvVz40kfSDF+x3nXMFI7L8oHon3tJTPz1kMOV/S3G5EUp1xvp/tNc5MjSOSULoNYzb5bk4SFe6vF1hP3znvnA95Ojo3jjowAZaqu4BKo5mR4UAAAAqYdLchpEhkXxQqx+Ce7P6D6TvC8=
10 |
11 |
--------------------------------------------------------------------------------
/SignalRChat/Properties/PublishProfiles/michi-signalr-server - Web Deploy.pubxml.user:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 | AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA7ZJ1Ld3kYUCV9k6mdy2t8QAAAAACAAAAAAADZgAAwAAAABAAAABalNPlQmAALZjJwV5+fovwAAAAAASAAACgAAAAEAAAAJeKeD4+mgPuXp3FDapY4EaAAAAAP86WGFajH+wr4sX46ulIV4h5DUd1P1cMShJX+2hsNJxZQHpN05o137BWvxmmxH5XTO2iE4YUSuOlGgfbceSqMfSN79nqvINVSzWh/2JSW9wenxTRMnUBwVyxfqT3TN3+hBRhShJJIe9SPYTCkiBXBmXOncdGhEWf2C6dHjvE5m4UAAAAraKp8QqmslONP56WxSGxEB3vlx0=
10 |
11 |
--------------------------------------------------------------------------------
/SignalRChat/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
2 | for details on configuring this project to bundle and minify static web assets. */
3 | body {
4 | padding-top: 50px;
5 | padding-bottom: 20px;
6 | }
7 |
8 | /* Wrapping element */
9 | /* Set some basic padding to keep content from hitting the edges */
10 | .body-content {
11 | padding-left: 15px;
12 | padding-right: 15px;
13 | }
14 |
15 | /* Carousel */
16 | .carousel-caption p {
17 | font-size: 20px;
18 | line-height: 1.4;
19 | }
20 |
21 | /* Make .svg files in the carousel display properly in older browsers */
22 | .carousel-inner .item img[src$=".svg"] {
23 | width: 100%;
24 | }
25 |
26 | /* QR code generator */
27 | #qrCode {
28 | margin: 15px;
29 | }
30 |
31 | /* Hide/rearrange for smaller screens */
32 | @media screen and (max-width: 767px) {
33 | /* Hide captions */
34 | .carousel-caption {
35 | display: none;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/NetCoreClient/SignalRConsoleClient/ConsoleOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using CommandLine.Text;
5 | using CommandLine;
6 | namespace SignalRConsoleClient
7 | {
8 | public class ConsoleOptions
9 | {
10 | [Option(
11 | longName: "url",
12 | HelpText = "SignalR Server URL",
13 | Required = false,
14 | Default = "http://localhost:31047/voice"
15 | )]
16 | public string URL { get; set; }
17 |
18 | [Option(
19 | shortName:'u',
20 | longName:"user",
21 | HelpText ="Unique User Name",
22 | Required = false,
23 | Default = "michael"
24 | )]
25 | public string UserName { get; set; }
26 |
27 | [Option(
28 | shortName: 'l',
29 | longName: "lang",
30 | HelpText = "Preferred Language",
31 | Required = false,
32 | Default = "en-us"
33 | )]
34 | public string Language { get; set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/SignalRChat/wwwroot/lib/jquery-validation/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation",
3 | "homepage": "https://jqueryvalidation.org/",
4 | "repository": {
5 | "type": "git",
6 | "url": "git://github.com/jquery-validation/jquery-validation.git"
7 | },
8 | "authors": [
9 | "Jörn Zaefferer "
10 | ],
11 | "description": "Form validation made easy",
12 | "main": "dist/jquery.validate.js",
13 | "keywords": [
14 | "forms",
15 | "validation",
16 | "validate"
17 | ],
18 | "license": "MIT",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "demo",
25 | "lib"
26 | ],
27 | "dependencies": {
28 | "jquery": ">= 1.7.2"
29 | },
30 | "version": "1.17.0",
31 | "_release": "1.17.0",
32 | "_resolution": {
33 | "type": "version",
34 | "tag": "1.17.0",
35 | "commit": "fc9b12d3bfaa2d0c04605855b896edb2934c0772"
36 | },
37 | "_source": "https://github.com/jzaefferer/jquery-validation.git",
38 | "_target": "^1.17.0",
39 | "_originalSource": "jquery-validation",
40 | "_direct": true
41 | }
--------------------------------------------------------------------------------
/SignalRChat/wwwroot/lib/bootstrap/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap",
3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
4 | "keywords": [
5 | "css",
6 | "js",
7 | "less",
8 | "mobile-first",
9 | "responsive",
10 | "front-end",
11 | "framework",
12 | "web"
13 | ],
14 | "homepage": "http://getbootstrap.com",
15 | "license": "MIT",
16 | "moduleType": "globals",
17 | "main": [
18 | "less/bootstrap.less",
19 | "dist/js/bootstrap.js"
20 | ],
21 | "ignore": [
22 | "/.*",
23 | "_config.yml",
24 | "CNAME",
25 | "composer.json",
26 | "CONTRIBUTING.md",
27 | "docs",
28 | "js/tests",
29 | "test-infra"
30 | ],
31 | "dependencies": {
32 | "jquery": "1.9.1 - 3"
33 | },
34 | "version": "3.3.7",
35 | "_release": "3.3.7",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.3.7",
39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
40 | },
41 | "_source": "https://github.com/twbs/bootstrap.git",
42 | "_target": "v3.3.7",
43 | "_originalSource": "bootstrap",
44 | "_direct": true
45 | }
--------------------------------------------------------------------------------
/SignalRChat/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Twitter, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/SignalRChat/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/SignalRChat/Pages/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/AndroidClient/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.example.michi.videosample"
7 | minSdkVersion 23
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | compileOptions {
20 | sourceCompatibility JavaVersion.VERSION_1_8
21 | targetCompatibility JavaVersion.VERSION_1_8
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(include: ['*.jar'], dir: 'libs')
27 | implementation 'com.android.support:appcompat-v7:28.0.0'
28 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
29 | implementation 'com.android.support:design:28.0.0'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
32 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
33 | implementation 'com.microsoft.cognitiveservices.speech:client-sdk:1.2.0'
34 | implementation 'com.microsoft.signalr:signalr:1.0.0'
35 | }
36 |
--------------------------------------------------------------------------------
/SignalRChat/Stream/EchoStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Threading;
5 | using System.Collections.Concurrent;
6 |
7 | namespace SignalRChat.Stream
8 | {
9 | // solution from here: https://stackoverflow.com/a/19137392
10 | public class EchoStream : MemoryStream
11 | {
12 | private readonly ManualResetEvent _DataReady = new ManualResetEvent(false);
13 | private readonly ConcurrentQueue _Buffers = new ConcurrentQueue();
14 |
15 | public bool DataAvailable { get { return !_Buffers.IsEmpty; } }
16 |
17 | public override void Write(byte[] buffer, int offset, int count)
18 | {
19 | _Buffers.Enqueue(buffer.Take(count).ToArray());
20 | _DataReady.Set();
21 | }
22 |
23 | public override int Read(byte[] buffer, int offset, int count)
24 | {
25 | //Debug.WriteLine("Data available: " + DataAvailable);
26 |
27 | _DataReady.WaitOne();
28 |
29 | byte[] lBuffer;
30 |
31 | if (!_Buffers.TryDequeue(out lBuffer))
32 | {
33 | _DataReady.Reset();
34 | return -1;
35 | }
36 |
37 | if (!DataAvailable)
38 | _DataReady.Reset();
39 |
40 | Array.Copy(lBuffer, buffer, lBuffer.Length);
41 | return lBuffer.Length;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/SignalRChat/Stream/AudioStream.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.CognitiveServices.Speech.Audio;
2 | using System;
3 | using System.Collections.Concurrent;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Threading;
7 |
8 | namespace SignalRChat.Stream
9 | {
10 | public class VoiceAudioStream : PullAudioInputStreamCallback
11 | {
12 | private readonly EchoStream _dataStream = new EchoStream();
13 | private ManualResetEvent _waitForEmptyDataStream = null;
14 |
15 | public override int Read(byte[] dataBuffer, uint size)
16 | {
17 | if (_waitForEmptyDataStream != null && !_dataStream.DataAvailable)
18 | {
19 | _waitForEmptyDataStream.Set();
20 | return 0;
21 | }
22 |
23 | return _dataStream.Read(dataBuffer, 0, dataBuffer.Length);
24 | }
25 |
26 | public void Write(byte[] buffer, int offset, int count)
27 | {
28 | _dataStream.Write(buffer, offset, count);
29 | }
30 |
31 | public override void Close()
32 | {
33 | if (_dataStream.DataAvailable)
34 | {
35 | _waitForEmptyDataStream = new ManualResetEvent(false);
36 | _waitForEmptyDataStream.WaitOne();
37 | }
38 |
39 | _waitForEmptyDataStream.Close();
40 | _dataStream.Dispose();
41 | base.Close();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/AndroidClient/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
33 |
--------------------------------------------------------------------------------
/SignalRChat/SignalRChat.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 | b663f109-4cec-4eb1-a707-0b191626fafa
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Always
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Always
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/SignalRChat/Helpers/DictionaryExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using SignalRChat.Hubs;
6 | using System.Collections.Generic;
7 | using SignalRChat.Stream;
8 |
9 | namespace SignalRChat.Helpers
10 | {
11 | public static class DictionaryExtension
12 | {
13 | public static SpeechAPIConnection GetAPIConnection(this Dictionary conns, string sessionId)
14 | {
15 | var items = from item in conns.Values
16 | where item.SessionId.Equals(sessionId, StringComparison.OrdinalIgnoreCase)
17 | select item;
18 | return items.Count() == 1 ? items.SingleOrDefault() : null;
19 | }
20 | public static AttendeeInfo[] GetAttendeesByLanguage(this Dictionary items,string language)
21 | {
22 | var attendees = from item in items.Values
23 | where item.PreferredLanguage.CompareTo(language) == 0
24 | select item;
25 | return attendees.Count() > 0 ? attendees.ToArray() : null;
26 | }
27 | public static AttendeeInfo GetAttendeeByConnectionID(this Dictionary items,string connectionId)
28 | {
29 | var attendees = from item in items.Values
30 | where item.ConnectionID.Equals(connectionId, StringComparison.OrdinalIgnoreCase)
31 | select item;
32 | return attendees.SingleOrDefault();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/VoiceDemo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28010.2036
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignalRChat", "SignalRChat\SignalRChat.csproj", "{F691CC53-5D19-41C6-84FF-D305D34207BC}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignalRConsoleClient", "NetCoreClient\SignalRConsoleClient\SignalRConsoleClient.csproj", "{7541F41E-BDFB-4C8B-B9ED-07441841332A}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {F691CC53-5D19-41C6-84FF-D305D34207BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {F691CC53-5D19-41C6-84FF-D305D34207BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {F691CC53-5D19-41C6-84FF-D305D34207BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {F691CC53-5D19-41C6-84FF-D305D34207BC}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {7541F41E-BDFB-4C8B-B9ED-07441841332A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {7541F41E-BDFB-4C8B-B9ED-07441841332A}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {7541F41E-BDFB-4C8B-B9ED-07441841332A}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {7541F41E-BDFB-4C8B-B9ED-07441841332A}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {895C04B2-5290-45A6-ADDA-6C205184FDB0}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/SignalRChat/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright JS Foundation and other contributors, https://js.foundation/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/SignalRChat/Properties/PublishProfiles/michi-qnamaker-demo - Web Deploy.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | MSDeploy
9 | /subscriptions/e35c484f-2d35-479f-8adb-9fe20c79394e/resourceGroups/michi-Cognitive-RG/providers/Microsoft.Web/sites/michi-qnamaker-demo
10 | michi-Cognitive-RG
11 | AzureWebSite
12 | Release
13 | Any CPU
14 | http://michi-qnamaker-demo.azurewebsites.net
15 | True
16 | False
17 | f691cc53-5d19-41c6-84ff-d305d34207bc
18 | michi-qnamaker-demo.scm.azurewebsites.net:443
19 | michi-qnamaker-demo
20 |
21 | True
22 | WMSVC
23 | True
24 | $michi-qnamaker-demo
25 | <_SavePWD>True
26 | <_DestinationType>AzureWebSite
27 | False
28 |
29 |
--------------------------------------------------------------------------------
/SignalRChat/Properties/PublishProfiles/michi-signalr-server - Web Deploy.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | MSDeploy
9 | /subscriptions/e35c484f-2d35-479f-8adb-9fe20c79394e/resourceGroups/appsvc_rg_windows_centralus/providers/Microsoft.Web/sites/michi-signalr-server
10 | appsvc_rg_windows_centralus
11 | AzureWebSite
12 | Release
13 | Any CPU
14 | http://michi-signalr-server.azurewebsites.net
15 | True
16 | False
17 | f691cc53-5d19-41c6-84ff-d305d34207bc
18 | michi-signalr-server.scm.azurewebsites.net:443
19 | michi-signalr-server
20 |
21 | True
22 | WMSVC
23 | True
24 | $michi-signalr-server
25 | <_SavePWD>True
26 | <_DestinationType>AzureWebSite
27 | False
28 |
29 |
--------------------------------------------------------------------------------
/AndroidClient/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |