Skip to main content

Play sound beeps corresponding to musical notes.

Project description

GitHub PyPI PyPI - Python Version PyPI - Downloads

A python package to play sound beeps corresponding to musical notes from the command line or another python program.

This package uses the numpy and simplaudio packages.

How to use it from another python program:

import musicalbeeps


player = musicalbeeps.Player(volume = 0.3,
                            mute_output = False)

# Examples:

# To play an A on default octave n°4 for 0.2 seconds
player.play_note("A", 0.2)

# To play a G flat on octave n°3 for 2.5 seconds
player.play_note("G3b", 2.5)

# To play a F sharp on octave n°5 for the default duration of 0.5 seconds
player.play_note("F5#")

# To pause the player for 3.5 seconds
player.play_note("pause", 3.5)

Initialization parameters for the Player class:

Name Type Default Description
volume float 0.3 Set the volume. Must be between 0 and 1
mute_output bool False Mute the output displayed when a note is played

How to use it from the command line:

musicalbeeps --help

usage: musicalbeeps [-h] [--silent] [--volume VOLUME] [file]

Play sound beeps corresponding to musical notes.

positional arguments:
  file             a file containing musical notes

optional arguments:
  -h, --help       show this help message and exit
  --silent         disable player output
  --volume VOLUME  volume between 0 and 1 (default=0.3)

how to play notes:
    Notes are read from a file passed as argument, or directly from the
    standard input. Each note must be on a new line.

note format:
    Each note must be formatted like so: 'A5#:1.5' (without quotes)
    Where:
        - 'A' is the note (between A and G, can be lowercase)
        - '5' is the octave (between 0 and 8, default=4)
        - '#' (or 'b') is optional and used to play a sharp or flat note
        - ':1.5' is the duration of the note (1.5 seconds here, default=0.5)

pause:
    You can pause the player by replacing the note by the 'pause' word.
    For exemple, 'pause:5' will pause the player for 5 seconds.

Examples:

  • To play a B sharp on octave n°5 for 1.2 seconds: echo "B5#:1.2" | musicalbeeps

  • To play the content of a file: musicalbeeps file_to_play.txt

Example files are provided in the music_scores directory of the GitHub repository.

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

musicalbeeps-0.2.9.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

musicalbeeps-0.2.9-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file musicalbeeps-0.2.9.tar.gz.

File metadata

  • Download URL: musicalbeeps-0.2.9.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.5

File hashes

Hashes for musicalbeeps-0.2.9.tar.gz
Algorithm Hash digest
SHA256 5e505d48a10dc0f0cb4ceb69abc8dd29755be34a5681ee7b09707dd3a88ee018
MD5 22245a9e408e11f00628e11be2c5b1cf
BLAKE2b-256 af11332ad40518388fa90c994993b18d5f4190c7e0996f72f591c7c22af96633

See more details on using hashes here.

File details

Details for the file musicalbeeps-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: musicalbeeps-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.5

File hashes

Hashes for musicalbeeps-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 2538c0dffd44f7a68f4e2e6d9fdc33a49cbd5cd29732859ff29dbe56e5be68af
MD5 3428f4133ba0e1ba57752b9754a9a9c9
BLAKE2b-256 903c4c7e14b92d9d56ff91eb31b490627896ba57306f49d0e69ba94fe02371f3

See more details on using hashes here.

Supported by

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