Skip to main content

Audio Processing Server

Project description

Cyberpunk

Audio Processing Server

GitHub GitHub Workflow Status

Run on Google Cloud

Quick Start

docker run -p 8080:8080 -e PORT=8080 ghcr.io/jonaylor89/cyberpunk:main

Original audio:

https://raw.githubusercontent.com/jonaylor89/cyberpunk/main/testdata/celtic_pt2.mp3

Try out the following audio URLs:

http://localhost:8000/unsafe/https://raw.githubusercontent.com/jonaylor89/cyberpunk/main/testdata/celtic_pt2.mp3
http://localhost:8000/unsafe/https://raw.githubusercontent.com/jonaylor89/cyberpunk/main/testdata/celtic_pt2.mp3?reverse=true
http://localhost:8000/unsafe/https://raw.githubusercontent.com/jonaylor89/cyberpunk/main/testdata/celtic_pt2.mp3?slice=0:10000
http://localhost:8000/unsafe/https://raw.githubusercontent.com/jonaylor89/cyberpunk/main/testdata/celtic_pt2.mp3?reverse=true&repeat=1&slice=1000:5000

Cyberpunk Endpoint

Cyberpunk endpoint is a series of URL parts which defines the image operations, followed by the image URI:

/HASH|unsafe/AUDIO?slice&concat&fade_in&fade_out&repeat&reverse&filters=NAME(ARGS)
  • HASH is the URL Signature hash, or unsafe if unsafe mode is used
  • slice
  • concat
  • fade_in
  • fade_out
  • repeat
  • reverse
  • AUDIO is the audio URI

Cyberpunk provides utilities for previewing and generating Cyberpunk endpoint URI, including the cyberpunk_path function and the /params endpoint:

GET /params

Prepending /params to the existing endpoint returns the endpoint attributes in JSON form, useful for preview:

curl "http://localhost:8000/unsafe/celtic_p2.mp3?reverse=true&repeat=1&slice=1000:5000"

{
  "path": "/celtic_p2.mp3?reverse=true&repeat=1&slice=1000:5000"
  "audio": "celtic_pt2.mp3",
  "hash": "=",
  "reverse": true,
  "repeat": 1,
  "slice": {
      "start": 1000,
      "end": 5000,
  }
}

Features

  • Audio Streaming

  • Change encodings (e.g. mp3 -> wav)

  • Audio slicing

  • Change Volume

  • Concat Audio

  • Repeat Audio

  • Reverse Audio

  • Crossfade

  • Fade in/out

  • Audio Quality

  • Audio Tagging

  • Audio Thumbnails

  • Mastering Music

  • Sound/Vocal Isolation

  • Cool ML Stuff

  • File Caching

Storage Options

  • Local
  • Cloud (e.g. S3)
  • Blockchain (Audius)

Environment

PORT: 8080 # server port number

CYBERPUNK_SECRET: mysecret # secret key for URL signature

AWS_ACCESS_KEY_ID: ...

AWS_SECRET_ACCESS_KEY: ...

AWS_REGION: us-east-1

AUDIO_PATH=local:s3:audius:http

STORAGE_BASE_DIR=testdata/

RESULTS_STORAGE_BASE_DIR=processed/

S3_LOADER_BUCKET=mybucket

S3_LOADER_BASE_DIR=audio/

S3_STORAGE_BUCKET=mybucket

S3_STORAGE_BASE_DIR=audio/

S3_RESULTS_STORAGE_BUCKET=mybucket

S3_RESULTS_STORAGE_BASE_DIR=audio/results

Docker Compose Example

Cyberpunk with file system, using mounted volumn:

version: "3"
services:
  imagor:
    image: jonaylor/cyberpunk:main
    volumes:
      - ./:/mnt/data
    environment:
      PORT: 8080
      AUDIO_PATH: "local"
      FILE_STORAGE_BASE_DIR: /mnt/data/testdata/ # enable file storage by specifying base dir
    ports:
      - "8080:8080"

Cyberpunk with AWS S3:

version: "3"
services:
  imagor:
    image: jonaylor/cyberpunk:main
    environment:
      PORT: 8080
      CYBERPUNK_SECRET: mysecret # secret key for URL signature
      AWS_ACCESS_KEY_ID: ...
      AWS_SECRET_ACCESS_KEY: ...
      AWS_REGION: ...

      AUDIO_PATH: "s3"

      S3_LOADER_BUCKET: mybucket # enable S3 loader by specifying bucket
      S3_LOADER_BASE_DIR: audio # optional

      S3_STORAGE_BUCKET: mybucket # enable S3 storage by specifying bucket
      S3_STORAGE_BASE_DIR: audio # optional

      S3_RESULT_STORAGE_BUCKET: mybucket # enable S3 result storage by specifying bucket
      S3_RESULT_STORAGE_BASE_DIR: audio/result # optional
    ports:
      - "8080:8080"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cyberpunk-0.2.3.tar.gz (11.7 kB view hashes)

Uploaded Source

Built Distribution

cyberpunk-0.2.3-py3-none-any.whl (15.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page