ifvictr / iora

🔊 Listen to music generated from new tweets on Twitter

Home Page:https://iora.live

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iora logo

Listen to music generated from new tweets on Twitter.

iora screenshot

Iora is inspired by @debugger22’s GitHub Audio. I had it playing in the background at one point while working on this. 😄

How it works

Each incoming tweet is converted into a note and duration pair. There are five different types a tweet can be classified as: new tweet, retweet, reply, poll, and media (images, videos, GIFs), and a note is assigned according to that. The duration is calculated by dividing the tweet length by 70 (the amount of characters per fourth of a tweet at max length).

Deploy

Deploy

Setup

Iora is composed of three components:

  1. A Twitter app registered through the Twitter Developer Portal, which is used to access data from the platform
  2. A Node.js WebSockets server which interfaces with Twitter’s stream API via a long-lived HTTP connection. Received messages are re-broadcasted to all connected clients as WebSocket messages. This is necessary because Twitter restricts apps to one concurrent connection.
  3. A React.js frontend for music generation and displaying received data

Creating the Twitter app

  1. Go to Twitter’s Developer Portal and create a new app. Make sure the app is compatible with Twitter’s API V2.
  2. Go to Keys and tokens and note down the value of Bearer token.

Environment variables

Here are all the variables you need to set up on the server, with hints.

# Port to run the server on.
PORT=3000

# The URL to prepend to all built assets that'll be served.
PUBLIC_URL=https://iora.live
# Obtained from the Twitter Developer Portal.
TWITTER_BEARER_TOKEN=AAAA…

Starting the server

This section is only relevent to you if you’ve decided to run Iora on a platform other than Heroku.

git clone https://github.com/ifvictr/iora
cd iora
# Install dependencies
yarn
# Start Iora in production! This will build the source files and then run them.
yarn build
yarn start
# Or, if you need to run it in development mode instead. This will start both the backend and frontend and run them concurrently.
yarn dev

After you’ve followed all the above steps, you should see something like this in the console:

Starting Iora…
Listening on port 3000
Connected to Twitter stream

License

MIT License

About

🔊 Listen to music generated from new tweets on Twitter

https://iora.live

License:MIT License


Languages

Language:TypeScript 95.5%Language:HTML 4.5%