Пример #1
0
    public void OnHoldCompleted(HoldEventData eventData)
    {
        Microphone.End(null);

        this.IsRecording           = false;
        this.InstructionsText.text = "Procesando audio...";

        string FileName = Guid.NewGuid().ToString() + ".wav";

        this.LoadingGameObject.SetActive(true);

        var FilePath = Path.Combine(Application.persistentDataPath, FileName);

        AudioSaver.Save(FilePath, this.OutputAudioSource.clip);
        this.InstructionsText.text = "Record completed - Audio saved";
        try
        {
            var fileContent = File.ReadAllBytes(FilePath);

            this.InstructionsText.text = "Analizando audio. \nPor favor, espere.";

            //Send audio recorded file to the API.
            StartCoroutine(RunSpeakerIdentification(fileContent));
        }
        finally
        {
            File.Delete(FilePath);
        }
    }
Пример #2
0
        private void SaveAs(string fileName)
        {
            AudioSaver saver = new AudioSaver(voiceRecorderState.ActiveFile);

            saver.TrimFromStart = PositionToTimeSpan(LeftPosition);
            saver.TrimFromEnd   = PositionToTimeSpan(TotalWaveFormSamples - RightPosition);

            if (fileName.ToLower().EndsWith(".wav"))
            {
                saver.SaveFileFormat = SaveFileFormat.Wav;
                saver.SaveAudio(fileName);
            }
            else if (fileName.ToLower().EndsWith(".mp3"))
            {
                string lameExePath = LocateLame();
                if (lameExePath != null)
                {
                    saver.SaveFileFormat = SaveFileFormat.Mp3;
                    saver.LameExePath    = lameExePath;
                    saver.SaveAudio(fileName);
                }
            }
            else
            {
                MessageBox.Show("Please select a supported output format");
            }
        }
Пример #3
0
        private void SaveAs(string fileName)
        {
            AudioSaver saver = new AudioSaver(voiceRecorderState.ActiveFile);

            saver.SaveFileFormat   = SaveFileFormat.Wav;
            saver.AutoTuneSettings = this.voiceRecorderState.AutoTuneSettings;

            saver.SaveAudio(fileName);

            this.voiceRecorderState.EffectedFileName = fileName;
            DispatcherHelper.CheckBeginInvokeOnUI(() => NavigateToSaveView());
        }