moodist

repository·main·Indexed 25 days ago

https://github.com/remvze/moodist

An open-source ambient sound application providing curated soundscapes, binaural beats, and productivity tools such as Pomodoro timers, breathing exercises, and todo lists. Designed to be self-hostable via Docker, it features shareable mixes, PWA support, and a set of React hooks and libraries for sound playback, motion, and event management.

Tokens
1.8K
Snippets
3
Records
20
Agent score
87%

What's inside moodist

  1. Overview of Moodist features

    main

    Moodist is an ambient sound application designed for focus and calm. Key features include:

    • Soundscapes: 84 curated ambient sounds that can be layered.
    • Transitions: Smooth fade transitions for play/stop and sleep timer shutdowns.
    • Mix Sharing: Shareable mixes via URL with one-click import.
    • Presets: Ability to save, rename, delete, and reapply mixes.
    • Generators: Built-in binaural beat and isochronic tone generators.
    • Productivity Tools: Built-in breathing exercises, Pomodoro timers, countdowns, todo lists, and a notepad.
    • PWA Support: Installable Progressive Web App with offline caching capabilities.
  2. Run Moodist with Docker Compose

    main

    Moodist includes a docker-compose.yml file at the project root for easier orchestration.

    To start the service in detached mode, run the command below. Once started, the application is available at http://localhost:8080.

    docker compose up -d
  3. Run Moodist with Docker

    main

    You can run Moodist as a standalone container using Docker. This will map the application to port 8080 on your host machine.

    After running the command, access the application at http://localhost:8080.

    docker run -d \
      --name moodist \
      -p 8080:8080 \
      ghcr.io/remvze/moodist:latest
  4. Deploy Moodist using Docker Compose

    main

    To run Moodist using Docker Compose, use the following configuration. This setup maps the container's port 8080 to the host's port 8080 and ensures the service restarts automatically. It also includes a logging configuration to limit log file size to 1g to prevent disk exhaustion.

    version: '3.9'
    services:
      moodist:
        image: ghcr.io/remvze/moodist
        logging:
          options:
            max-size: 1g
        restart: always
        ports:
          - '8080:8080'
  5. Generate a silence data URL with getSilenceDataURL()

    main

    Use getSilenceDataURL(seconds) to generate a Base64 encoded WAV data URL representing a period of silence. This is useful for creating silent audio buffers for media sessions or audio processing.

    By default, it generates 60 seconds of silence. The function creates a mono audio buffer at a sample rate of 44100Hz and includes a tiny amplitude (0.001) at the start and end to prevent issues with certain browsers (like Firefox) that might ignore media sessions without initial sound.

  6. Unsubscribe from events with unsubscribe()

    main
    Use unsubscribe to manually remove a specific event listener from the document. Note that subscribe returns a convenience unsubscription function which is generally preferred for managing lifecycles.
  7. Subscribe to custom events with subscribe()

    main
    Use subscribe to register a listener for a specific event name. The listener function receives the detail payload directly. The function returns an unsubscription function that, when called, removes the listener.
  8. Trigger a file download with download()

    main
    The download function allows you to trigger a browser-based file download by creating a temporary anchor element. It accepts a filename and the string content to be included in the file. The file is generated as a text/plain data URI with utf-8 encoding.
  9. Listen for modal close events with onCloseModals()

    main
    Use onCloseModals(listener) to subscribe a callback function to the CLOSE_MODALS event. This is useful for performing cleanup or side effects when modals are dismissed. The function returns an unsubscribe function that, when called, removes the listener.
  10. Use the useCopy hook to copy text to clipboard

    main

    The useCopy hook provides a function to copy text to the clipboard and a boolean state to track if a copy operation is currently active. This is useful for showing temporary 'Copied!' UI feedback.

    By default, the copying state remains true for 1500 milliseconds after the copy action is triggered. You can customize this duration by passing a timeout value in milliseconds.

  11. Create a vertical slide motion

    main

    Use the slideY(from, to) function to create a Motion object that transitions the y position.

    • from (number, default: -10): The initial y position for the hidden state.
    • to (number, default: 0): The final y position for the show state.