I would like to know how can i use ogg encoding in my masm project.
On vorbis page exists only "c" examples, i would use these functions via dlls.
Posted on 2005-07-13 09:27:08 by s5vi
Plain C is usually easy to convert to ASM, if the distrubtion contains Dlls, Libs and Headers then your first step will be to convert the C Headers to Masm Include files. Then by including the .inc and .lib files in your project you should be able to call the needed functions.

Perhaps someone has already done this, but if you're the first you should (if you like :) ) share your results back with the community.
Posted on 2005-07-13 15:02:18 by Eóin
I have done OGG decoding very long ago (March 2002) and not finished it (buffering issues). The include files though maybe of some help.

You can get it here:

hurry, it won't be there for long
Posted on 2005-07-14 19:30:49 by comrade
I've found another way: via ACM, actually i've not try it, but will
Ti_mo_n and Ultrano mentioned this way here: http://www.asmcommunity.net/board/index.php?topic=21036.msg159418#msg159418
The ogg acm driver is here: http://www.free-codecs.com/download/Ogg_Vorbis_CODEC_for_MSACM.htm
Posted on 2005-07-15 03:35:16 by s5vi

I'd be interested to see what you come up with!  Share if you can.

Posted on 2005-07-15 08:17:44 by farrier
I dig in the web for info, and found that:
In this article i see that, the only todo is to fill waveformatex struct with proper values (regarding chosen acm codec, actually a gsm codec).
I code a simple app previuos, which capture mic input and write data to wav file (standard uncompressed pcm format).
It is true, that the only modifications needed is to change entries in waveformatex????
If acm automatically detect "wFormatTag" id in waveformatex and call the proper codec, it will work ?
If yes the only thing to do , collect some sample waveformatex entries with all codecs (for example ogg acm codec)
Noticed that this is a compressed wav format (wav is a container format, like the ogg ---afaik ogg the container and vorbis is compression----). For example it is possible to create a compressed wav file with various compression methods (mp3,vorbis,speex.....) If acm codec installed the windows can play it automatically (as the uncompressed pcm wav)

Posted on 2005-07-17 13:03:06 by s5vi
the compression/decompresion scheme is as follows:

1) acmStreamOpen
2) acmStreamSize
3) acmStreamPrepareHeader
4) acmStreamConvert
5) acmStreamUnprepareHeader
6) acmStreamClose

Data compressed/decompressed :)

Note that 99% of all codecs can compress ONLY from PCM  and decompress ONLY to PCM (which is actually what most ppl want to do).

You can easily get VERY PROPER data for WAVEFORMATEX by using acmFormatChoose, manually selecting it, and storing the WAVEFORMATEX somewhere. In my thread, you mention here, there is an example attached. Unfortunately Ultrano mentioned that it doesnt work on his machine. Nevertheless - you can see the source code and learn what you can.

Good Luck
Posted on 2005-07-17 13:40:32 by ti_mo_n
Oh that problem was easily solved. I noticed all my audio codecs were gone, after an uninstallation of a codec pack. Even the ADPCM (provided by Win32 by default) was gone lol.
All is fixed now :)

I just wondered one thing - how from an .ogg to easily get a waveformatex. Compressed .wav files store that header, but not anyone saves in .wav ^^". But that's not anymore a problem for me - I'll just use compressed .wav in my software :)
Posted on 2005-07-17 14:45:25 by Ultrano
Ti_mo_n , i'm sorry , i confirmed your app ( acm_test_04-exe ) is crash in winxp when i select output format (illegal access of mem)
Your app is great to display and save waveformatex....
Anyway i found an ms app with source which is do that (convert acm wav formats) i upload here:
So i can easily produce various compressed wav file and analyze waveformatex.
My goal is to record conversations (speech) as high compression rate as possibble without big quality loss.
I found some acm drivers for it:  gsm - embedded in winxp, and speex (opensource) ogg also works but not too high compr. rates as speex.
I will change saved waveformatex in my app.........i will report to you within some days.....
Posted on 2005-07-17 15:05:01 by s5vi
with msacm app i can create vorbis compressed wav file:
uncompr size=263k , compressed=29k, winamp plays both, differences not heard.

I realized that: WAVEFORMATEX.cbSize in PCM formats is 0
But NOT pcm formats is indicates the nuber of extra bytes required by acm codec!
In case of Ogg/Vorbis is 8, in case of GSM is 2. We must fill this extra bytes with proper info.
(can be ripped from wave file)
We must define new strutc for it (waveformatex+extra bytes) and pass this new struct to waveInOpen func.
useful link for compressed wav formats: http://www.kk.iij4u.or.jp/~kondo/wave/wavecomp.htm
Posted on 2005-07-20 09:03:09 by s5vi
Well, I -indireclty- told you that in my first post ;) My app saves WAVEFORMATEX including the extra bytes. if I get some time, I'll re-code it quiclky in C++. It should work on all machines then.

BTW: for PCM format, the cbSize doesn't have to be 0 -- it's ignored.

PS: ACM works sweet with DirectSound :)
Posted on 2005-07-20 10:38:29 by ti_mo_n
Could anybody help me: I got problems using static ogg library, I get these errors during compilation:

LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
LIBCMT.lib(a_env.obj) : error LNK2001: unresolved external symbol __imp__GetEnvironmentStrings@0
ogg-test2.exe : fatal error LNK1120: 2 unresolved externals
Posted on 2005-07-21 18:12:20 by valka
Succes at last!      i can capture audio into wav and via acm into gsm (or any other format which acm codec installed)

I was a dumbass:

wrong:invoke waveInOpen,addr hWaveIn,0,addr pFormat,hWin,0,CALLBACK_WINDOW

good:invoke waveInOpen,addr hWaveIn,WAVE_MAPPER,addr pFormat,hWin,0,CALLBACK_WINDOW

Strange thing: i use 0 as wave_mapper device and it works when i grab into pcm. But dont work if i grab into gsm.  Capturing into non-pcm requires WAVE_MAPPER intsead of 0 ????

There is one more problem : write wav file (i miss fact chunk, this is not necessary for pcm files)
In compressed wav file there is MUST be a fact chunk. I work on this.....then will post assembly source......
Posted on 2005-08-22 14:13:29 by s5vi
My SimpleRec is fully working.....

Look at source and sample compressed wav files:

This version can capture audio and store data into compressed wav file (currently GSM)
But if you change waveformatex declaration and contents you can use any installed compression codec.....
Posted on 2005-08-28 14:07:15 by s5vi
what kind of latency do you get? Done any tests of how latency settings affects compression rates? How's the processor usage? :)
Posted on 2005-08-28 14:13:02 by f0dder
At the moment i play only GSM codec.....
I think you ask latency regarding ogg compression codec....( i will try it within some days )
New upload today(aug.29), chunk order now correct (riff,wave,fmt,fact,data)

Posted on 2005-08-28 14:16:40 by s5vi
I try it with speex codec and it produced very small file, speech quality good but effect/music very bad.
I tried the lowest quality/size.
This ver can record pcm,gsm,speex (if you modify source)(dont forget this is a simple rec)
It is possibble to make codecs selectable by user.......

Posted on 2005-08-29 09:05:34 by s5vi