Vorbis audio decoding implementation

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

Vorbis audio decoding implementation

Postby ddantoni » December 1st, 2005, 9:09 am

Hi,
i'm currently implement ogg vorbis real time decoder.
For that, i wrote a ToggVorbisStream that extends of TWave.
I overrided Read And Seek methods and decoding and playing sound is ok.

But I was obliged to modify TStockAudioPlayer.GetWaveFormat to get the wave format of my ogg file.

So, Kambiz, I would like change TStockAudioPlayer or descendants so that all that relates to the wave is managed by a TWave or TAbstractWave or an interface for wave objects with methods: ReadWaveData, WriteWaveData, SeekInWave, and LoadWaveFormat, and possibly Open and Close that can be called from MMIOM_OPEN and MMIOM_CLOSE.
Not Read and Write because it oblige to override it, put decoding code on it and write InternalRead, ... to read the real stream (ogg vorbis file).
Obviously, in this case, ReadWaveData will must call directly TWave.Read.

Firstly, I overrided UpdateDetail (i was obliged to put private variables of TWave to protected) but I realized that this method was not used: only TStockAudioPlayer.GetWaveFormat was used.

I hope so we will be able to change it.
Thanks
David
ddantoni
Active Member
Active Member
 
Posts: 7
Joined: October 5th, 2004, 10:52 am

Postby Edwin » December 1st, 2005, 9:34 am

Hi David,

What is a ogg vorbis real time decoder?
I am using the GSM codec. For that I made a TCompressedPlayer using TLiveAudioPlayer and a TCompressedRecorder using a TLiveAudioRecorder.
There is no need to change WaveAudio components for that, although it would be nice that inherited components for the use of CODECs will be added to the pack. : )
With kind regards,

Edwin
User avatar
Edwin
Active Member
Active Member
 
Posts: 18
Joined: November 18th, 2005, 11:57 pm
Location: Breda, NL

Postby ddantoni » December 1st, 2005, 10:02 am

Hi Edwin,
ogg vorbis is a codec like mp3 (www.vorbis.com) and his advantage that API is more simple to use that mp3 (mpglib+lame) and the same api can encode and decode, and propose static library. Moreover, I use voice encoding and mp3 with bad quality posed many problems to me.

I ve to say by real time the fact of decode compressed file on mmio demand and not decode the entire ogg file to put decoded wave data to twave object.
(realtime, I think that it's you do)

Indeed, we can use TLiveAudioPlayer to do that but I think that is better to use a class that do interface between wave data and playback, moreover, seeking and wave writing is already wrote in pack.

Thereafter I want to write encoding by overriding Write method or other if modification.

PS: Excuse by bad english, I am French student.

David
ddantoni
Active Member
Active Member
 
Posts: 7
Joined: October 5th, 2004, 10:52 am

Postby Edwin » December 1st, 2005, 3:08 pm

If ogg vorbis is installed can you find it in the list of audio codecs and
are you using the following MSAcm functions?

acmStreamOpen
acmStreamSize
acmStreamPrepareHeader
acmStreamConvert
acmStreamReset

I think CODEC functionality has to be added to TWaveAudioOut:
TCODECAudioOut = class(TWaveAudioOut)

Since TStockAudioPlayer is inherited from TWaveAudioOut, TCODECAudioOut can be used to make a TStockCODECAudioPlayer
TStockCODECAudioPlayer = class(TCODECAudioOut):

For realtime puposes:
TCODECAudioPlayer = class(TCODECAudioOut)

Would be great, isn't it? :D
Edwin
User avatar
Edwin
Active Member
Active Member
 
Posts: 18
Joined: November 18th, 2005, 11:57 pm
Location: Breda, NL

Postby ddantoni » December 1st, 2005, 4:36 pm

Edwin,
I don't use acm, now I use dynamic libraries(dll) and thereafter, I want to use static libraries (lib or obj) to produce only one exe (without dll or acm that i beleive must be installed).

Indeed, there is two point of view but I insist, if we separe audio data (WaveStorage) and audio playing (other files), as It's already done at 99%
(1%=TStockAudioPlayer.GetWaveFormat that use GetWaveAudioInfo directly without use TWave Stream), and if audio data class (Twave) is modify to use codec,
we will be able to create, only one object that herit of Twave or IAbstractWave to do encoding, decoding and seeking, and also we will be able use this object in all Players (TAudioPlayer and TStockAudioPlayer, idem for recorders).

Add to this, we will also add a RegisterClass system that can purpose to TAudioPlayer and TStockAudioPlayer to chose between wave or differents codecs installed in delphi).

The "problem" is that TStockAudioPlayer was wrote to use every type of stream directly, and not Twave and TWaveStorage only.
So, if somebody use TStockAudioPlayer without use Twave or TWaveStorage object, it's can be a problem to change it.

Now, we must to wait for Kambiz reply, only the boss can tell us how we can do. :lol:

:D David
ddantoni
Active Member
Active Member
 
Posts: 7
Joined: October 5th, 2004, 10:52 am

Postby Kambiz » December 2nd, 2005, 10:53 am

Well, modifing TStockAudioPlayer is not a good idea at all. You should subclass either TStockAudioPlayer or TWaveAudioOut to create your own class.

In my opinion, the best choice is subclassing the TWaveAudioOut class.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby azing010 » March 15th, 2007, 3:43 pm

will using ogg format instead of pcm reduce the delay on TliveAudio components? where did the delay comes from, is it with the coding? how can the delay be reduced?

lotsa thanks..

az
azing010
Member
Member
 
Posts: 4
Joined: March 15th, 2007, 2:08 am


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 2 guests