Skip to main content

A library with Jupyter widgets for speech processing

Project description

speechwidgets

A library with Jupyter widgets for speech processing

Widgets in this library:

Installation

You can install using pip:

pip install speechwidgets

If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable the nbextension:

jupyter nbextension enable --py [--sys-prefix|--user|--system] speechwidgets

Usage

from speechwidgets import SpectrogramPlayer

Basic usage:

SpectrogramPlayer(
    wav_file_path='./19-198-0001.wav',
    width=800,
    spec_height=200,
    navigator=True,
    nav_height=60,
)

Advanced usage:

SpectrogramPlayer(
    wav_file_path='./19-198-0001.wav',
    width=800,
    spec_height=200,
    navigator=False,
    settings=False,
    colormap="greys",

    # for dark mode notebooks:
    dark=False, # set to True
    transparent=False, # optionally set to True
    
    # mel spec parameters:
    n_fft=2048,
    win_length=400,
    hop_length=160,
    f_min=50, 
    n_mels=80,
    power=1.0,
    
    # amplitude to db parameter:
    top_db=80 
)

Development Installation

Create a dev environment:

conda create -n speechwidgets-dev -c conda-forge nodejs python jupyterlab
conda activate speechwidgets-dev

Install the python dependencies. This will also build the TS package.

pip install -e ".[test, examples]"
pip install jupyter_packaging traittypes numpy scipy

When developing your extensions, you need to manually enable your extensions with the notebook / lab frontend. For lab, this is done by the command:

jupyter labextension develop --overwrite .
npm install
npm run build

For classic notebook, you need to run:

jupyter nbextension install --sys-prefix --symlink --overwrite --py speechwidgets
jupyter nbextension enable --sys-prefix --py speechwidgets

Note that the --symlink flag doesn't work on Windows, so you will here have to run the install command every time that you rebuild your extension. For certain installations you might also need another flag instead of --sys-prefix, but we won't cover the meaning of those flags here.

How to see your changes

Typescript:

If you use JupyterLab to develop then you can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the widget.

# Watch the source directory in one terminal, automatically rebuilding when needed
npm run watch
# Run JupyterLab in another terminal
jupyter lab

After a change wait for the build to finish and then refresh your browser and the changes should take effect.

Python:

If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speechwidgets-0.1.2.tar.gz (750.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speechwidgets-0.1.2-py2.py3-none-any.whl (508.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file speechwidgets-0.1.2.tar.gz.

File metadata

  • Download URL: speechwidgets-0.1.2.tar.gz
  • Upload date:
  • Size: 750.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for speechwidgets-0.1.2.tar.gz
Algorithm Hash digest
SHA256 da2d86c725c65066da20d02d420daa85366a2c69a3abcb1288be9d65ac0c7032
MD5 3574b93e077f139538a43a07384b9258
BLAKE2b-256 6231ebc2138cfcc2f70993bd7bcb4e0f9537c335f6d4e9b4899fda414ea2509d

See more details on using hashes here.

File details

Details for the file speechwidgets-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: speechwidgets-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 508.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for speechwidgets-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8c415a8b3b802d4f8bf8298f2f5601ceecd0f64dd7875267d19362ee9ef9f695
MD5 97fa855d33401e4aab7a94ef5cf49ea6
BLAKE2b-256 93ae9a40ba74b2f9c249f422e783e89c268c197615a36ca76bcdc488f160d2cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page