Skip to content

Commit

Permalink
doc: fix readme numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
satra committed Mar 28, 2024
1 parent b26de3e commit 2f39b4e
Showing 1 changed file with 46 additions and 47 deletions.
93 changes: 46 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

A simple Python package to prepare acoustic data for the Bridge2AI voice project.

**Caution:** this package is still under development and may change rapidly over the next few weeks.
**Caution:** this package is under activedevelopment and interfaces may change rapidly over the next few weeks.

## Installation
Requires a Python >= 3.10 environment
Requires a Python >= 3.10, <3.12 environment

```
pip install b2aiprep
Expand All @@ -20,69 +20,68 @@ b2aiprep-cli --help

1. Convert an audio file to features:

The simplest form takes an audio file, a subject id, and a task name.
The simplest form takes an audio file, a subject id, and a task name.

```bash
b2aiprep-cli convert test_audio.wav s1 mpt
```
```bash
b2aiprep-cli convert test_audio.wav s1 mpt
```

It will save a pytorch `.pt` file with a dictionary of features. This can be
loaded by `torch.load()`. The file is named following a simple convention:
`sub-<subject_id>_task-<task_name>_md5-<checksum>_features.pt`
It will save a pytorch `.pt` file with a dictionary of features. This can be
loaded by `torch.load()`. The file is named following a simple convention:
`sub-<subject_id>_task-<task_name>_md5-<checksum>_features.pt`
1. Batch process audio files
2. Batch process audio files
This requires a CSV file, where each line is of the form:
path/to/audio.wav
This requires a CSV file, where each line is of the form:
path/to/audio.wav
This also supports a CSV file where each line is of the form:
path/to/audio.wav,subject_id,task_name
This also supports a CSV file where each line is of the form:
path/to/audio.wav,subject_id,task_name
To generate this csv file from the Production directory pulled from wasabi, use command 3.
To generate this csv file from the Production directory pulled from wasabi, use command 3.
```bash
b2aiprep-cli batchconvert filelist.csv --plugin cf n_procs=2 --outdir out --save_figures
```
```bash
b2aiprep-cli batchconvert filelist.csv --plugin cf n_procs=2 --outdir out --save_figures
```

The above command uses pydra under the hood to parallel process the audio files.
All outputs are currently stored in a single directory specified by the `--outdir`
flag.
The above command uses pydra under the hood to parallel process the audio files.
All outputs are currently stored in a single directory specified by the `--outdir`
flag.

1. Generate csv file to feed to batchconvert
3. Generate csv file to feed to batchconvert

```bash
b2aiprep-cli createbatchcsv input_dir outfile
```
```bash
b2aiprep-cli createbatchcsv input_dir outfile
```

The input directory should point to the location of the Production directory pulled from Wasabi e.g. `/Users/b2ai/production`. Don't uninclude a / at the end of your path e.g. `/Users/b2ai/production/` will throw an
error. This will be fixed later.
The input directory should point to the location of the Production directory pulled from Wasabi e.g. `/Users/b2ai/production`. Don't uninclude a / at the end of your path e.g. `/Users/b2ai/production/` will throw an
error. This will be fixed later.
This directory is expected to have subfolders for each institution, (e.g. `production/MIT`),
and each subdirectory is expected to have all the .wav files from each institution
This directory is expected to have subfolders for each institution, (e.g. `production/MIT`),
and each subdirectory is expected to have all the .wav files from each institution
Outfile is the path to and name of the csv file to be generated, e.g. `audiofiles.csv`
Outfile is the path to and name of the csv file to be generated, e.g. `audiofiles.csv`
1. Verify if two audio files are from the same speaker
4. Verify if two audio files are from the same speaker
```bash
b2aiprep-cli test_audio1.wav test_audio2.wav --model 'speechbrain/spkrec-ecapa-voxceleb'
```

This will use the speechbrain speaker recognition model to verify that the two
audio files are from the same speaker.
```bash
b2aiprep-cli test_audio1.wav test_audio2.wav --model 'speechbrain/spkrec-ecapa-voxceleb'
```
There is a notebook in the docs directory that can be used to interact with the library
programmatically.
This will use the speechbrain speaker recognition model to verify that the two
audio files are from the same speaker.
There is a notebook in the docs directory that can be used to interact with the library
programmatically.
1. Convert the speaker in the source audio file (1st argument) into the speaker of the target audio file (2nd argument) and save the result in the output file (3rd argument)
5. Convert the speaker in the source audio file (1st argument) into the speaker of the target audio file (2nd argument) and save the result in the output file (3rd argument)
```bash
b2aiprep-cli convert-voice data/vc_source.wav data/vc_target.wav data/vc_output.wav
```
```bash
b2aiprep-cli convert-voice data/vc_source.wav data/vc_target.wav data/vc_output.wav
```
1. Transcribe the audio
6. Transcribe the audio
```bash
b2aiprep-cli transcribe data/vc_source.wav
```
```bash
b2aiprep-cli transcribe data/vc_source.wav
```

0 comments on commit 2f39b4e

Please sign in to comment.