Coder Social home page Coder Social logo

team-thyme / soundboard Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 4.0 4.1 MB

Team Thyme's based soundboard

Home Page: https://viller.men/soundboard/

License: MIT License

CSS 0.98% JavaScript 52.47% PHP 13.72% Shell 0.97% SCSS 27.18% HTML 4.67%
soundboard web-app rest-api single-page-application telegram-bot

soundboard's Introduction

Soundboard

More like knäckebröd, har jag rätt?

Features

  • Responsive search.
  • Direct linking to samples without giving a clue on what's about to play.
  • Backend that can be used separately and includes a Telegram API.
  • Contains maximum overkill.

See https://viller.men/soundboard for the example. Samples not included!

Contrails

  • Enter while focused on the search bar to play a random visible sample.
  • Hold Shift to play samples simultaneously.
  • Hold Ctrl to play samples on a loop.
  • Press Space while not focused on the search bar to stop all playing samples.
  • Right click on a sample for all options, like copying the direct link.

Requirements

Browser support

The soundboard's frontend works in true browsers. This means that at least recent versions of Chrome and Firefox are fully supported. Other browsers give mixed results, but who uses those anyway?

How to deal with it?

  1. Download the latest release or clone the current sources.
  2. Enable production mode by copying .env.dist to .env and changing APP_ENV=prod.
  3. Build the application using ./build.sh.
  4. Make the public/ and public-api/ directories publicly accessible (E.g., by symlinking them from your web root).
  5. Add some webm/ogg/mp3/wav samples to the samples/ directory.

You can adjust behavior of the soundboard by adjusting the environment variables in .env. Point to the right API base URL by adjusting API_BASE_URL. When hosting the frontend from a subdirectory you will have to change the BASE_URL variable.

Optional steps:

  • Sample files can be served more efficiently using the Apache2 mod X-Sendfile. Install it using something like sudo apt install libapache2-mod-xsendfile and allow it to serve the samples by adding something similar to XSendFilePath /path/to/soundboard/samples to your Apache website configuration.
  • Convert added samples to an efficient format by running ./convert-samples.sh (requires FFmpeg).
  • Add webm/ogg/mp3/wav files to samples/ to instantly add them to the API.
  • Have multiple samples with the same name by suffixing them with digits (they are stripped from the names).

Development

We've got you covered fam! Running ./build.sh --serve (with APP_ENV=dev) will install the project and set you up with a local PHP and JS server that will automatically rebuild the frontend.

API methods

The API is hosted on http://localhost:32658 by default. All calls listed here should be prefixed with this base URL.

/samples - Obtain an array with the info of all the available samples.
GET /samples

Example output:

{
  "samples": [
    {
      "url": "loop/yoshi's%20island.ogg",
      "name": "yoshi's island",
      "id": "3153b81e",
      "mtime": 1465334423,
      "categories": [
        "loop"
      ]
    },
    {
      "url": "loop/de%20huilende%20rappers/boutjes%20moertjes%20stekkertjes snoertjes.ogg",
      "name": "boutjes moertjes stekkertjes snoertjes",
      "id": "e6d4f390",
      "mtime": 1465333910,
      "categories": [
        "loop",
        "de huilende rappers"
      ]
    }.
    {
      "url": "voice/wow%20effect3.ogg",
      "name": "wow effect",
      "id": "68851e0f",
      "mtime": 1465670673,
      "categories": [
        "voice"
      ]
    }
  ]
}
/samples?query=[query] - Search in samples.
GET /samples?query=rappers|wow

Example output:

{
  "samples": [
    {
      "url": "loop/de%20huilende%20rappers/boutjes%20moertjes%20stekkertjes%20snoertjes.ogg",
      "name": "boutjes moertjes stekkertjes snoertjes",
      "id": "e6d4f390",
      "mtime": 1465333910,
      "categories": [
        "loop",
        "de huilende rappers"
      ]
    }.
    {
      "url": "voice/wow%20effect.ogg",
      "name": "wow effect",
      "id": "68851e0f",
      "mtime": 1465670673,
      "categories": [
        "voice"
      ]
    }
  ]
}

