зеркало из https://github.com/microsoft/psi.git
Better linux build chain (#36)
Fixed the building process of the code base - Check if FFMPEGDir exists and only build it if it does. - Fixed misspelling of one of the packages. - Added LinuxSpeechSample to the build chain. - Added ability to specify the audio device in the LinuxSpeechSample.
This commit is contained in:
Родитель
ffbcaf840b
Коммит
13a40701d1
|
@ -9,8 +9,8 @@ namespace Microsoft.Psi.Samples.LinuxSpeechSample
|
|||
using Microsoft.Psi.CognitiveServices.Speech;
|
||||
using Microsoft.Psi.Speech;
|
||||
|
||||
/// <summary>
|
||||
/// Speech sample on Linux sample program.
|
||||
/// <summary>
|
||||
/// Speech sample on Linux sample program.
|
||||
/// </summary>
|
||||
public static class Program
|
||||
{
|
||||
|
@ -19,8 +19,8 @@ namespace Microsoft.Psi.Samples.LinuxSpeechSample
|
|||
private static string azureSubscriptionKey = string.Empty;
|
||||
private static string azureRegion = string.Empty; // the region to which the subscription is associated (e.g. "westus")
|
||||
|
||||
/// <summary>
|
||||
/// Main entry point.
|
||||
/// <summary>
|
||||
/// Main entry point.
|
||||
/// </summary>
|
||||
public static void Main()
|
||||
{
|
||||
|
@ -74,12 +74,20 @@ namespace Microsoft.Psi.Samples.LinuxSpeechSample
|
|||
/// </remarks>
|
||||
public static void RunAzureSpeech()
|
||||
{
|
||||
// Get the Device Name to record audio from
|
||||
Console.Write("Enter Device Name (default: plughw:0,0)");
|
||||
string deviceName = Console.ReadLine();
|
||||
if (!string.IsNullOrWhiteSpace(deviceName))
|
||||
{
|
||||
deviceName = "plughw:0,0";
|
||||
}
|
||||
|
||||
// Create the pipeline object.
|
||||
using (Pipeline pipeline = Pipeline.Create())
|
||||
{
|
||||
// Create the AudioSource component to capture audio from the default device in 16 kHz 1-channel
|
||||
// PCM format as required by both the voice activity detector and speech recognition components.
|
||||
IProducer<AudioBuffer> audioInput = new AudioCapture(pipeline, new AudioCaptureConfiguration() { DeviceName = "plughw:0,0", Format = WaveFormat.Create16kHz1Channel16BitPcm() });
|
||||
IProducer<AudioBuffer> audioInput = new AudioCapture(pipeline, new AudioCaptureConfiguration() { DeviceName = deviceName, Format = WaveFormat.Create16kHz1Channel16BitPcm() });
|
||||
|
||||
// Perform voice activity detection using the voice activity detector component
|
||||
var vad = new SimpleVoiceActivityDetector(pipeline);
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
dotnet build ./LinuxSpeechSample.csproj
|
|
@ -1,3 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
dotnet build ./PsiRosTurtleSample.csproj
|
||||
dotnet build ./RosTurtleSample.csproj
|
|
@ -1,3 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
make
|
||||
if [[ -z "${FFMPEGDir}" ]]; then
|
||||
echo "FFMPEGDir Environment Variable Not Defined. Skipping Microsoft.Psi.Media.Native.x64"
|
||||
# Future implementation might consider finding the library's path instead of needing to be predefined.
|
||||
# If install using the package manager, the libs are located at /usr/lib/x86_64-linux-gnu/ and headers
|
||||
# are at /usr/include/x86_64-linux-gnu/
|
||||
else
|
||||
make
|
||||
fi
|
3
build.sh
3
build.sh
|
@ -21,4 +21,5 @@
|
|||
(cd ./Sources/Runtime/Test.Psi/ && . ./build.sh)
|
||||
(cd ./Sources/Toolkits/FiniteStateMachine/Microsoft.Psi.FiniteStateMachine/ && . ./build.sh)
|
||||
(cd ./Sources/Tools/PsiStoreTool/ && . ./build.sh)
|
||||
(cd ./Samples/PsiRosTurtleSample/ && . ./build.sh)
|
||||
(cd ./Samples/RosTurtleSample/ && . ./build.sh)
|
||||
(cd ./Samples/LinuxSpeechSample/ && . ./build.sh)
|
||||
|
|
Загрузка…
Ссылка в новой задаче