Well it's just a simple example which records mic input and saves it as a wav file. I hardcoded the 16bit, stereo, and 44.1khz flags but those are easily changed. I just wanted to keep the example as simple as possible.

Also, I added a readme to the zip but no comments in the source since it's so basic. If anyone needs comments though I'll add some.
Posted on 2002-01-07 20:39:32 by Will
Thanks

or better cool :-)
in this moment im thinking if i should code a small tool to speak cheap with my friends over the net with your function.
simple client/server to transfer zip with wav.....
last this sounds like the start of a simple voice chat.

and i wanted to go to bed first :-)

ps: i test vote ;-)
Posted on 2002-01-07 21:16:57 by Max
You're awfully welcome. I'd like to whip up a couple of more mci examples to post as well.

If you do code that voice chat app I'd love to take a look at it. But as far as compressing the wav before you send it.....you may want to record at a lower quality to bring down the file size first. Then maybe convert it to mp3 (though to do it in asm would be a challenge) instead of zipping it. Just for grins I used the example I posted to record a 615kb wav. Zipped w/ max compression it came to 163kb. Converted to mp3 (128kbps, 44khz) it came down to 57kb (unzipped). And that's without changing the quality level of the original wav at all. You could speak for about 20 secs, save the wav, convert it to mp3, send it, and 57kb wouldn't bog any connection down. Sounds great to me. Although the mp3 conversion is easier said than done I think.
Posted on 2002-01-08 12:07:26 by Will
Hi!

Maybe you can use J?rgen Ibsen's aPLib compression library....or JCALG1 by Jeremy Collake. I believe there is an example using aPLib included with the masm32 package. That would be a lot easier!


/Delight
Posted on 2002-01-08 13:43:02 by Delight
Hossa

i have a small beta finish ,if you like to test it send me a message :-)
in the moment the tool is split in two files ...server/client.
if you and me have booth running whe can send small messages like icq and after i found your snippet whe can talk ,i hope that all works like on my pc...i will make a small beta test with some of my friends today :-)

personal i know : yesterday it works ,today not.
hehehe ,so im looking forward to the beta test.

for packing i want to use "pkzip.exe"
if you pack a 1.5 mb bitmap you get a 40kb packet file.
"pkzip.exe" has 24kb size so you can insert it easy as resource and then stream it to c:\temp for packing
to unpack you need pkunzip.exe.

better where when i can youse jpg....but i dont have the time to learn how to implement jpg.

next i would insert a notify if user is online so you dont have to send emails with the ip first.
i think i mail nocturnal and ask him if he like to help me on this ;-)

thats why i love OPEN SOURCE !
some code a function ,you grab it and code some other stuff to it then you make it open source and another one grab it and so on and so on.......
only those : keepers of the code or master of talking nonsens
make open source growing slow !

at last some people here in this board.
they mean if they dont speak about something it will be gone from this world ,or if there is a explosion they can say : whe have nothing to do with this ,only that whe do nothing against it.

but thats another story :-)

many thanks for the tip with the mci !!!
some time asm is more then easy :-)
try the same stuff with delphi.

more people need to know this.....
Posted on 2002-01-09 07:54:30 by Max
Max, keep in mind that the zip algo (or probably most any compression algo) doesn't compress all files at the same ratio. For example, if the file is already compressed (i.e. a wav file) then it can't be compressed as much as an uncompressed file like a big text file or something. A bitmap compresses much smaller then a wav file. If you're dealing with users with a good connection (sadly not me) then it won't affect them much but I'd think that compressing it to mp3 before sending would be preferrable(sp?). Although that's not an easy task. Using pkzip or something similar is an easy alternative though since you can shell to it with cmd line params (at least the last time I used it). Just make sure that everyone using your program has it.

For the online notification issue.... Can't you just set up a listening port on the server on startup, and have the ...... Nevermind, I just realized that you might not have a static ip so that wouldn't work. Hmmm.... Other than setting up a website and setting up your client to send its ip to it when the client is started, and then having the client get the list (cgi get maybe?) I can't offer any help. That would work theoretically though eh?

btw what's "Hossa" mean?
Posted on 2002-01-09 12:58:51 by Will
Hossa (in another language and another time this means Hi or Hello) *bg*

