Skip to main content

A library of microtonal scales with sources attributed

Project description

scale-library

Python package bundling the data from scale-library, a library of microtonal scales with sources attributed.

  • scale_dir() returns the path to the directory containing the bundled scl files
  • scale_index_path() returns the path to the scale index csv
  • parse_scl_info(text) parses the scale-library scl file [info] blocks containing structured metadata

Install scale-library:

$ pip install scale-library

Read an individual scl file:

>>> import scale_library as sl
>>>
>>> scl_path = sl.scale_dir() / "damusc/Georgia_GVM206-M.scl"
>>> scl_text = scl_path.read_text()

Read the scale index as a dataframe:

>>> import pandas as pd
>>> import scale_library as sl
>>>
>>> scale_index_df = pd.read_csv(sl.scale_index_path())

The scl files in scale-library contain [info] blocks for structured metadata, for example:

! xenoga24.scl
!
Xeno-Gothic rational adaptive tuning, 3-7 ratios (keyboards 64:63 apart) 
24
!
 64/63
 2187/2048
 243/224
 9/8 
 8/7
 32/27
 2048/1701
 81/64
 9/7
 4/3 
 256/189
 729/512
 81/56
 3/2
 32/21
 6561/4096
 729/448
 27/16
 12/7
 16/9
 1024/567
 243/128
 27/14
 2/1
!
! https://yahootuninggroupsultimatebackup.github.io/tuning/topicId_16640.html#16640
!
! [info]
! source = Mailing lists
! file = tuning/messages/yahoo_tuning_messages_api_raw_0-19436.json
! topic_id = 16640
! msg_id = 16640

Parse a scale-library scl file [info] block:

>>> import scale_library as sl
>>> from pprint import pprint
>>>
>>> scl_text = (sl.scale_dir() / "mailing-lists/xenoga24.scl").read_text()
>>> info = sl.parse_scl_info(scl_text)
>>>
>>> pprint(info)
{'file': 'tuning/messages/yahoo_tuning_messages_api_raw_0-19436.json',
 'msg_id': '16640',
 'source': 'Mailing lists',
 'topic_id': '16640'}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

scale_library-1.1.0-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file scale_library-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: scale_library-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for scale_library-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d18b2b97d671eff82208902770c4588203474724c6ae8e71a1f21dfb36f0b9ce
MD5 803b3bb34f64121bd17da500537ad393
BLAKE2b-256 74ed6b0cd5124492e520280c8d3fc1accef6c75fee5491c14c77262f7aa70f41

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