Skip to main content

Tabalchi: Parser and Generator for Indian Classical Music

Project description

Tabalchi

A parser for Indian classical music, specifically tabla, that does not require any knowledge of MIDI, music sampling, or battery kits.

Note that this is a brand-new library that is not necessarily stable. Feel free to provide feedback to the author

To get started, write a .tabla file with the bol (composition). The syntax of a .tabla file is identical to that of a .json file.

Example:

{
"composition": "Kayda",
"name": "My Composition",
"components":
  {"mainTheme":
   {"bhari": "dha ti ge ne | dha ti dha ge | dhin na ge na | tete ge ne | dha ti dha ge | dhin na ge na | tete tete | ge na tete | ge na dha ti | dha tete dha | ge ne dha ge | tin na ke na",
   "khali": "Infer"
   },
 "paltas": {
    "palta1": {
      "bhari": "dha ti ge ne | dha ti dha ge | dhin na ge na | tete ge ne | dha ti dha ge | dhin na ge na | dha ti ge ne | dha ti dha ge | dhin na ge na | tete ge ne | dha ti dha ge | dhin na ge na | dha ti ge ne | dha ti dha ge | dhin na ge na | tete ge ne | dha ti dha ge | dhin na ge na | tete tete | ge na tete | ge na dha ti | dha tete dha | ge ne dha ge | tin na ke na",
      "khali": "Infer"
    }
 },
 "tihai": "dha ti ge ne | dha ti dha ge | dhin na ge na | dha S S S | dhin na ge na | dha S S S | dhin na ge na | dha S S S | dha ti ge ne | dha ti dha ge | dhin na ge na | dha S S S | dhin na ge na | dha S S S | dhin na ge na | dha S S S | dha ti ge ne | dha ti dha ge | dhin na ge na | dha S S S | dhin na ge na | dha S S S | dhin na ge na | dha S S S"
 },
"taal": "Ektaal",
"speed": "60bpm",
"jati": "Chatusra",
"playingStyle": "Lucknow",
"display": "Bhatkande"
}

To play a given .tabla file, simply write the following Python code. You will need to first install the Tabla library through pip install Tabla

from Tabla import *
parser = BolParser()
parser.parse("yourBol.tabla").play()

To view the entire composition with the notation of your choice (specified in the .tabla file itself), simply write:

from Tabla import *
parser = BolParser()
parser.parse("yourBol.tabla").write("yourOutputFile.txt/pdf", Bhatkande)

The parser above is the standard BolParser provided by the library. You can create your own parser by doing something like:

from Tabla import*
class MyParser(BolParser):
  #override functionality
parser = MyParser()
parser.load("yourBol.tabla")

The standard parser uses a set of predefined configurations available through the appropriate get methods. It also uses some standard symbols given below:

Symbol Description Example + Walkthrough
| This differentiates 2 beats. dha S S | ge na ge
- indicates a sequential phrase needs to be split differently when conforming to a particular jati dha tere-kite | dhe tete
While normally terekite would be automatically parsed as 4 syllables (as in terekite | dha ti ge ne) or 1 syllable (as in terekite dha ti dha | S ki te ta), here we need to specify it is 2 syllables to maintain Tisia Jati. This is necessary when there is no clear way to uphold the jati for the particular beat. Notice that we do not need to write tete in the second beat as te-te because it is by default 2 syllables, which along with the dhe, makes 3 syllables per beat.
[] This is to group two phrases as 1 "syllable", so to speak, without creating a new sequential phrase. dha ti ge | [dha ge] tere-kite
This indicates that dha & ge occupy the space normally taken by one syllable, again ensuring 3 syllables per beat - the 3 syllables in the second beat are [dha ge], tere, and kite, with the latter two part of the same sequential phrase (see - symbol definition above). Technically, this is equivalent to increasing the speed for a fraction of the beat, but the speed parameter in .tabla files is only for whole number of beats.
~ This is to indicate a specific phrase for further checks. dha ~ti ge | dha dha ti
This singles out the first ti for further checks, such as those passed into the CompositionType for ensuring validity of a composition. An example of such a function would be to return True if the specified ti is the second syllable of its beat, and False otherwise.

This symbol specification is given by BolParser's getSymbols(), which should be overridden to return appropriate markdown text if your parser uses different/additional symbols.

We now give brief descriptions of the main classes you may find yourself using in addition to BolParser. See the docs for more detailed descriptions.

  1. BeatRange: Represents an interval of beats with methods for checking sequences and subsequences.
  2. CompositionType: Defines a composition type with a schema, validity check, and registration for future use.
  3. Numeric: An abstract base class representing entities with an associated number, utilized for Taal, Jati, and Speed classes.
  4. Taal: Represents a rhythmic cycle or meter in Indian classical music, storing beats, clap positions, and additional information.
  5. Jati: Represents a rhythmic grouping or subdivision, defined by the number of syllables.
  6. SpeedClasses: Categorizes speed into classes based on beats per minute with methods for checking and generating random speeds.
  7. Speed: Represents a specific tempo, either by beats per minute or by a named speed class.
  8. Notation: An abstract base class for converting a Bol into a string format, with a method for displaying the notation.
  9. Bhatkande: Intended to handle Bhatkande notation (without current implementation).
  10. Paluskar: Intended to handle Paluskar notation (without current implementation).
  11. Bol: Represents a collection of beats with methods for playback and writing to a file using a specified notation.
  12. Beat: Represents a collection of phrases within a beat, managing playback and phrase duration calculations.
  13. Fetcher: Provides static methods for fetching sound data associated with phrases or adding new audio recordings.
  14. Sound: Represents the soundbite associated with a phrase, with methods for playing and merging or joining sounds.
  15. Phrase: Represents a tabla phrase including its properties, soundbite, and functionality for playing and creating composite or sequential phrases.
  16. CompositionGenerator: Offers a static method for generating a composition of a specified type using a machine learning model.
  17. AudioToBolConvertor: Provides a static method to transcribe a Bol from an audio recording based on speed and jati.

About the Author

Shreyan has been learning the tabla for 12+ years at the Akhil Bharatiya Gandharva Mahavidyalaya Mandal. He is currently pursuing a Visharad (equivalent to a Bachelor's) certification.

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

tabalchi-0.0.2.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

Tabalchi-0.0.2-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file tabalchi-0.0.2.tar.gz.

File metadata

  • Download URL: tabalchi-0.0.2.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for tabalchi-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0b1b3062531158097d9e5c7ea98b391c392d903c66b04b0dde017955b967d360
MD5 cc92bbb8f436c3609fb604e6e282fb41
BLAKE2b-256 63a63b7904ea0028caae74a9500b977c64e44a9058b719515e54867f70eede9e

See more details on using hashes here.

File details

Details for the file Tabalchi-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: Tabalchi-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for Tabalchi-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 97ed7b72337e9a7dd08a6bbe4e9312f2b4e2415a79087bf2f1ed2c473f917cfd
MD5 65b018689e29eb941d7be01375969662
BLAKE2b-256 d38c889d6f9929e02684c7d782df46179ed7b25d89831ce85bfbc21b1c3773d4

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