sorry for the late reply but i sleep a whole day after coding a whole night ..im getting older :)

youre right with the compression of wav files ,i simply forget that they are compressed as wav :-)
hm possible i can use a driver from the system to recored the wav.....i remember i use in delphi such a driver..1minute is 150 kb size.
but i need to remember the name of the driver first or fid my delphi source cd.....grmbl.

when server/client connects i check if the user has enabled zip plugin ,if booth have it i use it.
if not ,normal wave will use.

i use at this time a single server and a single client ,so if you like to get incomming messages or voices you must start the server ,if you only like to talk to someone just open the client.
i think so noone has a security problem running all the time a server.

next i need to change that you dont need to be connected to send messages.
my idea is ,if you start the tool it read infos from a cgi where is online and write himself to the online list.
if you press now on a name in the list ,you can send a msg or voice msg.
your client connect the server ,send stuff and disconnect when you get all successfully.

since this is my first network app i get everyday another problem i didnt think of first.
first i want to make a simple tool to talk to my friends ,now i want to make it free for all........
that need a real working tool without bugs and much more features and more handle of connections at the same time.

the biggest problem is that im to lazy to code a file transfer function so i start using a old trojan source.
now i need to delete all strings and so on....so av soft will never call my app as possible trojan xyz.

i come back at monday here and i hope i can post a working version what works for more then two users :-)
Posted on 2002-01-11 02:42:10 by Max
Just some pointers that may help :

Wav isnt (in its normal form) compressed.

Mp3 would be a better compression method , but why not take a look at ogg ( http://www.vorbis.com/index.psp ) - you should be able to get good speech quality at 16 to 24kbits !! which would enable almost no delay on modem setups therefore it would be like talking on the phone.

I beleive its free and they have an api for programmers on their web page.Its a newer compression designed to beat mp3 especially on lower bitrates.Go for it!

BUT if you want to stick with Mp3 then go for Lame, it decodes and encodes quick, has an api and produces good quality through use of variable bit rates as i think ogg does too.

ie if you pause during talking it will use low bits because of a flat sound wave, it can then use the extra bits to get better quality when ur speaking thus averaging around the required bandwidth eg 24Kbits.

Heck if you want to be really clever you could scan the wav data easily and check for values close to zero over a susatined period ( eg > 0.1 sec ) and completely zero them, thus helping the compression algorythms further. This would apply to both mps and ogg.

goodluck and keep us up to date, I'd like to try it with distant family, friends.

Byee.
Posted on 2002-01-11 03:08:18 by trancera
Good info trancera. Thanks for the correction about the wav format. It's definitely uncompressed raw data. I'll be playing with lame and ogg over the weekend. :)
Posted on 2002-01-11 11:04:58 by Will
aPLib might be better than zip, but it still wont get nowhere
near mp3 compression. There are big differences between generic
lossless compression (aPLib, zip, rar, whatever) and specialized
lossy (mp3, jpeg/mpeg, whatever).

Also, you can take a look at the LAME mp3 coder... it's available
in DLL form, which you should be able to plug directly into your
asm code. It's already used by a few realtime projects, I think.

Max, how would you "stream" pkzip/pkunzip? I don't think any of
them allows using stdin/stdout... your method definitely wouldn't
be realtime. It would be quite clunky :). And embedding pkzip/pkunzip?
Icky icky! (If you really want to use zip for this, at least use
infozip or zlib...)

Wav files are not usually compressed (well, WAV is just a container
and can really contain just about anything, but usually you're dealing
with 16bit 44khz stereo uncompressed PCM data). The reason typical
compression algorithms doesn't compress this well, is that they work
on repetitous byte/bit strings. Sound data is based on oscillations
from a "base level" or "neutral level". Think about wave data as +/-
stuff that makes the membrane in your speaker swing.

As trancera notes, you might want to go for OGG. OGG is free, while
MP3 these days require licensing if you want to use it. Dunno how
their policy is to freeware stuff, though.

There, hope I added a few new things to the thread, and that I'm not
too flawed =).
Posted on 2002-01-11 13:57:22 by f0dder
Hossa

thanks for the help :-)
i now use WMA !
700KB wav = 11kb WMA clear quality !!!

