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:
Zhi 2019-12-06 16:34:34 -05:00 коммит произвёл AshleyF
Родитель ffbcaf840b
Коммит 13a40701d1
5 изменённых файлов: 27 добавлений и 8 удалений

Просмотреть файл

@ -9,8 +9,8 @@ namespace Microsoft.Psi.Samples.LinuxSpeechSample
using Microsoft.Psi.CognitiveServices.Speech; using Microsoft.Psi.CognitiveServices.Speech;
using Microsoft.Psi.Speech; using Microsoft.Psi.Speech;
/// <summary> /// <summary>
/// Speech sample on Linux sample program. /// Speech sample on Linux sample program.
/// </summary> /// </summary>
public static class Program public static class Program
{ {
@ -19,8 +19,8 @@ namespace Microsoft.Psi.Samples.LinuxSpeechSample
private static string azureSubscriptionKey = string.Empty; private static string azureSubscriptionKey = string.Empty;
private static string azureRegion = string.Empty; // the region to which the subscription is associated (e.g. "westus") private static string azureRegion = string.Empty; // the region to which the subscription is associated (e.g. "westus")
/// <summary> /// <summary>
/// Main entry point. /// Main entry point.
/// </summary> /// </summary>
public static void Main() public static void Main()
{ {
@ -74,12 +74,20 @@ namespace Microsoft.Psi.Samples.LinuxSpeechSample
/// </remarks> /// </remarks>
public static void RunAzureSpeech() 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. // Create the pipeline object.
using (Pipeline pipeline = Pipeline.Create()) using (Pipeline pipeline = Pipeline.Create())
{ {
// Create the AudioSource component to capture audio from the default device in 16 kHz 1-channel // 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. // 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 // Perform voice activity detection using the voice activity detector component
var vad = new SimpleVoiceActivityDetector(pipeline); 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 #!/usr/bin/env bash
dotnet build ./PsiRosTurtleSample.csproj dotnet build ./RosTurtleSample.csproj

Просмотреть файл

@ -1,3 +1,10 @@
#!/usr/bin/env bash #!/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

Просмотреть файл

@ -21,4 +21,5 @@
(cd ./Sources/Runtime/Test.Psi/ && . ./build.sh) (cd ./Sources/Runtime/Test.Psi/ && . ./build.sh)
(cd ./Sources/Toolkits/FiniteStateMachine/Microsoft.Psi.FiniteStateMachine/ && . ./build.sh) (cd ./Sources/Toolkits/FiniteStateMachine/Microsoft.Psi.FiniteStateMachine/ && . ./build.sh)
(cd ./Sources/Tools/PsiStoreTool/ && . ./build.sh) (cd ./Sources/Tools/PsiStoreTool/ && . ./build.sh)
(cd ./Samples/PsiRosTurtleSample/ && . ./build.sh) (cd ./Samples/RosTurtleSample/ && . ./build.sh)
(cd ./Samples/LinuxSpeechSample/ && . ./build.sh)