audioPath method

Future<String?> audioPath()

Implementation

Future<String?> audioPath() async {

  if (!(await File(_pcmPath).exists())) {
    return null;
  }

  if (await File(_wavPath).exists()) {
    return _wavPath;
  }

  // pcm to wav
  await BetterIflytekHelper.pcmToWave(inputFile: _pcmPath, outputFile: _wavPath, numChannels: 1, sampleRate: 16000);

  if (await File(_wavPath).exists()) {
    return _wavPath;
  }

  return null;
}