Skip to main content

faker_music: music provider for Faker

An add-on provider for the Python Faker module to generate random and/or fake data for music-related categories.

Description

faker_music provides music-related fake data for testing purposes. The definition of "fake" in this context really means "random," as the musical data are real. Invocation of this module simply provides a random choice from the underlying real-world data.

No claims are made as to the accuracy or completeness of this data. However, suggestions/corrections/additional data are happily accepted.

Currently implemented:

  • Music genres
  • Musical instruments

Coming soon:

  • Composers
  • Performers

For future implementation:

  • Band names (existing)
  • Fake band name generator
  • Theory (notes/scales/chord-types/progressions)
  • ...?

Installation

From PyPi:

pip install faker_music

From source code:

git clone https://github.com/jeffwright13/faker_music/
cd faker_music && python setup.py install

Execution

Add as a provider to your Faker instance:

>>> from faker import Faker
>>> from faker_music import MusicProvider
>>> fake = Faker()
>>> fake.add_provider(MusicProvider)

Now you can start to generate data:

>>> fake.music_genre()
>>> fake.music_subgenre()
>>> fake.music_instrument()
>>> fake.music_instrument_category()

About faker_music Objects

The music_genre_object is a dictionary consisting of a 'genre' string, and an associated 'subgenre' list. The purpose is to provide data that ties together a given genre with all of it known subgenres.

For example:

>>> fake.music_genre_object()

{'genre': 'Singer/Songwriter',
 'subgenres': [
  'Alternative Folk',
  'Contemporary Folk',
  'Contemporary Singer/Songwriter',
  'Indie Folk',
  'Folk-Rock',
  'Love Song',
  'New Acoustic',
  'Traditional Folk']}

Similarly, The music_instrument_object is a dictionary consisting of an instrument 'category' string, and an associated 'instrument' list. The purpose is to provide data that ties together a given caegory with all of it known instruments.

For example:

>>> fake.music_instrument_object()

{'category': 'electronics',
 'instruments': [
  'Drum machine',
  'Electric guitar',
  'Keyboard',
  'Synthesizer',
  'Theremin',
  'Turntable']}

Data Sources

Original data for this project (stored in genres.py, instruments.py) was lifted from https://www.musicgenreslist.com and Wikipedia, and massaged into a format suitable for coding using the genre_parser.py and instrument_parser.py code found here.

Acknowlegements

  • I would like to thank the maintainer of the faker_airtravel repository, since I used its structure to create this one.
  • Big thanks also to Bob Belderbos for his expert guidance in getting this litte project off the ground.

Release files for faker_music 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for faker_music 0.4
File Size Uploaded
faker_music-0.4.tar.gz 15.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for faker_music 0.4
File Interpreter ABI Platform
faker_music-0.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 30.2 kB

Release files / faker_music-0.4.tar.gz

Download URL faker_music-0.4.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
119293298f29c77994675e3f5dfeb7d065ef24aeb84810eb0bd2846b38fb59e7
BLAKE2b-256 checksum
How to use checksums
51ba601f53ce5bfa6cd9e3efbb67a697d23658a30de43b9183acd2c626c155e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Release files / faker_music-0.4-py2.py3-none-any.whl

Download URL faker_music-0.4-py2.py3-none-any.whl
Size 14.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7ad13d9a085cccc87d2b1f0510ff8a95c2176b41122ae289d38c321dbc29d8f2
BLAKE2b-256 checksum
How to use checksums
1c356a6a2717a0a6e5ef04b27b11f09a70b3cfbd12cc656495f1261bee429dcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page