Skip to content

Pico Compilation

Olivier Michel edited this page Aug 24, 2022 · 11 revisions

This page explains how to recompile Pico TTS on every platforms. Pico TTS is used internally in Webots to perform cross-platform text-to-speech.

Clone the repository:

git clone https://github.com/cyberbotics/picotts

Apply fixes

Add include file

If you get a compilation error because of uintptr_t you may need to add #include <stdint.h> in:

  • picoapi.c
  • picoctrl.c
  • picopr.c
  • picorsrc.c

Fix macOS compilation

On macOS, the EXP function/macro is not working as expected, it should be replaced by the exp function from math.h in picosig.c and picosig2.c:

cd svox/pico/lib
sed -i -- 's/EXP/exp/g' picosig2.c
sed -i -- 's/EXP/exp/g' picosig.c

Compile the library with this Makefile:

CC       = gcc
CFLAGS   = -fPIC # only on Linux
CFLAGS  += -Wno-parentheses-equality
LDFLAGS  = -shared

TARGET  = libpico.so
#TARGET  = libpico.dll
#TARGET  = libpico.dylib
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)

all: $(TARGET)
clean:
	rm -f *.o $(TARGET)

$(TARGET): $(OBJECTS)
	$(CC) $(CFLAGS) -o $(TARGET) $(OBJECTS) $(LDFLAGS)

Add the following files in the archive:

webots/include/libpico/picokfst.h
webots/include/libpico/picodefs.h
webots/include/libpico/picoapi.h
webots/include/libpico/picosig2.h
webots/include/libpico/picosa.h
webots/include/libpico/picoapid.h
webots/include/libpico/picorsrc.h
webots/include/libpico/picoktab.h
webots/include/libpico/picodsp.h
webots/include/libpico/picowa.h
webots/include/libpico/picopr.h
webots/include/libpico/picokpr.h
webots/include/libpico/picospho.h
webots/include/libpico/picoknow.h
webots/include/libpico/picoextapi.h
webots/include/libpico/picoklex.h
webots/include/libpico/picopal.h
webots/include/libpico/picofftsg.h
webots/include/libpico/picobase.h
webots/include/libpico/picodata.h
webots/include/libpico/picoacph.h
webots/include/libpico/picotok.h
webots/include/libpico/picotrns.h
webots/include/libpico/picoctrl.h
webots/include/libpico/picoos.h
webots/include/libpico/picosig.h
webots/include/libpico/picopltf.h
webots/include/libpico/picokdt.h
webots/include/libpico/picocep.h
webots/include/libpico/picokdbg.h
webots/include/libpico/picokpdf.h
webots/include/libpico/picopam.h
webots/include/libpico/picodbg.h

webots/resources/pico/lang/en-US_lh0_sg.bin
webots/resources/pico/lang/en-GB_kh0_sg.bin
webots/resources/pico/lang/it-IT_cm0_sg.bin
webots/resources/pico/lang/de-DE_gl0_sg.bin
webots/resources/pico/lang/es-ES_zl0_sg.bin
webots/resources/pico/lang/fr-FR_nk0_sg.bin
webots/resources/pico/lang/en-GB_ta.bin
webots/resources/pico/lang/de-DE_ta.bin
webots/resources/pico/lang/fr-FR_ta.bin
webots/resources/pico/lang/en-US_ta.bin
webots/resources/pico/lang/es-ES_ta.bin
webots/resources/pico/lang/it-IT_ta.bin
webots/resources/pico/lang/PicoLangFrFrInSystem.mk
webots/resources/pico/lang/PicoLangEnUsInSystem.mk
webots/resources/pico/lang/PicoLangEsEsInSystem.mk
webots/resources/pico/lang/all_pico_languages.mk
webots/resources/pico/lang/PicoLangDeDeInSystem.mk
webots/resources/pico/lang/PicoLangItItInSystem.mk
webots/resources/pico/lang/PicoLangEnGBInSystem.mk
webots/resources/pico/lang/PicoLangDefaultInSystem.mk

webots/lib/libpico.so # libpico.dll / libpico.dylib

macOS: complete the installation by fixing the installation path:

cd ~/webots
install_name_tool -id @rpath/lib/libpico.dylib lib/libpico.dylib
Clone this wiki locally