Skip to main content

A CLI tool that converts plaintext sheet music to beeps.

Project description

text2beep

Tests Codecov branch GitHub commits since latest release (by SemVer)

Language: 中文 | English

text2beep is a CLI tool that converts plaintext sheet music (currently only supporting JSON format) into beeps and play them.

The tool is still in its early development with only such basic features as synthesizing and playing. More features will be added in the future.

Installation

There hasn't been any releases yet. Please wait patiently for the first release. If you want to get notified when the first release is available, you may click "Watch -> Releases Only" at the top right corner of the page.

Before the first release, you may install by typing:

pip install git+https://github.com/shniubobo/text2beep.git#egg=text2beep

Usage

text2beep is easy to use. Simply prepare your sheet, then type:

text2beep /path/to/your/sheet.json

and the program will start to read the sheet, and synthesize and play music according to it.

There are several example sheet files present in the examples directory. You may try them out before creating your own sheets.

For a complete option list of the tool, type text2beep -h.

Creating your own sheets

Currently only JSON sheets are supported. More formats may be supported in the future.

Structure of a sheet file

{
  "bpm": 120,
  "time_signature": "4/4",
  "tracks": [
    [
      "E4--- C4--- D4--- G3---"
    ],
    [
      "C4--- A3--- B3--- E3---"
    ],
    [
      "A3--- F3--- G3--- C3---"
    ],
    [
      "A2--- F2--- G2--- C2---"
    ]
  ]
}

where BPM (bpm) and time signature (time_signature) are used to determine the playing speed of the song, and tracks are all the tracks of the song.

If you want to split a sheet file into several parts, or specify different BPM and time signatures for different parts of your music, you can achieve these with subsheets:

{
  "subsheets": [
    {
      "bpm": 120,
      "time_signature": "4/4",
      "tracks": [
        [
          "E4--- C4---"
        ],
        [
          "C4--- A3---"
        ],
        [
          "A3--- F3---"
        ],
        [
          "A2--- F2---"
        ]
      ]
    },
    {
      "bpm": 120,
      "time_signature": "2/4",
      "tracks": [
        [
          "D4--- G3---"
        ],
        [
          "B3--- E3---"
        ],
        [
          "G3--- C3---"
        ],
        [
          "G2--- C2---"
        ]
      ]
    }
  ]
}

All subsheets will be played one by one, or you can specify the playing range with the --range option (see text2beep -h for details).

Syntax of tracks

  • Each track is a list (as is called in Python) or an array (as is called in JSON). All strings within the list are concatenated into a single one by the tool during runtime. Although you can put all the notes into one string, it is recommended to divide them into several ones to improve readability.
  • Spaces and | can be added arbitrarily to improve readability. They will be completely ignored by the program.
  • Notes in a track are played one by one. All tracks are played simultaneously.

Syntax of notes in the tracks:

  • The note name must be one of CDEFGABX, where X stands for rest notes.
  • If a note is not a rest note, an accidental b or # may be appended to it.
  • If a note is not a rest note, an octave from 0 to 8 needs to be specified.
  • Name first, accidental second, octave third. For example: C#4.
  • A note is a quarter note by default. For example, C4 is a quarter note.
  • Each - extends the note value by 0.25. For example, C4- is a half note.
  • Any number of - may be used. For example, C4--- is a whole note, while C4-- is equal to C4-+C4 (See below for +), although in this case the meaning of a dotted note (C4--.) is ambiguous, and thus the usage of two or more than three - is not recommended. In other words, use only - and ---.
  • Each / shortens the note value by half. For example, C4/ is an eighth note.
  • Notes can be dotted with .. For example, C4. is a dotted quarter note.
  • - and / cannot be present in the same note.
  • + can be used as a tie between notes (not a slur!).

Some examples:

Note Value
X 0.25
X- 0.5
X--- 1
X/ 0.125
X// 0.0625
X. 0.375 (0.25 + 0.125)
X.. 0.4375 (0.25 + 0.125 + 0.0625)
X/. 0.1875 (0.125 + 0.0625)
X-. 0.75 (0.5 + 0.25)
X+X// 0.3125 (0.25 + 0.0625)

Example songs

Astronauts.json and Astronauts.full.json

Kokoronashi.json

Melt.json

Contributing

Any contribution is much appreciated. Please see CONTRIBUTING_en.md for details.

License

The program is licensed under GNU GPL-3.0-or-later. Please see LICENSE.txt for more details.

Copyright (C) 2020 shniubobo

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

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

text2beep-0.1.0.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

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

text2beep-0.1.0-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file text2beep-0.1.0.tar.gz.

File metadata

  • Download URL: text2beep-0.1.0.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for text2beep-0.1.0.tar.gz
Algorithm Hash digest
SHA256 916301325ae572bd9746255d5f0b43c3573a8a1084473ed2b94956b98129992e
MD5 8dbfc0a2d0a0e7b9b01abb3e4516ee5e
BLAKE2b-256 2f6cfdc30df4caf4fee4d96bff5c9ed7ae81251d262a24043f33a5a124322a54

See more details on using hashes here.

File details

Details for the file text2beep-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: text2beep-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for text2beep-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ece36f0782b66a05280ef3fccb90850766db1af6ccb8fdfbd0de10d748a8aa7
MD5 284bf6daf18f4d4d7dfe78257e9a04d9
BLAKE2b-256 e71cadaa82a7e856e804eb061b7c2a6422bd996ec179285bc6bc26bebfcb61e9

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