Separating query arguments with a space will perform an AND match, and separating them by a pipe will perform an OR match. This behavior mimics the frontend which does not use the API for this. API calls are time, and time is money.

/samples/[file.ogg] - Obtain sample data.
GET /samples/voice/wow%20effect.ogg

Telegram bot

Setting up a Telegram bot for your own soundboard is as simple as setting the bot's inline url to [your-api-base-url]/telegram.

soundboard's People

Contributors

cascer1 avatar gibibit avatar locitao avatar mesoptier avatar villermen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

soundboard's Issues

Stop all

Because when I loop/spam a lot, I want to be able to stop everything at once.

Maybe with space?

Do titling in JavaScript

Used to be done in PHP:

    $this->boardNames = [
      'music',
      'spam',
      'crack',
      'shit',
      'originality',
    ];

    $this->postNames  = [
      'amirite',
      'correct',
      'no',
      'you see',
      'eh',
      'hmm',
    ];

public function getPageTitle() {
    return 'More like ' . $this->boardNames[array_rand($this->boardNames)] . 'board, '
      . $this->postNames[array_rand($this->postNames)] . '?';
  }

Don't loop samples that aren't looped initially

When playing multiple samples of the same time with Shift, and after that you press one with Shift and Ctrl, all of the previous ones (that haven't yet ended) will be looped. This is because loop is set on the howl property instead of the group.

Theoretically this would be fixed by setting the loop property like this:

    const howlerId = sample.howl.play();
    sample.howl.loop(loop, howlerId);

This will not make the sample loop at all however. I wonder if it might be a bug in Howler.

Show changelog when version is clicked

In a new modal. Obviously polled from GitHub, because then an older version will show newer versions too. A list like:

  • v13.37 - generic sample name
    • Change 1
    • Change 2
  • v13.37 - generic sample name
  • v13.37 - generic sample name
  • v13.37 - generic sample name

Versions are collapsible, and the current one (if available) is expanded by default.

Streaming audio vs fully loading

Streaming is obviously faster, but has the downside that duration isn't accurate. Fully loading enabled modulation (do we need that?), but increases the loading time significantly.

New theme color specification

For applying colors in other places, I was thinking of making the color names more generic:

  • headers-background and text (headers and buttons)
  • input-background and text (search and modal body)
  • body-background, accent and text (for sample container and samples, where sample backgrounds would be accent)
  • footer-background and text (or maybe this could be just the header and input mixed)

Thyme theme needs at least 10% more lime

And then they say it wouldn't make it prettier. 😆

But in all seriousness. MORE LIME UGLIER?!??! SHAME (3x), BELL.

But actually in all seriousness, I want the sample text to be lime too.

Create separate install script/task

Instead of putting everything in postinstall, which is really just for NPM. Especially composer install in postinstall is nasty.

This could be an NPM script (not postinstall), a gulp task, or something else entirely.

Sometimes samples start playing but immediately stop

On both mobile and desktop, and happens arbitrarily. Once in every like 10 tries or so. Does not happen to samples that have already been played, even the once that had this bug occur to. So second click will always play, regardless of whether it errored before. Makes me think it is a howler bug (on 2.0.0-beta14), also happened on beta13.

Do sample sorting in JavaScript

Used to be done with PHP:

    usort($samples, function ($sample1, $sample2) {
      if ($sample1->mtime > $this->sortLimit || $sample2->mtime > $this->sortLimit) {
        return $sample2->mtime - $sample1->mtime;
      }

      return 2 * mt_rand(0, 1) - 1;
    });

Reliably determine id from url

Right now it throws an error because no sample was found with the id.

Best way to solve this, to my knowledge, is by ignoring the result when no sample was matched.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.