https://github.com/jeffwright13/faker_music
An add-on provider for the awesome Faker module to provide random and/or fake data in music-related categories.
https://github.com/jeffwright13/faker_music
Last synced: about 1 year ago
JSON representation
An add-on provider for the awesome Faker module to provide random and/or fake data in music-related categories.
- Host: GitHub
- URL: https://github.com/jeffwright13/faker_music
- Owner: jeffwright13
- License: mit
- Created: 2021-05-18T00:07:04.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-07-10T09:02:20.000Z (almost 2 years ago)
- Last Synced: 2025-01-17T00:22:07.874Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 84 KB
- Stars: 7
- Watchers: 4
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
``` bash
pip install faker_music
```
From source code:
``` bash
git clone https://github.com/jeffwright13/faker_music/
cd faker_music && python setup.py install
```
## Execution
Add as a provider to your Faker instance:
``` python
>>> from faker import Faker
>>> from faker_music import MusicProvider
>>> fake = Faker()
>>> fake.add_provider(MusicProvider)
```
Now you can start to generate data:
```python
>>> 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:
``` python
>>> 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:
``` python
>>> 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](https://simple.wikipedia.org/wiki/List_of_musical_instruments), and massaged into a format suitable for coding using the `genre_parser.py` and `instrument_parser.py` code [found here](https://gist.github.com/jeffwright13/ded48a18ba6db7feb47eea5892665d86).
## Acknowlegements
- I would like to thank the maintainer of the [faker_airtravel](https://github.com/dkotschessa/faker_airtravel/) repository, since I used its structure to create this one.
- Big thanks also to [Bob Belderbos](https://github.com/bbelderbos) for his expert guidance in getting this litte project off the ground.