From 85e94c0aff56b82d2ee2748f1894a78083c7a729 Mon Sep 17 00:00:00 2001 From: allholy Date: Mon, 23 Dec 2024 17:12:57 +0100 Subject: [PATCH] Add all BST categories --- freesound/settings.py | 39 +++++++++++++++++++ .../0054_alter_sound_bst_category.py | 18 +++++++++ sounds/models.py | 8 +--- 3 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 sounds/migrations/0054_alter_sound_bst_category.py diff --git a/freesound/settings.py b/freesound/settings.py index 8bcc8449c..5bc6a9006 100644 --- a/freesound/settings.py +++ b/freesound/settings.py @@ -457,6 +457,45 @@ ANNOUNCEMENT_CACHE_KEY = 'announcement_cache' +# ------------------------------------------------------------------------------- +# Broad Sound Taxonomy definition + +BROAD_SOUND_TAXONOMY = [ + {'category_code': 'm', 'level': 1, 'name': 'Music', 'description': 'Music excerpts, melodies, loops, fillers, drones and short musical snippets.'}, + {'category_code': 'm-sp', 'level': 2, 'name': 'Solo percussion', 'description': 'Music excerpts with solo percussive instruments.'}, + {'category_code': 'm-si', 'level': 2, 'name': 'Solo instrument', 'description': 'Music excerpts with only one instrument, excluding percussion.'}, + {'category_code': 'm-m', 'level': 2, 'name': 'Multiple instruments', 'description': 'Music excerpts with more than one instrument.'}, + {'category_code': 'm-other', 'level': 2, 'name': 'Other (music)', 'description': 'Music that doesn\'t belong to any of the above categories.'}, + {'category_code': 'is', 'level': 1, 'name': 'Instrument samples', 'description': 'Single notes from musical instruments, various versions of the same note, and scales.'}, + {'category_code': 'is-p', 'level': 2, 'name': 'Percussion', 'description': 'Instrument samples that are percussive (idiophones or membraphones).'}, + {'category_code': 'is-s', 'level': 2, 'name': 'String', 'description': 'Instrument samples that belong to the string instrument family.'}, + {'category_code': 'is-w', 'level': 2, 'name': 'Wind', 'description': 'Instrument samples that belong to the wind instrument family (aerophones).'}, + {'category_code': 'is-k', 'level': 2, 'name': 'Piano / Keyboard instruments', 'description': 'Instrument samples of piano or other keyboard instruments, not synthesized.'}, + {'category_code': 'is-e', 'level': 2, 'name': 'Synths / Electronic', 'description': 'Instrument samples synthesized or produced by electronic means.'}, + {'category_code': 'is-other', 'level': 2, 'name': 'Instrument samples (other)', 'description': 'Instrument samples that don\'t belong to any of the above categories.'}, + {'category_code': 'sp', 'level': 1, 'name': 'Speech', 'description': 'Sounds where human voice is prominent.'}, + {'category_code': 'sp-s', 'level': 2, 'name': 'Solo speech', 'description': 'Recording of a single voice speaking, excluding singing.'}, + {'category_code': 'sp-c', 'level': 2, 'name': 'Conversation / Crowd', 'description': 'Several people talking, having a conversation or dialogue.'}, + {'category_code': 'sp-p', 'level': 2, 'name': 'Processed / Synthetic', 'description': 'Voice(s) from an indirect source (e.g. radio), processed or synthesized.'}, + {'category_code': 'sp-other', 'level': 2, 'name': 'Other (speech)', 'description': 'Voice-predominant recordings that don\'t belong to any of the above categories.'}, + {'category_code': 'fx', 'level': 1, 'name': 'Sound effects', 'description': 'Isolated sound effects or sound events, each happening one at a time.'}, + {'category_code': 'fx-o', 'level': 2, 'name': 'Objects / House appliances', 'description': 'Everyday objects, inside the home or smaller in size.'}, + {'category_code': 'fx-v', 'level': 2, 'name': 'Vehicles', 'description': 'Sounds produced from a vehicle.'}, + {'category_code': 'fx-m', 'level': 2, 'name': 'Other mechanisms, engines, machines', 'description': 'Machine-like sounds, except vehicles and small house electric devices.'}, + {'category_code': 'fx-h', 'level': 2, 'name': 'Human sounds and actions', 'description': 'Sounds from the human body, excluding speech.'}, + {'category_code': 'fx-a', 'level': 2, 'name': 'Animals', 'description': 'Animal vocalizations or sounds.'}, + {'category_code': 'fx-n', 'level': 2, 'name': 'Natural elements and explosions', 'description': 'Sound events occuring by natural processes.'}, + {'category_code': 'fx-ex', 'level': 2, 'name': 'Experimental', 'description': 'Experimental sounds or heavily processed audio recordings.'}, + {'category_code': 'fx-el', 'level': 2, 'name': 'Electronic / Design', 'description': 'Sound effects that are computer-made or designed for user interfaces or animations.'}, + {'category_code': 'fx-other', 'level': 2, 'name': 'Other (sound effects)', 'description': 'Sound effects that don\'t belong to any of the above categories.'}, + {'category_code': 'ss', 'level': 1, 'name': 'Soundscapes', 'description': 'Ambiances, field-recordings with multiple events and sound environments.'}, + {'category_code': 'ss-n', 'level': 2, 'name': 'Nature', 'description': 'Soundscapes from natural habitats.'}, + {'category_code': 'ss-i', 'level': 2, 'name': 'Indoors', 'description': 'Soundscapes from closed or indoor spaces.'}, + {'category_code': 'ss-u', 'level': 2, 'name': 'Urban', 'description': 'Soundscapes from cityscapes or outdoor places with human intervention.'}, + {'category_code': 'ss-s', 'level': 2, 'name': 'Synthetic / Artificial', 'description': 'Soundscapes that are synthesized or computer-made ambiences.'}, + {'category_code': 'ss-other', 'level': 2, 'name': 'Other (soundscapes)', 'description': 'Soundscapes that don\'t belong to any of the above categories.'}, +] + # ------------------------------------------------------------------------------- # Freesound data paths and urls diff --git a/sounds/migrations/0054_alter_sound_bst_category.py b/sounds/migrations/0054_alter_sound_bst_category.py new file mode 100644 index 000000000..0988305d3 --- /dev/null +++ b/sounds/migrations/0054_alter_sound_bst_category.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.23 on 2024-12-23 17:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sounds', '0053_sound_bst_category'), + ] + + operations = [ + migrations.AlterField( + model_name='sound', + name='bst_category', + field=models.CharField(blank=True, choices=[('m', 'Music'), ('m-sp', 'Solo percussion'), ('m-si', 'Solo instrument'), ('m-m', 'Multiple instruments'), ('m-other', 'Other (music)'), ('is', 'Instrument samples'), ('is-p', 'Percussion'), ('is-s', 'String'), ('is-w', 'Wind'), ('is-k', 'Piano / Keyboard instruments'), ('is-e', 'Synths / Electronic'), ('is-other', 'Instrument samples (other)'), ('sp', 'Speech'), ('sp-s', 'Solo speech'), ('sp-c', 'Conversation / Crowd'), ('sp-p', 'Processed / Synthetic'), ('sp-other', 'Other (speech)'), ('fx', 'Sound effects'), ('fx-o', 'Objects / House appliances'), ('fx-v', 'Vehicles'), ('fx-m', 'Other mechanisms, engines, machines'), ('fx-h', 'Human sounds and actions'), ('fx-a', 'Animals'), ('fx-n', 'Natural elements and explosions'), ('fx-ex', 'Experimental'), ('fx-el', 'Electronic / Design'), ('fx-other', 'Other (sound effects)'), ('ss', 'Soundscapes'), ('ss-n', 'Nature'), ('ss-i', 'Indoors'), ('ss-u', 'Urban'), ('ss-s', 'Synthetic / Artificial'), ('ss-other', 'Other (soundscapes)')], default=None, max_length=8, null=True), + ), + ] diff --git a/sounds/models.py b/sounds/models.py index bb10a06bf..d95006eb9 100644 --- a/sounds/models.py +++ b/sounds/models.py @@ -621,13 +621,7 @@ class Sound(models.Model): date_recorded = models.DateField(null=True, blank=True, default=None) # Broad Sound Taxonomy (BST) category - BST_CATEGORY_CHOICES = [ - ('m', 'Music'), - ('is', 'Instrument samples'), - ('sp', 'Speech'), - ('fx', 'Sound Effects'), - ('ss', 'Soundscapes'), - ] + BST_CATEGORY_CHOICES = [(item['category_code'], item['name']) for item in settings.BROAD_SOUND_TAXONOMY] bst_category = models.CharField(max_length=8, null=True, blank=True, default=None, choices=BST_CATEGORY_CHOICES) # The history of licenses for a sound is stored on SoundLicenseHistory 'license' references the last one