Metadata-Version: 2.4
Name: duskfm
Version: 0.8.0
Summary: Endless, never-repeating music from lo-fi to synthwave, synthesized on the spot: no samples, nothing recorded.
Keywords: lofi,lo-fi,synthwave,chillwave,generative,music,focus,ambient,synthesizer
Author: Frank Lynam
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
Classifier: Topic :: Multimedia :: Sound/Audio :: Players
License-File: LICENSE
Requires-Dist: numpy>=1.22
Requires-Dist: scipy>=1.8
Requires-Dist: sounddevice>=0.4 ; extra == "sounddevice"
Project-URL: Homepage, https://github.com/frank-lynam/duskfm
Project-URL: Issues, https://github.com/frank-lynam/duskfm/issues
Provides-Extra: sounddevice

# duskfm

Endless music from lo-fi to synthwave, made on the spot: one song after another, never the same one twice, all day long.

Every sound is synthesized as it plays, built the way the real instrument makes its sound (no tremolos, no sweeps
on every note):

- a felt piano (the core of the lo-fi end): up to thirty stretched overtones on two or three strings a hair apart,
  through a wooden soundboard;
- a guitar, nylon and fingered or electric and picked through a warm valve amp, playing chord shapes a guitarist
  would actually finger, picked or strummed;
- a fingered electric bass, heard through its pickup;
- a mellow organ, pads, a polysynth, arpeggios and a synth lead that start bright and settle warm;
- a soft choir "ooh" of three voices;
- a soft drum kit built from the partials a drum head, a wood block or a cymbal rings with;
- tape wobble, vinyl dust and rain.

It stays low and warm: tunes sit below C5, highs fade first, nothing glassy or shrill, and every hit has a soft edge
(hats tick rather than sizzle), even at the bright synthwave end.

It plays songs. Each one runs a few minutes and is its own thing: a key and a tempo, four chords, a drum loop, a
bass line that locks to the kick, and a tune that comes back. Each song draws its band from where the style dial is:
something to play the chords, two voices to trade the tune, sometimes a choir or an arpeggio. The weather and the
record drift on their own too: a rainy stretch comes and goes, the dust thickens and clears. The status line names
who's playing. No samples and nothing recorded, so the package is a few files of Python.

```bash
pip install duskfm
duskfm                    # lo-fi
duskfm synthwave          # or: lofi, chillhop, chillwave, synthwave, nightdrive, ambient
```

## One dial from lo-fi to synthwave

`--style` runs from 0 (lo-fi) to 1 (synthwave), and everything blends along it:

| | lo-fi (0) | chillwave (0.5) | synthwave (1) |
|---|---|---|---|
| tempo | 72–84, swung | ~85–97 | 94–110, straight |
| harmony | jazzy 7ths and 9ths (ii–V–I) | dreamy maj9 and sus | minor: i–VI–III–VII |
| keys | felt piano, organ | felt piano, pads | polysynth, arpeggios, a lead |
| drums | dusty boom-bap, lazy | soft kick, rim, shaker | punchy, 80s gated snare |
| texture | crackle, tape wobble, dark | haze, chorus | clearer, wide, big reverb |
| band | felt piano, organ, guitar | felt piano, guitar, voices, electric guitar | polysynth, arps, synth lead, electric guitar |

`--energy` runs from 0 (ambient: no drums, sparse) to 1 (driving). `--drift` lets both wander slowly on their own,
so a long session moves through moods. The presets are points on the two dials (`duskfm --help` lists them).

A song has a shape: an intro, the groove with its tune, a breakdown where the drums step back, the lift where
everything returns, and an outro that often leads into the next song's key. Within a song the beat is a two-bar
loop with a small turn at the end of each phrase, and the tune is a four-bar phrase (a statement, an answer, the
statement again, an ending) that returns with a different ending, so there is something to recognize. Between songs
it changes gently: chords voiced smoothly from one to the next, tempo gliding rather than jumping, newcomers fading
in. The band breathes with the kick (the chords, pads and bass dip under each hit), which is where the pulse comes
from. Move a dial a long way and the song wraps up early for one that fits. `--seed` replays a session you liked
(the seed is shown when you quit).

## While it plays

| key | |
|---|---|
| ← → | style: toward lo-fi, toward synthwave |
| ↑ ↓ | energy |
| + − | volume |
| ] [ | boost (3 dB a press) |
| r | rain: off, light, heavy |
| d | drift on or off |
| n | on to the next song |
| 1–6 | the presets |
| space | pause |
| q | quit (it fades out) |

## Loud enough to drown out the room

- `--volume` (0–100) is the ordinary level.
- `--boost DB` (up to 18) is the maximizer behind it: the music is compressed and driven into a soft limiter, so it
  gets much louder without ever clipping. Your speakers' own limit still applies; this gets more out of it.
- `--rain` adds a soft rain bed shaped to the frequencies speech lives in. Lo-fi is mellow and dark, which is
  lovely and also poor at covering voices; a little rain covers chatter better than a lot more volume, and spares
  your ears. A whole day at high volume is hard on hearing: reach for the rain first.

## Playing it

On Linux it plays through `paplay` (PulseAudio, or PipeWire's pulse layer), `pw-cat` or `aplay`, whichever is
there: nothing else to install. Over remote desktop (xrdp), sound comes through when the session has xrdp's
PulseAudio or PipeWire module; if `paplay` works there, duskfm does. Elsewhere, `pip install "duskfm[sounddevice]"`
uses PortAudio.

No sound where you are? Make a file and play it anywhere:

```bash
duskfm chillwave --render 3h -o afternoon.wav
```

`--minutes 90` plays for a while and then fades out.

## Development

`python3 tests/test_duskfm.py`: every preset renders clean audio at a steady level, a seed replays exactly, songs
hold together (a beat, a tune, a shape) and none comes round again, the kick has room in the mix, boost gets louder without clipping, and the player and command line work (no sound card needed). A GitHub
release `vX.Y.Z` matching `__version__` publishes to PyPI.

