|
417 | 417 | ANNOUNCEMENT_CACHE_KEY = "announcement_cache" |
418 | 418 |
|
419 | 419 | # ------------------------------------------------------------------------------- |
420 | | -# Broad Sound Taxonomy definition (internal v1.1 of BST description) |
421 | | - |
422 | | -BROAD_SOUND_TAXONOMY = { |
423 | | - "m": { |
424 | | - "level": 1, |
425 | | - "name": "Music", |
426 | | - "description": "Music excerpts, including melodies, singing, loops, fillers, drones and short musical snippets.", |
427 | | - }, |
428 | | - "m-sp": { |
429 | | - "level": 2, |
430 | | - "name": "Solo percussion", |
431 | | - "description": "Music excerpts with solo percussive instruments.", |
432 | | - "examples": "rhythmic patterns, unpitched percussion excerpts, drum passages", |
433 | | - }, |
434 | | - "m-si": { |
435 | | - "level": 2, |
436 | | - "name": "Solo instrument", |
437 | | - "description": "Music excerpts with only one instrument, excluding percussion.", |
438 | | - "examples": "isolated melody or sequence of notes, solo singing, chords from one instrument", |
439 | | - }, |
440 | | - "m-m": { |
441 | | - "level": 2, |
442 | | - "name": "Multiple instruments", |
443 | | - "description": "Music excerpts with more than one instrument.", |
444 | | - "examples": "orchestra, band, dueto, multi-instrument composition, multi-instrument loops", |
445 | | - }, |
446 | | - "m-other": { |
447 | | - "level": 2, |
448 | | - "name": "Other", |
449 | | - "description": "Music that doesn't belong to any of the above categories.", |
450 | | - }, |
451 | | - "is": { |
452 | | - "level": 1, |
453 | | - "name": "Instrument samples", |
454 | | - "description": "Single notes from musical instruments, various versions of the same note, and scales.", |
455 | | - }, |
456 | | - "is-p": { |
457 | | - "level": 2, |
458 | | - "name": "Percussion", |
459 | | - "description": "Instrument samples that are percussive (idiophones or membraphones).", |
460 | | - "examples": "drum, snare, gong, bell, xylophone", |
461 | | - }, |
462 | | - "is-s": { |
463 | | - "level": 2, |
464 | | - "name": "String", |
465 | | - "description": "Instrument samples that belong to the string instrument family.", |
466 | | - "examples": "guitar, violin, harp, mandolin", |
467 | | - }, |
468 | | - "is-w": { |
469 | | - "level": 2, |
470 | | - "name": "Wind", |
471 | | - "description": "Instrument samples that belong to the wind instrument family (aerophones).", |
472 | | - "examples": "woodwind, brass, flute, trumpet, saxophone", |
473 | | - }, |
474 | | - "is-k": { |
475 | | - "level": 2, |
476 | | - "name": "Piano / Keyboard instruments", |
477 | | - "description": "Instrument samples of piano or other keyboard instruments, not synthesized.", |
478 | | - "examples": "piano, harspichord, organ", |
479 | | - }, |
480 | | - "is-e": { |
481 | | - "level": 2, |
482 | | - "name": "Synths / Electronic", |
483 | | - "description": "Instrument samples synthesized or produced by electronic means.", |
484 | | - "examples": "synthesizers (analog/digital), synthesized or electronic samples", |
485 | | - }, |
486 | | - "is-other": { |
487 | | - "level": 2, |
488 | | - "name": "Other", |
489 | | - "description": "Instrument samples that don't belong to any of the above categories.", |
490 | | - }, |
491 | | - "sp": {"level": 1, "name": "Speech", "description": "Sounds where human voice is prominent."}, |
492 | | - "sp-s": { |
493 | | - "level": 2, |
494 | | - "name": "Solo speech", |
495 | | - "description": "Recording of a single voice speaking, excluding singing.", |
496 | | - "examples": "talking, script reading", |
497 | | - }, |
498 | | - "sp-c": { |
499 | | - "level": 2, |
500 | | - "name": "Conversation / Crowd", |
501 | | - "description": "Several people talking, having a conversation or dialogue.", |
502 | | - "examples": "playground, people talking in public places, conversations", |
503 | | - }, |
504 | | - "sp-p": { |
505 | | - "level": 2, |
506 | | - "name": "Processed / Synthetic", |
507 | | - "description": "Voice(s) from an indirect source (e.g. radio), heavily processed, or synthesized.", |
508 | | - "examples": "phone/radio recordings, robotic voice, text-to-speech", |
509 | | - }, |
510 | | - "sp-other": { |
511 | | - "level": 2, |
512 | | - "name": "Other", |
513 | | - "description": "Voice-predominant recordings that don't belong to any of the above categories.", |
514 | | - }, |
515 | | - "fx": { |
516 | | - "level": 1, |
517 | | - "name": "Sound effects", |
518 | | - "description": "Isolated sound effects or sound events, each happening one at a time.", |
519 | | - }, |
520 | | - "fx-o": { |
521 | | - "level": 2, |
522 | | - "name": "Objects / House appliances", |
523 | | - "description": "Everyday objects, inside the home or smaller in size.", |
524 | | - "examples": "daily or small objects, tools, weapons, clothes, iron", |
525 | | - }, |
526 | | - "fx-v": { |
527 | | - "level": 2, |
528 | | - "name": "Vehicles", |
529 | | - "description": "Sounds produced from a vehicle.", |
530 | | - "examples": "car passing by, car screeching, wiper, car brake, bike, plane, ship", |
531 | | - }, |
532 | | - "fx-m": { |
533 | | - "level": 2, |
534 | | - "name": "Other mechanisms, engines, machines", |
535 | | - "description": "Machine-like sounds, except vehicles and small house electric devices.", |
536 | | - "examples": "drill, lawn mower, gear, electric chainsaw", |
537 | | - }, |
538 | | - "fx-h": { |
539 | | - "level": 2, |
540 | | - "name": "Human sounds and actions", |
541 | | - "description": "Sounds from the human body, excluding speech.", |
542 | | - "examples": "breath, hearthbeat, sneeze, crying, walking, clapping", |
543 | | - }, |
544 | | - "fx-a": { |
545 | | - "level": 2, |
546 | | - "name": "Animals", |
547 | | - "description": "Animal vocalizations or sounds.", |
548 | | - "examples": "cat, insect, sheep, animal walk, growl, purr", |
549 | | - }, |
550 | | - "fx-n": { |
551 | | - "level": 2, |
552 | | - "name": "Natural elements and explosions", |
553 | | - "description": "Sound events occurring by natural processes.", |
554 | | - "examples": "wind, fire, ice, rocks, water, stones, explosions", |
555 | | - }, |
556 | | - "fx-ex": { |
557 | | - "level": 2, |
558 | | - "name": "Experimental", |
559 | | - "description": "Experimental sounds or heavily processed audio recordings.", |
560 | | - "examples": "reversed sounds, weird effects, unusual recording techniques or processing", |
561 | | - }, |
562 | | - "fx-el": { |
563 | | - "level": 2, |
564 | | - "name": "Electronic / Design", |
565 | | - "description": "Sound effects that are computer-made or designed for user interfaces or animations.", |
566 | | - "examples": "sci-fi, laser, whoosh, boink, cartoon, ui, sound alerts or notifications", |
567 | | - }, |
568 | | - "fx-other": { |
569 | | - "level": 2, |
570 | | - "name": "Other", |
571 | | - "description": "Sound effects that don't belong to any of the above categories.", |
572 | | - }, |
573 | | - "ss": { |
574 | | - "level": 1, |
575 | | - "name": "Soundscapes", |
576 | | - "description": "Ambiances, field-recordings with multiple events and sound environments.", |
577 | | - }, |
578 | | - "ss-n": { |
579 | | - "level": 2, |
580 | | - "name": "Nature", |
581 | | - "description": "Soundscapes from natural habitats.", |
582 | | - "examples": "forest ambiance, seaside, river with surrounding nature, farmland", |
583 | | - }, |
584 | | - "ss-i": { |
585 | | - "level": 2, |
586 | | - "name": "Indoors", |
587 | | - "description": "Soundscapes from closed or indoor spaces.", |
588 | | - "examples": "closed room ambience, room tone, office, factory, bar", |
589 | | - }, |
590 | | - "ss-u": { |
591 | | - "level": 2, |
592 | | - "name": "Urban", |
593 | | - "description": "Soundscapes from cityscapes or outdoor places with human intervention.", |
594 | | - "examples": "city ambience, outside airport, busy road", |
595 | | - }, |
596 | | - "ss-s": { |
597 | | - "level": 2, |
598 | | - "name": "Synthetic / Artificial", |
599 | | - "description": "Soundscapes that are synthesized or computer-made ambiences.", |
600 | | - "examples": "artificially-created soundscapes, soundscapes from imaginary places", |
601 | | - }, |
602 | | - "ss-other": { |
603 | | - "level": 2, |
604 | | - "name": "Other", |
605 | | - "description": "Soundscapes that don't belong to any of the above categories.", |
606 | | - }, |
607 | | -} |
| 420 | +# Broad Sound Taxonomy definition |
| 421 | + |
| 422 | + |
| 423 | +def load_broad_sound_taxonomy_from_csv(path): |
| 424 | + import csv |
| 425 | + |
| 426 | + taxonomy = {} |
| 427 | + with open(path, newline="", encoding="utf-8") as csvfile: |
| 428 | + reader = csv.DictReader(csvfile) |
| 429 | + for row in reader: |
| 430 | + key = row["class_key"] |
| 431 | + taxonomy[key] = { |
| 432 | + "level": 2 if "-" in key else 1, |
| 433 | + "name": row["second_level"] if "-" in key else row["top_level"], |
| 434 | + "top_level": row["top_level"], |
| 435 | + "second_level": row["second_level"], |
| 436 | + "description": row["description"], |
| 437 | + "examples": row.get("examples", ""), |
| 438 | + } |
| 439 | + return taxonomy |
| 440 | + |
| 441 | + |
| 442 | +BROAD_SOUND_TAXONOMY_CSV_FILENAME = "bst_description_v1.1_250725.csv" |
| 443 | +BROAD_SOUND_TAXONOMY_CSV_DEFINITION_PATH = os.path.join( |
| 444 | + os.path.dirname(__file__), "../_docs/", BROAD_SOUND_TAXONOMY_CSV_FILENAME |
| 445 | +) |
| 446 | +BROAD_SOUND_TAXONOMY = load_broad_sound_taxonomy_from_csv(BROAD_SOUND_TAXONOMY_CSV_DEFINITION_PATH) |
608 | 447 |
|
609 | 448 | BST_CATEGORY_CHOICES = [ |
610 | 449 | (key, value["name"]) for key, value in BROAD_SOUND_TAXONOMY.items() if "-" not in key |
|
0 commit comments