Difference between revisions of "Multi align examples"
m |
|||
Line 70: | Line 70: | ||
[[File:nws_stereo.2speaker.aligned.png|600px|Aligned audio of 'the north wind and the sun' (two speakers and two channels)]] |
[[File:nws_stereo.2speaker.aligned.png|600px|Aligned audio of 'the north wind and the sun' (two speakers and two channels)]] |
||
+ | |||
+ | == Handling errors == |
||
+ | |||
+ | There are many reasons why alignment of one or more of your textgrids might fail: noisy audio, mistranscription, missing words in the dictionary, unrecognized sequence of phones, etc. When an error occurs the error message returned from <code>pyalign</code> is stored in the 'phone' and 'word' tiers. |
||
+ | |||
+ | As an example, if the rough transcript is poorly synchronized with the audio: |
||
+ | |||
+ | [[File:nws_mono.bad.png|600px|Poorly annotated audio of 'the north wind and the sun']] |
Revision as of 13:06, 30 November 2018
This page illustrates usage of the multi_align
command for forced alignment. For the full set of options execute:
multi_align --help
The examples on this page use audio that contains the utterance 'The north wind and the sun', either as a single channel or a stereo recording in which the first two words are in the first channel and the remaining words are in the second channel.
Default behavior of multi_align
The only required argument of multi_align
is the name of a .wav
file to be aligned. By default the transcript of the audio is expected to be provided by the labels of a textgrid with the same basename as the .wav
file and with the extension .Textgrid
. The screenshot shows audio and associated textgrid.
If the audio in the screenshot is saved as nws_mono.wav
and the textgrid as nws_mono.TextGrid
, then the following command performs alignment:
multi_align nws_mono.wav
The resulting textgrid contains three tiers, named 'phone', 'word', and 'trs'. The first contains the phone alignments, the second contains the word alignments, and the last contains the original transcript labels.
The output filename uses the same name as the inputs, with the extension .multi_align.TextGrid
.
Specifying a non-default input transcript
The input transcript does not have to have the same basename as the .wav
file. Use the --input
parameter to specify the name of the input transcript. The basename of --input
is used to form the output filename:
multi_align --input nws_mono.v2.TextGrid nws_mono.wav # output file is nws_mono.v2.multi_align.TextGrid
Simple alignment of a single utterance
If the audio file contains a single utterance, you might prefer to skip creating a textgrid file and provide the transcript in a simple text file or on the command line. For example, if you have a simple text file named nws_mono.txt
:
The north wind and the sun.
Then you can align by specifying that the --input-type
is a text file:
multi_align --input-type text nws_mono.wav
By default multi_align
looks for a .txt
file that matches the .wav
name when --input text
is used. You can of course override this default with the --input
parameter.
A second way to do simple alignment is to include the transcript on the command line. To do this, specify that the --input-type
is raw
. When raw
is used, then the --input
parameter should contain the transcript rather than a filename:
multi_align --input-type raw --input 'The north wind and the sun' nws_mono.wav
Aligning multiple speakers
If your transcript contains utterances from multiple speakers, use a separate textgrid tier for each speaker, as in the screenshot:
The tiers are named 'spkr1' and 'spkr2'. If this textgrid is named nws_mono.TextGrid
, then we align with:
multi_align nws_mono.wav
multi_align
aligns each tier separately, and the output contains two sets of 'phone', 'word', and 'trs' tiers, each set prefixed with the original tier name and an underscore, e.g. 'spkr1_phone' (notice that Praat interprets '_p' as a subscript character).
Aligning multiple speakers in multiple channels
If you are fortunate your recording was made with a dedicated microphone focused on each speaker. For example, you might have two speakers in a stereo recording in which one speaker appears in the left channel and one in the right. The screenshot shows such a recording with each speaker annotated on a separate tier.
Use the --tiers
option to provide a comma-separated (no spaces!) list of tier names to align. For this example, also suffix each tier name with :N
, where N
is the number of the audio channel to align (numbering starts with '1'):
multi_align --tiers spk1:1,spk2:2 nws_stereo.wav # input transcript in nws_stereo.TextGrid
The output file nws_stereo.multi_align.TextGrid
contains the result:
Handling errors
There are many reasons why alignment of one or more of your textgrids might fail: noisy audio, mistranscription, missing words in the dictionary, unrecognized sequence of phones, etc. When an error occurs the error message returned from pyalign
is stored in the 'phone' and 'word' tiers.
As an example, if the rough transcript is poorly synchronized with the audio: