TDDung / DelphiFMX-BASS

Delphi's FMX header/wrapper unit for BASS audio library (No add-on).
7 stars 3 forks source link

How to use opus encoding? #1

Closed DRAMA22 closed 3 years ago

DRAMA22 commented 3 years ago

Is there a demo to encode pcm to opus and decode it back to pcm?

DRAMA22 commented 3 years ago

Can this wrapper integrated in vcl project or just fmx?

TDDung commented 3 years ago

My friend, I did not test VCL but a quick review in my head tells me there should be no restriction at all as VCL can easily use Bass's DLL files since VCL is for Windows. It should very easily be tested :)


From: DRAMA22 @.> Sent: Thursday, April 15, 2021 2:34 AM To: TDDung/DelphiFMX-BASS @.> Cc: Subscribed @.***> Subject: Re: [TDDung/DelphiFMX-BASS] How to use opus encoding? (#1)

Can this wrapper integrated in vcl project or just fmx?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/TDDung/DelphiFMX-BASS/issues/1#issuecomment-819779663, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACSODKC32JFA32CZEI4J24TTIXU4LANCNFSM426APZSA.

TDDung commented 3 years ago

I have done that, but for the purpose of distributing the library I only included an extremely simple demo. Do you need PCM-OPUS-PCM demo?

Note: My test with opus is very extensive and multi-platform (FMX) so if you need a demo, I would have to simplify it first 🙂


From: DRAMA22 @.> Sent: Thursday, April 15, 2021 2:30 AM To: TDDung/DelphiFMX-BASS @.> Cc: Subscribed @.***> Subject: [TDDung/DelphiFMX-BASS] How to use opus encoding? (#1)

Is there a demo to encode pcm to opus and decode it back to pcm?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/TDDung/DelphiFMX-BASS/issues/1, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACSODKHBECKJL644GRI3FODTIXUOJANCNFSM426APZSA.

DRAMA22 commented 3 years ago

it would be great from you if you provide how to encode decode pcm audio . i was struggling to find a solution for that for a days

i am coming from kotlin and java background. in kotlin we simply load the opus library and do the encode() / decode()

for example, a brief code from my Android project using kotlin library

opus.Initialize
opus.EncoderInit(opval.SampleRate_16000,opval.Channels_Mono, opval.Application_VoIp)
opus.DecoderInit(opval.SampleRate_16000,opval.Channels_Mono)
opus.EncoderSetBitrate(opval.BitRate_Auto)
opus.EncoderSetComplexity(0)
AudioBytes = opus.Encode(audData, opval.FrameSize_640) ' this will return the encoded bytes
DecodedBytes =  opus.Decode(buffer, opval.FrameSize_640)

didn't find a similar solution for Delphi. I used this library https://github.com/lakeofsoft/vcp in Delphi to get PCM data from the microphone.

but never get success to encode its data with opus the event that holds the PCM data

procedure TForm1.recDataAvailable(sender: unavclInOutPipe; data: Pointer;
  len: Cardinal);
TDDung commented 3 years ago

I know about that VCP library. It is a great one but only for Windows and is not actively developed further. Furthermore, I prefer multi-platform libraries due to modern trends 🙂

Alright, I will see what I can do for you 👌

Ah, BTW, I will post that demo onto GitHub so others can benefit from it.


From: DRAMA22 @.> Sent: Monday, April 19, 2021 12:30 AM To: TDDung/DelphiFMX-BASS @.> Cc: Tran @.>; Comment @.> Subject: Re: [TDDung/DelphiFMX-BASS] How to use opus encoding? (#1)

it would be great from you if you provide hot to encode decode pcm audio . i was struggling to find a solution for that for a days

i am coming from kotlin and java background. in kotlin we simply load the opus library and do the encode() / decode()

for example, a brief code from my Android project using kotlin library

opus.Initialize opus.EncoderInit(opval.SampleRate_16000,opval.Channels_Mono, opval.Application_VoIp) opus.DecoderInit(opval.SampleRate_16000,opval.Channels_Mono) opus.EncoderSetBitrate(opval.BitRate_Auto) opus.EncoderSetComplexity(0) AudioBytes = opus.Encode(audData, opval.FrameSize_640) ' this will return the encoded bytes DecodedBytes = opus.Decode(buffer, opval.FrameSize_640)

didn't find a similar solution for Delphi. I used this library https://github.com/lakeofsoft/vcp in Delphi to get PCM data from the microphone.

but never get success to encode its data with opus the event that holds the PCM data

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/TDDung/DelphiFMX-BASS/issues/1#issuecomment-822028444, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACSODKCC236AHBAB3NKFZS3TJMJLDANCNFSM426APZSA.

DRAMA22 commented 3 years ago

Thank you very much that would be very helpful appreciated

TDDung commented 3 years ago

Here you go: https://github.com/TDDung/DelphiFMXBass-PCM_OPUS