Jump to content
Sign in to follow this  
Skullcode

how to use this wrapper of opus ?

Recommended Posts

I have found this wrapper for opus encoding and decoding 

 

https://github.com/DelphiForAudio/delphi-opus-wrapper

 

but I am confused on how to use it to encode/decode PCM audio data 

 

here is my PCM data coming from 

 

procedure TForm1.recDataAvailable(sender: unavclInOutPipe; data: Pointer;
  len: Cardinal);

begin

// I am not sure how to encode the data and its length using that wrapper 

// the example shows encoding decoding to wave files not directly to TBytes

end;

 

Share this post


Link to post
Guest
1 hour ago, Skullcode said:

I have found this wrapper for opus encoding and decoding 

https://github.com/DelphiForAudio/delphi-opus-wrapper

but I am confused on how to use it to encode/decode PCM audio data 

That wrapper looks fine and should do the job.

 

I suggest to refer to Opus documentation https://opus-codec.org/docs/opus_api-1.3.1/index.html 

As you can see in encoding process "Detailed Description" section, here https://opus-codec.org/docs/opus_api-1.3.1/group__opus__encoder.html

It that section you just need to use the explained functions, but keep in mind the following

1) in that event only one function will be used which is opus_encode (you might want to stay away from opus_encode_float ), the others should be called before encoding process, of course opus_encoder_destroy should be called later

2) most LakeOfSoft components events are being called from a background thread, so keep that in mind, this library has very powerful multithreaded engine.

3) from my experience you are better with 48kHz for quality and compatibility with most sound card drivers if not all.

4) the available frame sizes are explained specifically for 48kHz but can be calculated them for any PCM input rate, but i recommend to use 1920 as you will have 25 frame per second, or 960 for 50 frame per second while packed them in bulk based on the network responsiveness, so feel free to choose what does fit you the best.

5) also keep in mind that input of 48kHz is irrelevant to the output quality but will guarantee the best possible result for your output quality based on chosen output rate.

6) i also used constant bitrate to maintain the best transport socket quality, but that was for very old and not very stable networks, now i think you might be OK with VBR, for that refer to the CTL code for the encoder, and try for your self.

7) using DTX mode is very powerful for voice conversation, but it will require special attention for when to nullified packets, but reading the documentation now i see it is somehow very different from what it was few years back.

 

Last thing, good luck.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×