> For the complete documentation index, see [llms.txt](https://docs.accurascan.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.accurascan.com/solutions/voice-biometrics/flutter/setup-voice-verification.md).

# Setup Voice Verification

#### Uploading Api details to matches enrolled user's audio files with target user's audio file

```
try {
      final directory = await getApplicationDocumentsDirectory();
      var uri = Uri.parse("Your API");
      var request = http.MultipartRequest("POST", uri);

      // Input Source One .wav formate
      var sourceOnePath = '${directory.path}/${widget.username}_0.wav';
      var sourceOneFile = File(sourceOnePath);
      if (!await sourceOneFile.exists()) {
        throw Exception('Source one recording not found');
      }
      // var sourceOneWav = await _convertToWav(sourceOnePath, 0);
      request.files.add(await http.MultipartFile.fromPath(
        'sourceone',
        sourceOneFile.path,
        contentType: MediaType("audio", "wav"),
        filename: 'sourceone.wav',
      ));

      // Input Source Two .wav formate
      var sourceTwoPath = '${directory.path}/${widget.username}_1.wav';
      var sourceTwoFile = File(sourceTwoPath);
      if (!await sourceTwoFile.exists()) {
        throw Exception('Source two recording not found');
      }
      // var sourceTwoWav = await _convertToWav(sourceTwoPath, 1);
      request.files.add(await http.MultipartFile.fromPath(
        'sourcetwo',
        sourceTwoFile.path,
        contentType: MediaType("audio", "wav"),
        filename: 'sourcetwo.wav',
      ));

      // Input Source Three .wav formate
      var sourceThreePath = '${directory.path}/${widget.username}_2.wav';
      var sourceThreeFile = File(sourceThreePath);
      if (!await sourceThreeFile.exists()) {
        throw Exception('Source three recording not found');
      }
      // var sourceThreeWav = await _convertToWav(sourceThreePath, 2);
      request.files.add(await http.MultipartFile.fromPath(
        'sourcethree',
        sourceThreeFile.path,
        contentType: MediaType("audio", "wav"),
        filename: 'sourcethree.wav',
      ));

      // Input Source Four .wav formate
      File verifyFile;
      if (audioFiles.isNotEmpty) {
        verifyFile = audioFiles[0];
      } else {
        final verifyPath = '${directory.path}/${widget.username}_3.wav';
        verifyFile = File(verifyPath);
        if (!await verifyFile.exists()) {
          throw Exception('Verification recording not found');
        }
      }
      // var verifyWav = await _convertToWav(verifyFile.path, 3);
      request.files.add(await http.MultipartFile.fromPath(
        'target',
        verifyFile.path,
        contentType: MediaType("audio", "wav"),
        filename: 'target.wav',
      ));

      // Send request
      var response = await request.send();
      if (response.statusCode == 200) {
        var responseBody = await response.stream.bytesToString();
        final Map<String, dynamic> parsedResponse = jsonDecode(responseBody);
        final String score = parsedResponse['score'];
        print('Matching Score: $score');
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(content: Text('Matching Score: $score')),
        );
      } else {
        throw Exception('Upload failed with status ${response.statusCode}');
      }
    } catch (e) {
      ScaffoldMessenger.of(context).showSnackBar(
        SnackBar(content: Text('Error during upload: $e')),
      );
    }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.accurascan.com/solutions/voice-biometrics/flutter/setup-voice-verification.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
