timmahrt / praatIO

A python library for working with praat, textgrids, time aligned audio transcripts, and audio files. It is primarily used for extracting features from and making manipulations on audio files given hierarchical time-aligned transcriptions (utterance > word > syllable > phone, etc).
MIT License
312 stars 33 forks source link

use praat to segment a speech file #5

Closed bhomass closed 4 years ago

bhomass commented 6 years ago

Hi I am very new to Praat overall, not just the python version.

is Praat a good tool to use to segment a .wav file if I know the exact times marks where I want to chop up the file? I like to just use Praat, because afterwards I will be extracting pitch and tempo from the segments.

timmahrt commented 6 years ago

Hello Bruce, If you already know the times that you want to mark, you should write a script that generates the transcription file (.textgrid). Do you have a csv file or rule (eg every 0.5 seconds) of when you want to annotate? It would only take a small script to generate textgrids from it.

For manually annotating an audiofile with visual inspection of a spectrogram and waveform, I don't know of a better tool than praat.

If you're making coarse measurements, (like for film) there might be better tools. Elan is popular for sociolinguistic and discourse-level annotations and for making annotations for speech that includes video recording.

On Wed, Aug 1, 2018, 07:00 Bruce Ho notifications@github.com wrote:

Hi I am very new to Praat overall, not just the python version.

is Praat a good tool to use to segment a .wav file if I know the exact times marks where I want to chop up the file? I like to just use Praat, because afterwards I will be extracting pitch and tempo from the segments.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/timmahrt/praatIO/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/AChv0OJ1OHCBqOLYCEKEPh3dtO8SSbjGks5uMNOMgaJpZM4Vpese .

bhomass commented 6 years ago

Thank you Tim. What if I want the output to be small wav files instead of transcription files? Another word, as the intermedia form, I want sound files for each speaker / utterance, then I will apply additional Praat processing on each segment.

timmahrt commented 6 years ago

Hello Bruce, If you know where you want to extract or segment the audio file, getting the subwav files is easy.

Accuracy could be lower for some measurements however. For example, praat's pitch algorithm uses contextual information in determining the pitch contour. It will take longer to extract pitch for a long wave file but will lead to higher quality results than if you extract individual words and analyze the pitch for them individually.

It all depends on what your data is like and what you want the final output to be.

Tim

On Wed, Aug 1, 2018, 08:26 Bruce Ho notifications@github.com wrote:

Thank you Tim. What if I want the output to be small wav files instead of transcription files? Another word, as the intermedia form, I want sound files for each speaker / utterance, then I will apply additional Praat processing on each segment.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/timmahrt/praatIO/issues/5#issuecomment-409399932, or mute the thread https://github.com/notifications/unsubscribe-auth/AChv0Fj3yDGIafMTKgFR3A0urVfy-gKlks5uMOepgaJpZM4Vpese .

bhomass commented 6 years ago

I am looking at the extract_subwavs.py example. what does "Extracts a separate wav file for each tier in a textgrid" mean? isn't the wav behind each tier always the same? Each tier just highlights different attributes of the same underlying audio stream.

timmahrt commented 6 years ago

I'm away from a computer at the moment but I would imagine I meant "extracts a subwave for each entry in a given tier of a textgrid"

I'll confirm later when I can look at the code.

On Thu, Aug 2, 2018, 07:42 Bruce Ho notifications@github.com wrote:

I am looking at the extract_subwavs.py example. what does "Extracts a separate wav file for each tier in a textgrid" mean? isn't the wav behind each tier always the same? Each tier just highlights different attributes of the same underlying audio stream.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/timmahrt/praatIO/issues/5#issuecomment-409748849, or mute the thread https://github.com/notifications/unsubscribe-auth/AChv0FtchzJG3LA8gseZ2e-8xAWX1tt0ks5uMi7cgaJpZM4Vpese .

bhomass commented 6 years ago

yes, I see this in the script comment: Outputs one subwav for each entry in the tier of a textgrid

bhomass commented 6 years ago

I successfully segmented a long wav file by time mark. Thank you very much!

timmahrt commented 6 years ago

Awesome! Let me know if you need anything else.

Good luck!

On Thu, Aug 2, 2018, 09:34 Bruce Ho notifications@github.com wrote:

I successfully segmented a long wav file by time mark. Thank you very much!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/timmahrt/praatIO/issues/5#issuecomment-409767917, or mute the thread https://github.com/notifications/unsubscribe-auth/AChv0AaVclj56e-WIjpXUBbiK5MOroBtks5uMkkVgaJpZM4Vpese .