Skip to content

Instantly share code, notes, and snippets.

dependencies {
classpath group: "org.codehaus.groovy.modules.http-builder", name: "http-builder", version: "0.7"
}
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.ContentType.URLENC
import static groovyx.net.http.Method.POST
@psibre
psibre / forcedAlignmentLogic.gradle
Last active August 7, 2017 21:39
Dockerized Kaldi-based Montreal Forced Alignment logic for MaryTTS voicebuilding
apply plugin: ForcedAlignPlugin
class ForcedAlignPlugin implements Plugin<Project> {
void apply(Project project) {
project.task('prepareForcedAlignment', type: PrepareForcedAlignment) {
dependsOn project.generateAllophones, project.wav
maryXmlDir = project.file(project.generateAllophones.destDir)
wavDir = project.file(project.wav.destDir)
forcedAlignmentDir = project.file("$project.buildDir/forcedAlignment")
}
@psibre
psibre / build.gradle
Created March 29, 2017 10:28
Legacy HSMM voice for MaryTTS
plugins {
id 'java'
}
repositories {
jcenter()
}
dependencies {
compile 'de.dfki.mary:marytts-lang-en:5.2'
@psibre
psibre / build.gradle
Created March 22, 2017 15:17
Convert CSV to YAML with Gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.xlson.groovycsv:groovycsv:1.1'
classpath 'org.yaml:snakeyaml:1.18'
}
}
@psibre
psibre / align.praat
Created March 22, 2017 15:16
align TIMIT prompts and TextGrid with beeps
select all
nocheck Remove
clearinfo
# timit.txt contains all TIMIT prompts (without comments!)
# utterances.TextGrid contains all utterances, speech intervals must not be empty
timit = Read Strings from raw text file... timit.txt
tg = Read from file... utterances.TextGrid
snd = Open long sound file... group1.flac
plus tg
@psibre
psibre / concat.praat
Last active May 12, 2016 13:41
Praat script to concatenate recoverably from list of WAV files
form Concatenate recoverably from list of WAV files
sentence File_list file.lst
sentence Output_file chain.wav
endform
clearinfo
output_file$ = if startsWith(output_file$, "/") or shellDirectory$ == "/" then output_file$ else shellDirectory$ + "/" + output_file$ fi
file_list$ = if startsWith(file_list$, "/") or shellDirectory$ == "/" then file_list$ else shellDirectory$ + "/" + file_list$ fi
@psibre
psibre / pollpraat.md
Last active August 29, 2015 14:10
Poll TextGrid editor in Praat externally

Poll Praat TextGrid Editor

Getting the editor info (visible window, selection start and end, etc.) in a Praat script is easy. But say you want to do this continuously to log the state of your editor window into a text file while you're interacting with it. The problem is that Praat doesn't seem to have a sleep or timeout command to pause execution of the script for a given amount of time, then continue without user interaction.

One hypothetical solution might be a Praat script that runs a system command such as sleep (or timeout on Windows), but the Praat UI blocks while the script is running, which is a dealbreaker.

Another solution is to poll from an external thread such as a shell script that can sleep or timeout natively. This approach requires sending the corresponding commands to a running graphical Praat, which can be done using the sendpraat program.

#! /usr/bin/env perl
$indir = "lab_raw";
opendir INDIR, $indir;
@files = grep (/\.lab$/,readdir INDIR);
closedir INDIR;
foreach $file (@files)
@psibre
psibre / GlobalWavPlayer_snippet.java
Created June 8, 2012 13:23
instantiate and use GWP
GlobWavPlayer gwp = new ie.tcd.globwavplayer.GlobWavPlayer();
try {
gwp.main(new String[] {"/Users/ingmar/"});
} catch (Exception e) {
print("boo");
}