but for now im searching since yesterday night a way to play my x#X!?#X wma file *grmbl*
i use mci play ....waveaudio i cange to mpgvideo2 .like the wma settings in my system.ini
but it wont play.

any ideas how to play wma files ?
i can use shellexecute to open the wma ,but then media player pop ups and thats not what i want :-)

if someone like i post today a beta of SmallTalk.

Ps : i seach my system for files containing the word : waveaudio
then i found win.ini
inside a entry
wav=waveaudio
and
wma=MPEGVideo2

since i have to use waveaudio to play wave files with the mci ,i think i need to use now MPEGVideo2 to play a wma file.
but it wont work..........i only hear the MessageBeep :-(



PS 2:
-----------
Max, how would you "stream" pkzip/pkunzip?
-----------
sorry i wrote a translation error ,i mean not stream to other users ,i mean "extract" the zip file from resources to the user hard drive :-)
like i use zip.exe as zip.bin in resource.
Posted on 2002-01-14 05:56:26 by Max
Max, it would be better to use LAME (for mp3) or perhaps Ogg Vorbis.
Recording a file, sending, playing... there will be so much lag in this
approach that it will be hard to keep up a conversation. Also, it will
be in the form of "press a button to record / say a sentence / press
button to stop recording / send". That will feel weird :). With LAME
(and possible Vorbis), it's possible to stream the data.

Yes, this will take more coding, and you probably cannot use MCI
to do the playback. But the end results will be so much better.
Posted on 2002-01-14 06:03:26 by f0dder
Hossa Fooder

WMA can also stream :-)
i can send it from the converter direct to the user.
take a look at the windows media encoder.
the size of the converter is 860kb ,after upx take a look at it its only 320kb.

so at this time you press the button for record ,then stop and seconds later you have the voice.
i test it with "dsl" users on normal wav (11khz 8bit mono) and the transfer is much fast on this big files.

i test this night a lot functions on the media encoder and encoding a 1mb wav take on my 600mhz pc only 1 sec.

so lets say you record 1 minute.
1.save wav to hd
2.open windows encoder with batch settings+start convert

that takes 1or two seconds on my system.

3.transfer file to user+check if file is ok(crc)
4.pop up dialog+play voice

here its important that the user have fast connection or the filesize is small.

when i use wma i can mix after step 2 ,step 3+4 to one step.
like:
3.send file to user and create a short buffer (lets 10% of the filesize) and start directly the playback.

i take a look at ogg ,but im not familiar with C so it wont help me.
the lame dll has a big filesize and what when later times the author think of a registration ?
if i use WMA from "microsoft" i have the right to use it as long as i own windows :-)
thats simple and im shure the most users today can playback WMA ,so i dont need a new driver or something else.

last after i see the filesize and hear the sound quality ,i wont use anything other then wma :-)
the goal is also its streamable.

but hey :-)
first i start with a simple idea of connecting two users and let them talk ,now it looks and sounds like a big project.
if its a simple tool ,then it dosnt matter how long the transfer needs ,whats better fast phone with high bill or slow talk with no bill (because most have Flat Rate) ?

but im very happy that others take interrest and try to help :-)

if you dont get mad by watching my code i would happy if others join and whe can build up a team to make SmallTalk better and for more users useable.
last it would be a good thing for this community to talk cheap ,or :-)

and hey whats when whe release it for free for all the other user ?
think of the fame "ASM" will become.
today all other voice communicators i found are big and most they spy on the users.
think of the multiplayer community, im shure they like to get a small takling tool for better gameplay.
if the game companys are not able to code such a tool ,why should whe not do it :-)
look at gamespy or mplayer.com and you see what i mean ,ugly voice chat and last it takes hours to send my speach.

the project status is at this time:
1.client
2.server
the ready tool has booth in one tool ,i need it for testing and learning as two files for now.

functions:
send text message
send voice message
send a file
record voice
play voice
set/get wav volume
set username
check if client/server are from same version (blocks hopefull scanning script kids)

what i plan to insert next:
decrypt the text before i send it
convert wav to wma
stream wma to user
let user connect to a webservr with database of online users and ad him there

and last...do all the style stuff.
at now i do more like this :
at day i fix all bugs i typed in late nights ,hehe

so if someone has time and like to join ,i dont bite ;-)
Posted on 2002-01-14 06:28:12 by Max
well its up to you, lame seems the easiest , i doubt he will ever stop people using it - he's been at it ages and MANY programs use it.

