Giter VIP home page Giter VIP logo

Comments (4)

Rantanen avatar Rantanen commented on August 23, 2024

Not really sure of what you're trying to do. The following code might be helpful. Note that opus doesn't define a binary encoding for the stream so trying to write it to a file as such is probably not something you want.

"use strict";

var lame = require( 'lame' );
var opus = require( 'opus' );

var mp3Decoder = new lame.Decoder();
var opusEncoder = new opus.Encoder( 48000, 2 );

var output = process.stdin.pipe( mp3Decoder ).pipe( opusEncoder );

output.on( 'data', function( packet ) {
    console.log( console.log( packet ) );
});

from node-opus.

izy521 avatar izy521 commented on August 23, 2024

Ah, well right now I'm attempting to package opus data into an RTP packet, but I'm just trying to get the data from an mp3 file to the opus encoder first, and oh my god thank you. I think this is exactly what I needed.

from node-opus.

Rantanen avatar Rantanen commented on August 23, 2024

Ah, good. Yes. For that the above code should work. The audio data for each opus frame can be read from the output-data packets.

from node-opus.

izy521 avatar izy521 commented on August 23, 2024

I'm sorry, it all seems to be working now, but I get very distorted audio on the server. I'm told I'm supposed to be using 20ms frames and I think that might be the issue because I can't find anywhere that I can define that. I tried typing 20 within the frame_size argument area, but apparently that's meant for something different? Do I handle this on my part or is there something I'm missing?

Edit: Nevermind, corrupted packets, bad coding on my part.

from node-opus.

Related Issues (20)

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.