npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-lectorem

v1.0.2

Published

React library to sync audio and text, highlighting the text as the audio "reads" it

Readme

React Lectorem

lectorem - Latin, Acc. /lehk-TOR-ehm/ (for/to the) reader

This is a React module to synchronize text and speech. A small player allows the user to play the audio and the corresponding text will highlight as it is being read.

This was built to help teaching foreign languages.

Install

npm install --save react-lectorem

or

yarn add react-lectorem

See It in Use

There is a live site here where you can see a demo.

Sample Code

import React from 'react';
import Lectorem from 'react-lectorem';

const App = ({ storyData, isTranslationShown, isTranslationBelow, isBySentence  }) => (
  <Lectorem
    data={storyData}
    configuration={
      isTranslationShown,
      isTranslationBelow,
      isBySentence
    }
  />
);

export default App;

Data

The data are urls for the relevant files (audio and images) and the text broken up into strings ("lects") with associated time codes. The text is broken up into groups of sentences (basically paragraphs) with optional headers and images. The sentences header can have it's own highlighted text. Each sentence is an array of objects. Those objects have a property "lects" and a property "sentenceTranslation".

The shape of the data will be:

{
  audioPath: './frere.mp3',
  subtitle: '(Are You Sleeping)',
  title: 'Frère Jacques',
  paragraphs: [
    {
      header: {
        imagePath: './frere.png',
      },
      sentences: [
        {
          lects: [
            {
              start: 4.424,
              end: 5.511,
              text: 'Frère',
              translation: 'Brother',
              explanation: '"Brother" in this sense means the title of a monk. "Frère" is also where we get our word "friar"',
            },
            {
              start: 5.51,
              end: 6.533,
              text: 'Jacques',
              translation: 'James',
              explanation: 'In the English version of the song this is rendered as "John" but a more accurate translation would be "James" or "Jacob", from the Latin "Iacobus".',
            },
            {
              text: '.',
            },
          ],
          sentenceTranslation: 'Brother James.',
        },
        {
          lects: [
            {
              start: 6.618,
              end: 7.683,
              text: 'Frère',
              translation: 'Brother',
              explanation: '"Brother" in this sense means the title of a monk. "Frère" is also where we get our word "friar"',
            },
            {
              start: 7.68,
              end: 8.79,
              text: 'Jacques',
              translation: 'James',
              explanation: 'In the English version of the song this is rendered as "John" but a more accurate translation would be "James" or "Jacob", from the Latin "Iacobus".',
            },
            {
              text: '.',
            },
          ],
          sentenceTranslation: 'Brother James.',
        },
      ],
    },
    {
      sentences: [
        {
          lects: [
            {
              start: 8.831,
              end: 10.857,
              text: 'Dormez-vous?',
              translation: 'Are you sleeping?',
            },
          ],
          sentenceTranslation: 'Are you sleeping?',
        },
        {
          lects: [
            {
              start: 11.025,
              end: 12.71,
              text: 'Dormez-vous?',
              translation: 'Are you sleeping?',
            },
          ],
          sentenceTranslation: 'Are you sleeping?',
        },
      ],
    },
    {
      sentences: [
        {
          lects: [
            {
              start: 13.21,
              end: 13.706,
              text: 'Sonnez',
              translation: 'Ring',
            },
            {
              start: 13.704,
              end: 15.399,
              text: 'les matines',
              translation: 'the morning bells',
              explanation: 'These were the bells to wake the monks for the "matins", the first chants in the day, very early in the morning.',
            },
            {
              text: '!',
            },
          ],
          sentenceTranslation: 'Ring the morning bells!',
        },
        {
          lects: [
            {
              start: 15.39,
              end: 15.924,
              text: 'Sonnez',
              translation: 'Ring',
            },
            {
              start: 15.923,
              end: 17.572,
              text: 'les matines',
              translation: 'the morning bells',
              explanation: 'These were the bells to wake the monks for the "matins", the first chants in the day, very early in the morning.',
            },
            {
              text: '!',
            },
          ],
          sentenceTranslation: 'Ring the morning bells!',
        },
      ],
    },
    {
      sentences: [
        {
          lects: [
            {
              start: 17.57,
              end: 19.319,
              text: 'Ding, dang, dong.',
              explanation: 'An onomatopoeia for bells, like our "ding dong".',
            },
          ],
          sentenceTranslation: 'Ding, dang, dong.',
        },
        {
          lects: [
            {
              start: 19.784,
              end: 21.632,
              text: 'Ding, dang, dong.',
              explanation: 'An onomatopoeia for bells, like our "ding dong".',
            },
          ],
          sentenceTranslation: 'Ding, dang, dong.',
        },
      ],
    },
  ],
}

Interested in contributing? See our guidelines.