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:

{
"type": "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": [
    {
      "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": 60,
"jati": "Chatusra",
"playingStyle": "Lucknow",
"display": "Bhatkande"
}

First, make sure required dependencies are in your system as follows:

sudo apt install ffmpeg acoustid-fingerprinter

To play a given .tabla file, simply write the following Python code. You will need to 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.9.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

Tabalchi-0.0.9-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tabalchi-0.0.9.tar.gz
  • Upload date:
  • Size: 23.5 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.9.tar.gz
Algorithm Hash digest
SHA256 3383975cc20f6d6b6e956cbdd8254b9c34c76e220d30822cfba1bd24e9c6ac78
MD5 599dbdaf27171474a786c858c5061d7c
BLAKE2b-256 d9ff6a6a40ae116c209dc6dbc362ee88422aaa9e5ca0b1ef7f81571816deda93

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Tabalchi-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 20.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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 07dbd2b6b3dfaa2c859557ab8d73cf807ef37df48edc2bb4d2a8355d61d89525
MD5 79b9db05bda66368fd139abdb6c27b46
BLAKE2b-256 c38967ff9d06ffb746d61a71270ca2ee13950a8b85cc856a1483dec5a3394c2a

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