I just think a lame decode to wav and playing the wav seems a lot easier.

And what if Mircosoft change their mind ? not like them to do that is it ?

GoodLuck!
Posted on 2002-01-14 09:22:50 by trancera
Hossa

now its working with WMA :-)
if the user talk some seconds the filesize of the voice.wma is mosttime not up to 20kb in 22khz 16bit.
converting takes not more then two seconds....

i build the server in the client and then i release a beta.
im unshure if i should use the server in the client or should i do a server.dll or or or....

sorry for talking so long about betas..if someone want a testversion i can post it ,but i like it more when i release something that works so this take some time again :-)

@ 4oh4:
had you sen that if you record a wav ,with your sample source ,this file isnt a "real wav" file ?
do a right click on it and take a look ,or try double click it wont play on media player.
there is a misstake in the settings ,i try some different settings but i dont get it.
alltime the file looks like : PCM,
a normal file looks like : PCM ,44khz 16bit ......
possible thats why in the "SET" function are some things missing ,as i say i tryed a lot combinations but it wont work.
what a luck that Media Encoder encode it ,so i can finaly hear it as WMA.

happy coding
Posted on 2002-01-15 04:39:57 by Max
heya Max,

I use winamp for most audio stuff. I've never really used windows media player so I'm not sure what's wrong there. There are several control settings that I don't set though so maybe there are other flags that have to be set for the wav to be played in the windows media player. -shrugs-


This is what winamp says about wavrec.wav:

Data format

Size of Format: 16
Format: PCM
Channels: 2
Samplerate: 44100
Bytes/Sec: 11025
Block Align: 4


Output format

Couldn't find
destination
format


So if you plan to use wmp maybe you'll have to set the other waveaudio control flags? It seems that winamp is more forgiving.

nevermind.... I just reread your post and you've already tried setting the other flags.
Posted on 2002-01-15 11:49:06 by Will
For ogg vorbis, its clearly stated that is free open-source, the only thing is that the sample inplementation is GPL (also known as a legal virus :grin: ), so to use it on non-opensource you must make your own. But since you are not making something comercial you will have no problem with it.

Since the author of ogg vorbis stated it on his web as FREE open-source, he cannot backup from that statement.

As for WMA, how do you play one?
Which API is used? Is there an SDK?
How you encode a WMA?
Posted on 2002-01-15 19:04:28 by dxantos
dxantos, sometimes you can get away with using GPL stuff in a DLL
and not releasing source to the rest of your application :)
Posted on 2002-01-16 03:32:20 by f0dder
-----------
As for WMA, how do you play one?
-----------
just simple ,like wave files.
i send the mci command PLAY with the filename xyz.wma

you need those entrys:
1.SYSTEM.INI

MPEGVideo2=mciqtz.drv

2.WIN.INI

wma=MPEGVideo2


------------------------------
Which API is used? Is there an SDK?
------------------------------
MCI API is used.
tip: download the mci api help from dolphinz Homepage.


-----------------------------
How you encode a WMA?
-----------------------------
just simple ,there is a encoder from microsoft for this :
Windows Media 8 Encoding Utility
i use a batch file for converting the voice.
like :
wm8eutil.exe -input song.wav -output song.wma -a_setting 48_44_2

where a_setting 48_44_2 are the settings for the sample rate.

encoding is also much fast :-)
Posted on 2002-01-16 06:01:54 by Max
Hossa

dont know if here are people who thrust me after all the stuff about virus&trojans in the code snippet i post.....but i like to introduce the worlds baddest coded and hopefull smallest voice communicator *rofl*

all works like i want it so im shure some users find it usefull and also id like to hear if there are problems on other systems.

i use windows98se + soundblaster128 + 600mhz
encoding works fast
filetransfer time... hm i have dsl so i cant say anything to it and like to hear the comment from other users.

dont know what to say.......read the readme.txt.
i go to talk some lines with my friends......cant say how much fun i have talking with my own tool.
cant be !!!

thanks to all who helped me here !


ARG...i had to split the files...filesize is 330kb because is use the windows media encoder to encode wav to wma.

ok here is the first file:
Posted on 2002-01-16 16:42:53 by Max