feat: Tema sonoro DeepSpace per KDE Plasma

- index.theme con Directories=stereo, OutputProfile=stereo,
  Inherits=freedesktop ed Example=theme-demo
- 61 cue sintetizzati da zero (Ogg Vorbis 48 kHz stereo) piu' il montaggio
  di anteprima theme-demo.oga
- tools/gen_sounds.py: motore di sintesi riproducibile (voci FM, pluck
  Karplus-Strong, rumore a banda variabile, sub-impact, pad additivi,
  riverbero a convoluzione, modello di degrado)
- tools/verify_theme.py: verifica della spec, igiene audio (clipping, DC,
  click ai bordi) e copertura dei nomi suono richiesti dai notifyrc di KDE
- preview/index.html: player nel browser per ogni cue del tema
- Makefile, install.sh, LICENSES (audio CC-BY-SA-4.0, codice BSD-2-Clause)
This commit is contained in:
Matteo Benedetto
2026-09-20 16:12:47 +02:00
commit a51ce1e816
77 changed files with 2586 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
__pycache__/
*.pyc
*.wav
+29
View File
@@ -0,0 +1,29 @@
# Changelog
All notable changes to this project are documented here.
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.0] - 2026-09-20
### Added
* Initial release: 61 cues plus a `theme-demo` preview montage, all
synthesised from scratch and encoded as 48 kHz stereo Ogg Vorbis.
* `index.theme` declaring `Directories=stereo`, `OutputProfile=stereo`,
`Inherits=freedesktop` and `Example=theme-demo`.
* `tools/gen_sounds.py` — the complete synthesis engine (FM voices, Karplus-Strong
plucks, swept band-passed noise, sub impacts, additive pads, synthetic
convolution reverb, degradation modelling).
* `tools/verify_theme.py` — validates the theme against the freedesktop spec and
reports coverage of the sound names requested by the installed KDE
`*.notifyrc` files.
* `preview/index.html` — a browser player for every cue in the theme.
* `Makefile` and `install.sh` for user-local and system-wide installation.
### Fixed
* Reverb is no longer applied uniformly: recurring cues are near-dry so that a
burst of notifications cannot pile up, while rare cues keep the full hall.
* Added a bounded, loudness-aware normalisation stage so that sparse and dense
cues land at a comparable perceived level.
+11
View File
@@ -0,0 +1,11 @@
[Sound Theme]
Name=DeepSpace
Name[it]=Spazio Profondo
Comment=Deep-space operations sound theme for KDE Plasma (telemetry, hull, sub-drone)
Comment[it]=Tema sonoro di operazioni in spazio profondo per KDE Plasma (telemetria, scafo, sub-drone)
Inherits=freedesktop
Directories=stereo
Example=theme-demo
[stereo]
OutputProfile=stereo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
DeepSpace is dual-licensed by content type.
Audio and theme metadata: CC BY-SA 4.0 -> LICENSES/CC-BY-SA-4.0.txt
Code and documentation: BSD-2-Clause -> LICENSES/BSD-2-Clause.txt
+23
View File
@@ -0,0 +1,23 @@
Copyright (c) 2026, enne2
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+428
View File
@@ -0,0 +1,428 @@
Attribution-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.
+56
View File
@@ -0,0 +1,56 @@
# DeepSpace — sound theme for KDE Plasma
# SPDX-License-Identifier: BSD-2-Clause
THEME := DeepSpace
PALETTE := deepspace
VERSION := 1.0.0
PREFIX ?= $(HOME)/.local
DESTDIR ?=
REPO := kde-sound-theme-deepspace
.DEFAULT_GOAL := verify
.PHONY: all generate verify preview dist install install-system uninstall clean FORCE
all: verify
## Regenerate every cue in $(THEME)/stereo from the synthesis script.
generate:
python3 tools/gen_sounds.py --theme $(PALETTE) --out .
@echo "-> rigenerati i cue di $(THEME)"
## Validate the theme (spec, audio hygiene, KDE sound-name coverage).
verify:
python3 tools/verify_theme.py $(THEME)
## Rebuild the browser preview page.
preview: FORCE
python3 tools/make_preview.py $(THEME) preview/index.html
## Build the distributable tarball.
dist:
@mkdir -p dist
@tar --exclude-vcs --exclude=dist --exclude=__pycache__ \
-czf dist/$(REPO)-$(VERSION).tar.gz \
$(THEME) tools Makefile install.sh README.md CHANGELOG.md LICENSES preview
@echo "-> dist/$(REPO)-$(VERSION).tar.gz"
## Install for the current user into $(PREFIX)/share/sounds.
install:
install -d $(DESTDIR)$(PREFIX)/share/sounds/$(THEME)
cp -r $(THEME)/. $(DESTDIR)$(PREFIX)/share/sounds/$(THEME)/
@echo "-> $(DESTDIR)$(PREFIX)/share/sounds/$(THEME)"
@echo " selezionalo da Impostazioni di sistema > Colori e temi > Suoni di sistema"
## Install system-wide (needs root).
install-system:
$(MAKE) install PREFIX=/usr
uninstall:
rm -rf $(DESTDIR)$(PREFIX)/share/sounds/$(THEME)
@echo "-> rimosso $(DESTDIR)$(PREFIX)/share/sounds/$(THEME)"
clean:
rm -rf dist __pycache__ tools/__pycache__
FORCE:
+232
View File
@@ -0,0 +1,232 @@
# DeepSpace — sound theme for KDE Plasma
*Operational telemetry for the long haul*
A complete, [freedesktop Sound Theme
specification](https://specifications.freedesktop.org/sound-theme-spec/latest/)
compliant sound theme for **KDE Plasma 6** (and any other desktop that honours
the spec). 61 cues, all of them synthesised from scratch — no sample
library, no third-party audio, no attribution burden. The whole theme is
reproducible from the script in `tools/`.
```
kde-sound-theme-deepspace/
├── DeepSpace/
│ ├── index.theme # [Sound Theme] + [stereo] OutputProfile
│ └── stereo/ # 61 × Ogg Vorbis 48 kHz stereo
├── tools/
│ ├── gen_sounds.py # the synthesis engine (reproducible)
│ ├── verify_theme.py # spec + audio + KDE coverage checks
│ ├── make_preview.py # rebuilds preview/index.html
│ └── preview_template.html
├── preview/index.html
├── LICENSES/
├── Makefile
└── install.sh
```
## Character
DeepSpace is the operational voice of a ship underway: inharmonic FM bells (ratio 2.76) over a sub-bass drone rooted on A2, short band-limited noise sweeps for anything that opens, closes or docks, and a hall that is present but never washy. Cues are meant to be read at a glance: rising fifths say *nominal*, a detuned cluster over a sub impact says *attention*.
| Motif | Used for |
|---|---|
| Rising perfect fifth (0 → 7) | nominal, completed, received |
| Falling fourth (7 → 0) | warning, lost, removed |
| Detuned cluster + sub impact | error, failure, suspend |
| Band-limited noise sweep | plug, unplug, dock, trash |
| Metallic bell arpeggio | success, winner, connectivity |
## Requirements
* KDE Plasma 6, or any desktop implementing the freedesktop sound theme spec
* nothing at runtime — the cues are plain Ogg Vorbis files
* `ffmpeg` (libvorbis), `python3`, `numpy`, `scipy` **only** if you want to
regenerate the audio
## Install
User-local (recommended, no root needed):
```sh
git clone https://git.enne2.net/enne2/kde-sound-theme-deepspace.git
cd kde-sound-theme-deepspace
./install.sh # copies DeepSpace/ into ~/.local/share/sounds/
```
System-wide:
```sh
sudo make install-system # copies DeepSpace/ into /usr/share/sounds/
```
## Select the theme
**System Settings → Colors & Themes → System Sounds → DeepSpace**
Or from the command line:
```sh
kwriteconfig6 --file kdeglobals --group Sounds --key Theme DeepSpace
```
To go back to the Plasma default:
```sh
kwriteconfig6 --file kdeglobals --group Sounds --key Theme ocean
```
The theme declares `Inherits=freedesktop`, so any event it does not provide
(e.g. multi-channel test signals) falls back to the stock desktop theme instead
of going silent.
## What is inside
`DeepSpace/index.theme` declares the theme, `Directories=stereo`,
`OutputProfile=stereo` and `Example=theme-demo`. The `Example` key is what the
Plasma *System Sounds* KCM uses for its preview button, so `theme-demo.oga` is a
montage of the theme's signatures rather than an arbitrary cue.
`Name[it]` and `Comment[it]` are also provided, so Plasma in an Italian locale
lists the theme as **Spazio Profondo**. That is a display name only: the theme id — the
folder name in `~/.local/share/sounds/` and the value written to
`kdeglobals` — is always `DeepSpace`, exactly like KDE's own Ocean theme shows up
as *Oceano* in Italian.
| sound name | duration | size |
|---|---:|---:|
| `alarm-clock-elapsed` | 2.66 s | 37.7 KiB |
| `audio-test-signal` | 1.10 s | 20.5 KiB |
| `audio-volume-change` | 0.13 s | 6.7 KiB |
| `battery-caution` | 1.18 s | 19.9 KiB |
| `battery-full` | 1.05 s | 18.4 KiB |
| `battery-low` | 1.18 s | 18.2 KiB |
| `bell-terminal` | 0.15 s | 7.0 KiB |
| `bell-window-system-attention` | 0.94 s | 15.6 KiB |
| `bell-window-system` | 0.88 s | 15.0 KiB |
| `bell` | 1.26 s | 19.8 KiB |
| `button-pressed-modifier` | 0.12 s | 7.1 KiB |
| `button-pressed` | 0.11 s | 6.7 KiB |
| `camera-shutter` | 0.26 s | 9.7 KiB |
| `complete-media-burn` | 2.26 s | 37.9 KiB |
| `complete-media-error` | 1.72 s | 36.1 KiB |
| `complete` | 0.83 s | 15.2 KiB |
| `completion-fail` | 1.38 s | 19.9 KiB |
| `completion-partial` | 1.12 s | 18.3 KiB |
| `completion-rotation` | 1.68 s | 24.6 KiB |
| `completion-success` | 2.14 s | 36.6 KiB |
| `desktop-login` | 2.90 s | 39.6 KiB |
| `desktop-logout` | 2.20 s | 28.0 KiB |
| `device-added` | 0.64 s | 15.2 KiB |
| `device-removed` | 0.64 s | 15.1 KiB |
| `dialog-error-critical` | 2.32 s | 45.9 KiB |
| `dialog-error-serious` | 1.80 s | 37.3 KiB |
| `dialog-error-veryserious` | 2.70 s | 35.9 KiB |
| `dialog-error` | 1.48 s | 31.5 KiB |
| `dialog-information` | 1.13 s | 18.2 KiB |
| `dialog-question` | 1.14 s | 19.1 KiB |
| `dialog-special` | 1.86 s | 33.4 KiB |
| `dialog-warning-auth` | 1.00 s | 19.1 KiB |
| `dialog-warning` | 1.27 s | 19.8 KiB |
| `game-over-loser` | 2.60 s | 50.0 KiB |
| `game-over-winner` | 3.02 s | 50.3 KiB |
| `media-insert-request` | 0.87 s | 16.5 KiB |
| `message-attention` | 1.16 s | 23.8 KiB |
| `message-contact-in` | 1.05 s | 17.0 KiB |
| `message-contact-out` | 1.05 s | 16.5 KiB |
| `message-highlight` | 0.86 s | 16.8 KiB |
| `message-new-email` | 1.48 s | 25.0 KiB |
| `message-new-instant` | 0.92 s | 15.6 KiB |
| `message-sent-instant` | 0.45 s | 10.3 KiB |
| `message` | 0.80 s | 14.8 KiB |
| `network-connectivity-established` | 1.66 s | 28.8 KiB |
| `network-connectivity-lost` | 1.26 s | 19.2 KiB |
| `outcome-failure` | 1.32 s | 28.6 KiB |
| `outcome-success` | 1.62 s | 28.4 KiB |
| `phone-incoming-call` | 2.44 s | 39.4 KiB |
| `phone-outgoing-busy` | 1.30 s | 23.6 KiB |
| `phone-outgoing-calling` | 1.16 s | 23.8 KiB |
| `power-plug` | 0.78 s | 15.3 KiB |
| `power-unplug` | 0.88 s | 18.9 KiB |
| `screen-capture` | 0.30 s | 10.4 KiB |
| `service-login` | 1.34 s | 20.7 KiB |
| `service-logout` | 1.24 s | 19.0 KiB |
| `suspend-error` | 1.92 s | 39.5 KiB |
| `theme-demo` | 11.39 s | 168.6 KiB |
| `trash-empty` | 0.95 s | 20.3 KiB |
| `window-attention` | 1.43 s | 21.4 KiB |
| `window-question` | 1.04 s | 18.0 KiB |
## Rebuilding from source
The audio is generated, not sampled, so it is fully reproducible:
```sh
make generate # rewrites DeepSpace/stereo/*.oga from tools/gen_sounds.py
make verify # spec + audio + KDE coverage checks
make preview # rebuild preview/index.html
make dist # build dist/kde-sound-theme-deepspace-1.0.0.tar.gz
```
`make verify` fails loudly on a clipped sample, a DC offset, a click at a file
edge, a wrong sample rate or channel count, a missing `stereo` directory in
`Directories=`, a broken `Example`/`Inherits` reference, and it reports how many
of the sound names actually requested by the installed KDE `*.notifyrc` files
the theme resolves.
## Design notes
### One instrument set, not sixty unrelated beeps
Every cue is assembled from the same small library of motifs — FM bells, sub
impacts, band-limited noise sweeps, additive pads, plucked strings, telemetry
blips — so the theme reads as a single instrument rather than a folder of
noises. The palette below is what turns that library into *this* theme:
| Parameter | DeepSpace |
|---|---|
| Root | A2 — 110.00 Hz |
| Scale | minor pentatonic (0 3 5 7 10) |
| FM voice | ratio 2.76, index 2.4, index decay 130 ms |
| Detune | ±6 cents |
| Space | 2.2 s synthetic hall, 2836 % wet on medium cues, near-dry on clicks |
### A differentiated reverb bus
A single reverb setting is wrong for a desktop theme: frequent cues (chat,
volume, button clicks) would smear into each other during a burst, while rare
dramatic cues would sound dry and small. Cues here are assigned one of five
reverb classes — from near-dry clicks through a small room up to a vast hall
with an extra half-second of tail — by motif, with per-sound overrides. The
result is that a chat notification stays crisp and a login blooms.
### Loudness-aware normalisation
Peak-normalising every file is not enough: a sparse bell and a dense error
cluster end up at wildly different perceived levels. After peak normalisation
each cue gets a bounded gain (±6 dB) that pulls the RMS of its *active* portion
towards 16 dBFS, with the peak ceiling always winning. That keeps the theme
consistent without introducing clipping.
### No clicks
Every cue is high-passed (30130 Hz depending on the class), given a 1.5 ms
raised-cosine fade in and a 35 ms fade out before the reverb is applied, so the
convolution never sees a discontinuity. `make verify` enforces this: it rejects
any file whose first samples are not at zero.
## Licence
* **Audio** (`DeepSpace/stereo/*.oga`, `DeepSpace/index.theme`) —
[CC BY-SA 4.0](LICENSES/CC-BY-SA-4.0.txt), the same licence the KDE sound
themes use.
* **Code and documentation** (`tools/`, `Makefile`, `install.sh`, `preview/`,
`README.md`) — [BSD-2-Clause](LICENSES/BSD-2-Clause.txt).
The sounds are original synthesis; nothing is derived from the KDE Ocean sound
theme or any other recording. You may therefore use this theme commercially and
adapt it freely, subject to CC BY-SA 4.0's attribution and share-alike terms.
## Credits
Created by **enne2** (2026). Designed for Plasma 6.3 on Debian 13.
Binary file not shown.
Executable
+56
View File
@@ -0,0 +1,56 @@
#!/bin/sh
# DeepSpace — user-local installer for the DeepSpace sound theme.
# SPDX-License-Identifier: BSD-2-Clause
#
# Usage:
# ./install.sh install into ~/.local/share/sounds
# ./install.sh -d /some/dir install into <dir>/sounds
# ./install.sh -s install into /usr/share/sounds (needs root)
# ./install.sh -y activate the theme without asking
set -eu
THEME=DeepSpace
SRC=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
DEST="${HOME}/.local/share"
ASSUME_YES=0
usage() {
sed -n '3,10p' "$0" | sed 's/^# \{0,1\}//'
exit "${1:-0}"
}
while [ $# -gt 0 ]; do
case "$1" in
-d) DEST="${2:?-d richiede un percorso}"; shift 2 ;;
-s) DEST=/usr; shift ;;
-y) ASSUME_YES=1; shift ;;
-h|--help) usage 0 ;;
*) usage 1 ;;
esac
done
TARGET="$DEST/share/sounds/$THEME"
mkdir -p "$TARGET"
cp -r "$SRC/$THEME/." "$TARGET/"
echo "installato: $TARGET"
echo "cue installati: $(find "$TARGET/stereo" -name '*.oga' | wc -l)"
if command -v kwriteconfig6 >/dev/null 2>&1; then
echo
if [ "$ASSUME_YES" = 1 ]; then
answer=y
elif [ -t 0 ]; then
printf 'attivare ora %s come tema sonoro? [s/N] ' "$THEME"
read -r answer || answer=n
else
answer=n
fi
case "$answer" in
s|S|y|Y)
kwriteconfig6 --file kdeglobals --group Sounds --key Theme "$THEME"
echo "tema attivo: $THEME"
;;
*) echo "tema non attivato (Impostazioni di sistema > Colori e temi > Suoni)" ;;
esac
fi
+6
View File
@@ -0,0 +1,6 @@
title=DeepSpace
tagline=Operational telemetry for the long haul
accent=#2fb4d2
accent2=#70c493
bg=#0c1822
fg=#d7e6ee
+108
View File
@@ -0,0 +1,108 @@
<!-- preview_template.html — sorgente di preview/index.html.
Generato da scaffold_repo.py; usa str.format(), quindi le graffe
di CSS e JavaScript sono raddoppiate. Rigenera la pagina con:
python3 tools/make_preview.py DeepSpace preview/index.html
SPDX-License-Identifier: BSD-2-Clause -->
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DeepSpace — sound theme</title>
<style>
:root { --accent: #2fb4d2; --accent2: #70c493; --bg: #0c1822; --fg: #d7e6ee; }
* { box-sizing: border-box; }
body { margin: 0; padding: 2.5rem 1.25rem 4rem;
background: radial-gradient(120% 80% at 50% 0%, #1a2634 0%, var(--bg) 55%, #05080c 100%);
color: var(--fg); min-height: 100vh;
font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 960px; margin: 0 auto; }
h1 { font-size: 2.4rem; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 .2rem; }
h1 span { color: var(--accent); }
.tag { color: var(--accent); font-style: italic; margin: 0 0 1.2rem; }
.meta { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: 0 0 2rem;
opacity: .75; font-size: .9rem; }
.meta b { font-weight: 600; color: var(--accent2); }
.demo { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.10);
border-left: 3px solid var(--accent); border-radius: 10px;
padding: 1rem 1.2rem; margin: 0 0 2rem; }
.demo h2 { margin: 0 0 .5rem; font-size: 1rem; font-weight: 600; }
.grid { display: grid; gap: 6px;
grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.row { display: flex; align-items: center; gap: .7rem;
padding: .45rem .7rem; border-radius: 8px;
background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
transition: background .15s, border-color .15s; }
.row:hover { background: rgba(255,255,255,.07); border-color: var(--accent); }
.row.playing { border-color: var(--accent); background: rgba(255,255,255,.09); }
.row button { flex: 0 0 30px; height: 30px; border-radius: 50%; cursor: pointer;
border: 1px solid var(--accent); background: transparent;
color: var(--accent); font-size: 12px; line-height: 1;
display: grid; place-items: center; }
.row button:hover { background: var(--accent); color: var(--bg); }
.row .n { flex: 1; font-size: .87rem; font-family: ui-monospace, monospace;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .d { flex: 0 0 auto; font-size: .76rem; opacity: .55;
font-variant-numeric: tabular-nums; }
footer { margin-top: 3rem; padding-top: 1.2rem; font-size: .82rem; opacity: .6;
border-top: 1px solid rgba(255,255,255,.08); }
footer a { color: var(--accent); }
</style>
</head>
<body>
<div class="wrap">
<h1>DeepSpace</h1>
<p class="tag">Operational telemetry for the long haul</p>
<div class="meta">
<span><b>61</b> cue</span>
<span><b>48 kHz</b> stereo Ogg Vorbis</span>
<span><b>freedesktop</b> sound theme spec</span>
<span><b>KDE Plasma 6</b></span>
</div>
<div class="demo">
<h2>theme-demo &mdash; anteprima del tema</h2>
<audio id="demo" controls preload="none" src="../DeepSpace/stereo/theme-demo.oga"></audio>
</div>
<div class="grid" id="grid"></div>
<footer>
DeepSpace — CC BY-SA 4.0. I cue sono sintetizzati da zero con
<code>tools/gen_sounds.py</code>: nessun campione di terze parti.
</footer>
</div>
<script>
const NAMES = [ ["alarm-clock-elapsed", 2.66], ["audio-test-signal", 1.10], ["audio-volume-change", 0.13], ["battery-caution", 1.18], ["battery-full", 1.05], ["battery-low", 1.18], ["bell-terminal", 0.15], ["bell-window-system-attention", 0.94], ["bell-window-system", 0.88], ["bell", 1.26], ["button-pressed-modifier", 0.12], ["button-pressed", 0.11], ["camera-shutter", 0.26], ["complete-media-burn", 2.26], ["complete-media-error", 1.72], ["complete", 0.83], ["completion-fail", 1.38], ["completion-partial", 1.12], ["completion-rotation", 1.68], ["completion-success", 2.14], ["desktop-login", 2.90], ["desktop-logout", 2.20], ["device-added", 0.64], ["device-removed", 0.64], ["dialog-error-critical", 2.32], ["dialog-error-serious", 1.80], ["dialog-error-veryserious", 2.70], ["dialog-error", 1.48], ["dialog-information", 1.13], ["dialog-question", 1.14], ["dialog-special", 1.86], ["dialog-warning-auth", 1.00], ["dialog-warning", 1.27], ["game-over-loser", 2.60], ["game-over-winner", 3.02], ["media-insert-request", 0.87], ["message-attention", 1.16], ["message-contact-in", 1.05], ["message-contact-out", 1.05], ["message-highlight", 0.86], ["message-new-email", 1.48], ["message-new-instant", 0.92], ["message-sent-instant", 0.45], ["message", 0.80], ["network-connectivity-established", 1.66], ["network-connectivity-lost", 1.26], ["outcome-failure", 1.32], ["outcome-success", 1.62], ["phone-incoming-call", 2.44], ["phone-outgoing-busy", 1.30], ["phone-outgoing-calling", 1.16], ["power-plug", 0.78], ["power-unplug", 0.88], ["screen-capture", 0.30], ["service-login", 1.34], ["service-logout", 1.24], ["suspend-error", 1.92], ["trash-empty", 0.95], ["window-attention", 1.43], ["window-question", 1.04] ];
const grid = document.getElementById('grid');
let current = null;
for (const [name, dur] of NAMES) {
const row = document.createElement('div');
row.className = 'row';
const btn = document.createElement('button');
btn.textContent = '▶';
btn.setAttribute('aria-label', 'riproduci ' + name);
const label = document.createElement('span');
label.className = 'n';
label.textContent = name;
const d = document.createElement('span');
d.className = 'd';
d.textContent = dur + 's';
const audio = new Audio('../DeepSpace/stereo/' + name + '.oga');
audio.preload = 'none';
btn.onclick = () => {
if (current && current !== audio) { current.pause(); current.currentTime = 0; }
document.querySelectorAll('.row.playing').forEach(r => r.classList.remove('playing'));
if (!audio.paused) { audio.pause(); audio.currentTime = 0; btn.textContent = '▶'; return; }
current = audio;
btn.textContent = '❚❚';
row.classList.add('playing');
audio.play();
};
audio.onended = () => { btn.textContent = '▶'; row.classList.remove('playing'); };
row.append(btn, label, d);
grid.append(row);
}
</script>
</body>
</html>
+1147
View File
File diff suppressed because it is too large Load Diff
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-2-Clause
"""Generate preview/index.html for a sound theme."""
from __future__ import annotations
import shutil
import subprocess
import sys
from pathlib import Path
TEMPLATE = Path(__file__).with_name("preview_template.html")
def duration(path: Path) -> float:
ffp = shutil.which("ffprobe") or "ffprobe"
return float(subprocess.run(
[ffp, "-v", "error", "-show_entries", "format=duration",
"-of", "default=nw=1:nk=1", str(path)],
capture_output=True, text=True, check=True).stdout.strip())
def main() -> int:
theme = Path(sys.argv[1])
out = Path(sys.argv[2]) if len(sys.argv) > 2 else Path("preview/index.html")
files = sorted((theme / "stereo").glob("*.oga"))
names = ", ".join(f'["{f.stem}", {duration(f):.2f}]' for f in files
if f.stem != "theme-demo")
html = TEMPLATE.read_text(encoding="utf-8")
extra = {}
for cand in (Path("preview.meta"), theme.parent / "preview.meta",
theme / "preview.meta"):
if cand.is_file():
meta = cand
break
else:
meta = None
if meta is not None:
for line in meta.read_text(encoding="utf-8").splitlines():
if "=" in line and not line.startswith("#"):
k, v = line.split("=", 1)
extra[k.strip()] = v.strip()
extra.setdefault("title", theme.name)
extra.setdefault("tagline", "")
extra.setdefault("accent", "#2fb4d2")
extra.setdefault("accent2", "#70c493")
extra.setdefault("bg", "#0c1822")
extra.setdefault("fg", "#d7e6ee")
extra.setdefault("license", "CC BY-SA 4.0")
extra["names"] = "[ " + names + " ]"
extra["nsounds"] = str(len(files))
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(html.format(**extra), encoding="utf-8")
print(f"scritto {out} ({len(files)} cue)")
return 0
if __name__ == "__main__":
sys.exit(main())
+108
View File
@@ -0,0 +1,108 @@
<!-- preview_template.html — sorgente di preview/index.html.
Generato da scaffold_repo.py; usa str.format(), quindi le graffe
di CSS e JavaScript sono raddoppiate. Rigenera la pagina con:
python3 tools/make_preview.py DeepSpace preview/index.html
SPDX-License-Identifier: BSD-2-Clause -->
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{title} — sound theme</title>
<style>
:root {{ --accent: {accent}; --accent2: {accent2}; --bg: {bg}; --fg: {fg}; }}
* {{ box-sizing: border-box; }}
body {{ margin: 0; padding: 2.5rem 1.25rem 4rem;
background: radial-gradient(120% 80% at 50% 0%, #1a2634 0%, var(--bg) 55%, #05080c 100%);
color: var(--fg); min-height: 100vh;
font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }}
.wrap {{ max-width: 960px; margin: 0 auto; }}
h1 {{ font-size: 2.4rem; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 .2rem; }}
h1 span {{ color: var(--accent); }}
.tag {{ color: var(--accent); font-style: italic; margin: 0 0 1.2rem; }}
.meta {{ display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: 0 0 2rem;
opacity: .75; font-size: .9rem; }}
.meta b {{ font-weight: 600; color: var(--accent2); }}
.demo {{ background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.10);
border-left: 3px solid var(--accent); border-radius: 10px;
padding: 1rem 1.2rem; margin: 0 0 2rem; }}
.demo h2 {{ margin: 0 0 .5rem; font-size: 1rem; font-weight: 600; }}
.grid {{ display: grid; gap: 6px;
grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }}
.row {{ display: flex; align-items: center; gap: .7rem;
padding: .45rem .7rem; border-radius: 8px;
background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
transition: background .15s, border-color .15s; }}
.row:hover {{ background: rgba(255,255,255,.07); border-color: var(--accent); }}
.row.playing {{ border-color: var(--accent); background: rgba(255,255,255,.09); }}
.row button {{ flex: 0 0 30px; height: 30px; border-radius: 50%; cursor: pointer;
border: 1px solid var(--accent); background: transparent;
color: var(--accent); font-size: 12px; line-height: 1;
display: grid; place-items: center; }}
.row button:hover {{ background: var(--accent); color: var(--bg); }}
.row .n {{ flex: 1; font-size: .87rem; font-family: ui-monospace, monospace;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }}
.row .d {{ flex: 0 0 auto; font-size: .76rem; opacity: .55;
font-variant-numeric: tabular-nums; }}
footer {{ margin-top: 3rem; padding-top: 1.2rem; font-size: .82rem; opacity: .6;
border-top: 1px solid rgba(255,255,255,.08); }}
footer a {{ color: var(--accent); }}
</style>
</head>
<body>
<div class="wrap">
<h1>{title}</h1>
<p class="tag">{tagline}</p>
<div class="meta">
<span><b>{nsounds}</b> cue</span>
<span><b>48 kHz</b> stereo Ogg Vorbis</span>
<span><b>freedesktop</b> sound theme spec</span>
<span><b>KDE Plasma 6</b></span>
</div>
<div class="demo">
<h2>theme-demo &mdash; anteprima del tema</h2>
<audio id="demo" controls preload="none" src="../{title}/stereo/theme-demo.oga"></audio>
</div>
<div class="grid" id="grid"></div>
<footer>
{title} — {license}. I cue sono sintetizzati da zero con
<code>tools/gen_sounds.py</code>: nessun campione di terze parti.
</footer>
</div>
<script>
const NAMES = {names};
const grid = document.getElementById('grid');
let current = null;
for (const [name, dur] of NAMES) {{
const row = document.createElement('div');
row.className = 'row';
const btn = document.createElement('button');
btn.textContent = '▶';
btn.setAttribute('aria-label', 'riproduci ' + name);
const label = document.createElement('span');
label.className = 'n';
label.textContent = name;
const d = document.createElement('span');
d.className = 'd';
d.textContent = dur + 's';
const audio = new Audio('../{title}/stereo/' + name + '.oga');
audio.preload = 'none';
btn.onclick = () => {{
if (current && current !== audio) {{ current.pause(); current.currentTime = 0; }}
document.querySelectorAll('.row.playing').forEach(r => r.classList.remove('playing'));
if (!audio.paused) {{ audio.pause(); audio.currentTime = 0; btn.textContent = '▶'; return; }}
current = audio;
btn.textContent = '❚❚';
row.classList.add('playing');
audio.play();
}};
audio.onended = () => {{ btn.textContent = '▶'; row.classList.remove('playing'); }};
row.append(btn, label, d);
grid.append(row);
}}
</script>
</body>
</html>
+317
View File
@@ -0,0 +1,317 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-2-Clause
#
# verify_theme.py - validate a freedesktop/KDE sound theme.
#
# Checks, per audio file:
# * decodes with ffmpeg, is Ogg Vorbis, 48 kHz, stereo
# * no clipping, no DC offset, no click at the edges
# * duration within a sane range for a desktop cue
# and, per theme:
# * index.theme parses and declares [Sound Theme] + a matching section for
# every entry of Directories
# * Inherits/Example point at things that exist
# * every sound requested by the installed KDE notifyrc files is covered
# (directly or via the Inherits chain)
#
# Copyright (c) 2026 enne2
"""Verify a sound theme against the freedesktop spec and KDE usage."""
from __future__ import annotations
import argparse
import configparser
import math
import os
import re
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
import numpy as np
from scipy.io import wavfile
SR = 48000
CLIP_THRESHOLD = 0.999
DC_LIMIT = 0.005
EDGE_LIMIT = 0.02 # absolute amplitude allowed in the first/last sample
MIN_DUR = 0.05
MAX_DUR = 4.5
PEAK_MIN_DB = -14.0
PEAK_MAX_DB = -0.5
def decode(path: Path) -> np.ndarray:
"""Decode any audio file to float64 stereo via ffmpeg."""
ff = shutil.which("ffmpeg")
if not ff:
raise RuntimeError("ffmpeg non trovato")
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as t:
tmp = t.name
try:
subprocess.run([ff, "-hide_banner", "-loglevel", "error", "-y",
"-i", str(path), "-ac", "2", "-ar", str(SR), tmp],
check=True)
sr, x = wavfile.read(tmp)
finally:
os.unlink(tmp)
if x.dtype.kind == "i":
x = x.astype(np.float64) / (2 ** (8 * x.dtype.itemsize - 1))
return x
def probe(path: Path) -> dict:
ffp = shutil.which("ffprobe") or "ffprobe"
out = subprocess.run(
[ffp, "-v", "error", "-select_streams", "a:0",
"-show_entries", "stream=codec_name,sample_rate,channels",
"-show_entries", "format=duration",
"-of", "default=nw=1:nk=1", str(path)],
capture_output=True, text=True, check=True).stdout.split()
return {"codec": out[0], "sample_rate": int(out[1]),
"channels": int(out[2]), "duration": float(out[3])}
def check_audio(path: Path, is_example: bool = False) -> tuple[list[str], list[str], dict]:
errs: list[str] = []
warns: list[str] = []
info = probe(path)
if info["codec"] != "vorbis":
errs.append(f"codec {info['codec']} != vorbis")
if info["sample_rate"] != SR:
errs.append(f"sample rate {info['sample_rate']} != {SR}")
if info["channels"] != 2:
errs.append(f"channels {info['channels']} != 2")
x = decode(path)
mono = x.mean(axis=1)
peak = float(np.max(np.abs(x)))
rms = float(np.sqrt(np.mean(x ** 2)))
peak_db = 20 * math.log10(peak) if peak > 0 else -200.0
dc = float(mono.mean())
start = float(np.mean(np.abs(x[:8])))
end = float(np.mean(np.abs(x[-8:])))
clipped = int((np.abs(x) >= CLIP_THRESHOLD).sum())
silent_tail = 0
thr = 10 ** (-60 / 20)
for s in range(len(mono) - 1, 0, -1):
if abs(mono[s]) > thr:
silent_tail = (len(mono) - 1 - s) / SR
break
if clipped:
errs.append(f"clipping: {clipped} campioni a >= {CLIP_THRESHOLD}")
if abs(dc) > DC_LIMIT:
errs.append(f"DC offset {dc:+.4f} (limite {DC_LIMIT})")
if start > EDGE_LIMIT:
errs.append(f"attacco non a zero ({start:.4f}) -> click")
if end > EDGE_LIMIT:
warns.append(f"coda non a zero ({end:.4f})")
if info["duration"] < MIN_DUR:
errs.append(f"durata {info['duration']:.3f}s < {MIN_DUR}s")
if info["duration"] > MAX_DUR and not is_example:
warns.append(f"durata {info['duration']:.2f}s > {MAX_DUR}s")
if not (PEAK_MIN_DB <= peak_db <= PEAK_MAX_DB):
warns.append(f"picco {peak_db:+.2f} dBFS fuori range "
f"[{PEAK_MIN_DB}, {PEAK_MAX_DB}]")
if silent_tail > 0.5:
warns.append(f"coda di silenzio {silent_tail:.2f}s")
return errs, warns, {"dur": info["duration"], "peak_db": peak_db,
"rms_db": 20 * math.log10(rms) if rms > 0 else -200.0,
"dc": dc}
SECT = re.compile(r"^\[(.+)\]$")
def parse_index(path: Path) -> tuple[dict, dict]:
"""Minimal ini parser that tolerates KDE's repeated/localised keys.
The metadata lives in the mandatory ``[Sound Theme]`` group (not in a
pre-section area), so that group is returned as the "top" dict; a bare
pre-section area would be merged in too, for robustness.
"""
top: dict[str, str] = {}
sections: dict[str, dict] = {}
cur = None
for raw in path.read_text(encoding="utf-8").splitlines():
line = raw.strip()
if not line or line.startswith("#"):
continue
m = SECT.match(line)
if m:
cur = m.group(1)
sections.setdefault(cur, {})
continue
if "=" not in line:
continue
k, v = line.split("=", 1)
k, v = k.strip(), v.strip()
if cur is None:
top[k] = v
else:
sections[cur][k] = v
root = sections.get("Sound Theme") or sections.get("SoundTheme")
if root is None:
for name, body in sections.items():
if "Directories" in body:
root = body
break
if root:
top = {**top, **root}
return top, sections
def resolve(name: str, dirs: list[Path]) -> Path | None:
"""Find theme `name` inside one of the `sounds` base directories."""
for base in dirs:
cand = base / name
if cand.is_dir():
return cand
if base.name == name and base.is_dir():
return base
return None
return None
def theme_dirs_chain(theme: Path, search: list[Path]) -> list[Path]:
"""Follow Inherits recursively, returning the lookup order."""
chain: list[Path] = [theme]
seen = {theme.resolve()}
queue = [theme]
while queue:
cur = queue.pop(0)
top, _ = parse_index(cur / "index.theme")
for parent in (top.get("Inherits") or "").split(","):
parent = parent.strip()
if not parent:
continue
d = resolve(parent, search)
if d and d.resolve() not in seen:
seen.add(d.resolve())
chain.append(d)
queue.append(d)
return chain
def kde_requested_names(search: list[Path]) -> set[str]:
"""Sound names Plasma/KDE applications actually ask for."""
names: set[str] = set()
roots = [Path("/usr/share/knotifications6"), Path("/usr/share/knotifications5")]
for root in roots:
if not root.is_dir():
continue
for f in root.rglob("*.notifyrc"):
try:
text = f.read_text(encoding="utf-8", errors="replace")
except OSError:
continue
for m in re.finditer(r"^\s*Sound\s*=\s*(\S+)", text, re.M):
v = m.group(1)
if v.endswith((".oga", ".ogg", ".wav")):
v = Path(v).stem
names.add(v)
return names
def main() -> int:
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
ap.add_argument("theme", type=Path, help="theme directory (contains index.theme)")
ap.add_argument("--quiet", action="store_true")
ap.add_argument("--no-kde-check", action="store_true")
args = ap.parse_args()
theme = args.theme.resolve()
errs: list[str] = []
warns: list[str] = []
idx = theme / "index.theme"
if not idx.is_file():
print(f"ERRORE: {idx} non esiste")
return 2
top, sections = parse_index(idx)
for req in ("Name", "Directories"):
if req not in top:
errs.append(f"index.theme: chiave obbligatoria '{req}' mancante")
dirs = [d.strip() for d in top.get("Directories", "").split(",") if d.strip()]
for d in dirs:
if d not in sections:
errs.append(f"index.theme: manca la sezione [{d}] dichiarata in Directories")
if not (theme / d).is_dir():
errs.append(f"index.theme: la directory '{d}' non esiste")
for d in dirs:
prof = sections.get(d, {}).get("OutputProfile")
if prof is None:
warns.append(f"[{d}] senza OutputProfile")
if "stereo" not in dirs:
errs.append("index.theme: manca 'stereo' in Directories "
"(obbligatorio come profilo di ripiego)")
example = top.get("Example")
if example:
if not any((theme / d / f"{example}.oga").is_file()
or (theme / d / f"{example}.ogg").is_file() for d in dirs):
errs.append(f"index.theme: Example='{example}' non trovato")
audio_files = sorted((theme / "stereo").glob("*.oga"))
if not audio_files:
errs.append("nessun file .oga in stereo/")
print("\n".join(errs))
return 1
print(f"Tema: {theme.name} (Name={top.get('Name')!r})")
print(f"Directories: {', '.join(dirs)} Inherits: {top.get('Inherits','-')} "
f"Example: {example or '-'}")
print(f"File audio: {len(audio_files)}\n")
if not args.quiet:
print(f"{'suono':<38}{'dur':>7}{'picco':>9}{'rms':>9}")
print("-" * 63)
total = 0.0
for f in audio_files:
e, w, info = check_audio(f, is_example=(f.stem == example))
errs += [f"{f.name}: {m}" for m in e]
warns += [f"{f.name}: {m}" for m in w]
total += info["dur"]
if not args.quiet:
print(f"{f.stem:<38}{info['dur']:6.2f}s{info['peak_db']:8.2f}dB"
f"{info['rms_db']:8.2f}dB")
print(f"\nDurata totale: {total:.1f}s media {total/len(audio_files):.2f}s")
# --- coverage against the installed KDE sound requests ----------------- #
if not args.no_kde_check:
search = [theme.parent, Path("/usr/share/sounds"),
Path.home() / ".local/share/sounds"]
chain = theme_dirs_chain(theme, search)
available: set[str] = set()
for d in chain:
available |= {p.stem for p in (d / "stereo").glob("*.oga")}
available |= {p.stem for p in (d / "stereo").glob("*.ogg")}
available |= {p.stem for p in (d / "stereo").glob("*.wav")}
requested = kde_requested_names(search)
missing = sorted(requested - available)
print(f"\nCatena Inherits: {' -> '.join(d.name for d in chain)}")
print(f"Nomi richiesti dai notifyrc KDE: {len(requested)}; "
f"risolti: {len(requested) - len(missing)}")
if missing:
for m in missing:
print(f" [i] non fornito (ripiega su freedesktop o silenzio): {m}")
print()
for w in warns:
print(f"WARN {w}")
for e in errs:
print(f"FAIL {e}")
if errs:
print(f"\n{len(errs)} errori, {len(warns)} avvisi")
return 1
print(f"OK — nessun errore, {len(warns)} avvisi")
return 0
if __name__ == "__main__":
sys.exit(main())