Giter VIP home page Giter VIP logo

dca's Introduction

DCA

Go report Build Status

dca is an audio file format that uses opus audio packets and json metadata.

dca files are designed to be easily sent directly to Discord with minimal additional processing. dca files may also be suitable for any other service that accepts Opus audio.

For help with this program or general Go discussion, please join the Discord Gophers chat server.

What's here?

This repository hosts the official specification for dca and an example implementation of the DCA0 specification.

Official Specifications

Implementations of DCA

Each of these implementations have their own unique differences. It is recommended to review and evaluate each of them to decide which one fits your needs best.

Name Lang
dCa C
dcad D
dca Go
dca Go

dca's People

Contributors

bwmarrin avatar joaopms avatar jordhan-carvalho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dca's Issues

Add support for calling dca with a URL

ffmpeg can be called with a url and so dca should allow that as well :)

Add some code to parse the input and if it looks like a valid URL then skip the file check.

FFmpeg Volume option

Would be good to have a volume option for FFmpeg.

Possibly also a way to pass through a string of parameters to FFmpeg.

DCA2 Specification

Topics for discussion:

  • Duration metadata
  • Creation of a seek table for easy seeking in the file
  • Creation of a system that will allow for easy backwards compatibility for possible future versions of DCA

Metadata

We've discussed on Discord that DCA files should contain metadata as the first packet - the very first byte will specify the metadata length and the rest of the first packet will contain a JSON of the metadata. Then, starting with the second packet, opus will resume as normal. Here are some metadata fields I propose:

  • version - a number that gets incremented every time something changes in the actual DCA file format, starts at 1
  • rev - a specifier that determines which revision of dca was used to generate this (for example bwmarrin/dca#32361ee92fcbd0e404b2be18adf497a45fef4a5f)
  • tool - if a separate tool was used to generate this DCA file, this field contains information about what tool and the revision in the same format as rev
  • source - where this DCA file was generated from (file, stdin or other things in the future)
  • abr - the audio bitrate in kbit/s
  • url - if the track was downloaded from somewhere, the URL where it can be found
  • title (self-explanatory)
  • author (self-explanatory)
    Furthermore, the y- prefix can be reserved for information copied over from youtube-dl's JSON file, and the x- prefix can be reserved for other fields the particular tool/library needs.

Added in response to 188480082 and 189713886:

  • sample_rate - Opus audio sample rate in kbit/s
  • application - Opus audio application - voip/music/lowdelay. I chose application over mode because it's more commonly used everywhere else
  • vbr - Opus variable bitrate setting
  • frame_size - Opus frame size in bits
  • channels - Number of audio channels
  • album/genre/track_num (self-explanatory)
    As for ffmpeg metadata, maybe an f- prefix for those specific fields?

All of these are just suggestions and most are probably useless, please suggest others and comment on existing ones!

Opus -> PCM

Would be good to have Opus to PCM16 conversion (mainly so I can implement audio receiving into my lib and have full features ❤️ ) so the user can do anything with that (save it, convert it to another format like MP3 etc.)

Missing metadata error

(Using Go for Windows x64)
There seems to be issue when audio file doesn't have the ID3 tags.
For command dca -ab 96 -i "D:\01 - Bubblegum Bitch.flac" > D:\file.dca, where input is set to file converted from the CD. Shell is empty and resulting file.dca is regularly playable in Discord.

For command dca -ab 96 -i "D:\01 - Bubblegum Bitch_nometa.flac" > D:\file.dca, where input is set to file with removed ID3 tags. The output is 0Byte file.dca and shell output is:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x0 pc=0x40357c]
goroutine 1 [running]:
panic(0x5ad020, 0xc082008080)
C:/Go/src/runtime/panic.go:464 +0x3f4
main.main()
C:/Go/src/github.com/bwmarrin/dca/cmd/dca/main.go:239 +0x1d3c

I'd say, if dca requires these metadata, they should set to something if empty instead of ignoring the file completely. I wanted to use dca for files uploaded by other people, thus I cannot really change metadata for them without using another 3rd party tool.

Playing mp3 from uri stream

I'm trying to play mp3 file from url. But i hear only noise. If i download file from this url and try play it with VoiceClient->playFile method then it's work. Can i play this file from stream? Sorry for my broken english.

$this->discord->getVoiceClient($channel->guild_id)->then(
    function (VoiceClient $client) use ($bot, $channel, $url, $message) {
				
        $client->setVolume(30);

        $resource = fopen($url, 'r');

        $client->playRawStream($resource)->then(function () use ($bot, $channel, $message) {
            //...
        }, function (\Exception $e) use ($bot, $channel, $message) {
            //...
        });;
});

Ship DCA with binaries

Would be awesome to be able to ship DCA with binaries. Would make it a lot easier to install.

I'm able to build it on:

  • Mac 10.11.2
  • Ubuntu 14.04.3

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.