public void InitializeRecording(string calibrationFile)
    {
        //Tweak buffer length to something that looks good.
        //Lower buffer lengths requires more temporal buffers so we get smooth lipsync data.
        this.phonemeBuffer   = new PhonemeBuffer(0.1f, 4);
        this.calibrationFile = calibrationFile;
        this.calibrationData = null;

        if (File.Exists(this.calibrationFile))
        {
            JObject calibrationData = JObject.Parse(File.ReadAllText(this.calibrationFile));
            this.maxABSMean  = calibrationData.Value <float>("maxABSMean");
            this.scaleFactor = calibrationData.Value <float>("scaleFactor");
        }

        Bridge_InitRecording();
    }
    public bool ProcessRecording(string filePath)
    {
        //This will invoke finalize handler in the phonemebuffer instance, this will inturn notify animation system.
        PhonemeBuffer.InternalBuffer completeBuffer = this.phonemeBuffer.Finalize();

        //Empty buffer means no sound was recorded, return false.
        if (completeBuffer.NumberOfItems() == 0)
        {
            return(false);
        }

        //Trim audio file data.
        Bridge_TrimRecording(filePath, 0f, completeBuffer.GetBufferLength());

        //Make this buffer eligable for GC.
        this.phonemeBuffer = null;

        return(true);
    }