Please i have a problem creating an audio stream application, i got an examble application from the net, written by Micheal Circuse, but this examble only explain how to capture data, so i develope it to stream the data, but i have a problem,
The recived data is written to file, and when trying to play it, it not run correctly, i use winsocket to send data, the code written by Micheal Circuse is capture stream from MIC using directx and then encode it using Blade Encoder, this encoder deliver to me an array of bytes which i can wrote this bytes to file, when i do that localy I.e. write it upone the encoder deliver it to me, it work, but if i send that array to other side useing winsocket and then write it to file, it not work corectly, i think that the error is the type of data, cause encoder give data to me as an array of byte, while winsocket give it to me as variant,
I include the whole project as an attachment, So please if any body can get this project deliver to me an correct sound at the other side (I.e. after transfer with Winsocket),
Also i need help playing that stream upon receiving it, Which mean i need an Broadcasting app, is there a way to make that stream work, without writting it to file?
Summary: I need a way to recive a stream and play it on the other side, simulatonusly, (With no delay).
Please help me if you can
Thanks in advanced for whatever help.
Last edited by Dominator; Jul 29th, 2005 at 12:02 PM.
Reason: Modify The Attachment
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...
Hey, you mispelled my name ! It's Michael Ciurescu
First of all it's impossible to play without a delay, you have the DirectX delay wich depends on how big the buffer is, and the you have the transfer delay (the connection ping), and also, the play delay (buffer size on the client side).
You can minimize the delay of course, but you will always have a delay...
I did not look at the attachment yet to see what modifications you made to my code, I'll do that after I post this message.
I made a ShoutCast server before, and the easyest way to play on the other side is to play in winamp (without saving that is)
By the way, can you post as ZIP, I don't have rar decompressor
This is my graduate project and a part of our S/W is audio and video streaming, I saw a lot of OCX on the net but, i need a code, so i find your code while searching, its really good, but the problem that my knowldge with DirectX is noy good, I read your code also comment it, but there a some piceses i don't get it at all,
All i got in berife, that this app use directX to capture sound and deliver to us a wav buffer, which we got it in array of byte, i try to got this wav data and write it to file, But the result was bad, i think that the reason is the end of file, DirectX dosn't close the stream, This is first problem
Second Problem, I need to transfer the captured data to the other side, and play it, But the recived data is mp3, which if its wav, we can put it in buffer in memory and request from DirectX to play it. I don't know if that is possible or not, But i think that is possible!? Please advice.
Third problem, Even i transfer WAV or MP3, when i got the data at the other side and write it to file and try play it, i hear nothink just noise
Also i try UDP protocol instead of TCP, but when i open the file the player is hangup,
Please note: Can i play a sound from a buffer using DirectX, If yes can we use this ability to play the recived sound?
Please if you know a code or tutorial that help me to create a good streamer, this will be approprichiated,
And if i don't annoying you,(If you can), Please help me and guide me how to modify your code to got it work as wav streamer or mp3 streamer and play it at the other side,
How can i play recived data with winamp upon receiving it without file?
I'm realy hope that you can help me, but also i don't want to annoy you, but i'm realy search the net a lote but i don't find a free satisfyed code, your code is satisfay but need to modify, Si please help me or guide me to modify it.
Thanks in advanced for whatever help, Thanks alot
Last edited by Dominator; Jun 26th, 2005 at 06:10 AM.
Reason: Change Somthing
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...
Private Sub SData_DataArrival(ByVal BytesTotal As Long)
'RaiseEvent UpdateState("Data", "Reciving Data.")
Dim Data As Variant
SData.GetData Data, , BytesTotal
RaiseEvent DataReceived(Data, BytesTotal)
End Sub
TO:
VB Code:
Private Sub SData_DataArrival(ByVal BytesTotal As Long)
Dim Data() As Byte
ReDim Data(BytesTotal - 1)
SData.GetData Data, vbArray + vbByte
RaiseEvent DataReceived(Data, BytesTotal)
End Sub
And chage the rest of the code (like DataReceived) to accept Byte() instead of Variant
You can even use string type, but that uses double the memory (wich is not a lot anyway)
Also, the easiest way to play the sound on the client side is to let it save a bit (let's say 500K), then just play the file with WinAmp. WinAmp won't stop playing when it reaches the time originally set (when you open the file), if the file gets bigger in the mean time it's OK to WinAmp...
Also, you kinda mixed the idea of server & client, server is supposed to listen for connections and SEND data when client is connected. You are doing the other way around, client sends data right after it connects...
Last edited by CVMichael; Jun 27th, 2005 at 12:23 AM.
How can i play recived data with winamp upon receiving it without file?
Unfortunatelly, I cannot find my ShoutCast project, but here's the idea:
First of all, you have to make it so that server does the recording and listens for connections. When client connects, you have to send a header (simmilar to http protocol), and then send the MP3 data.
On the client side you only need a m3u file or pls file (wich you can put it on your web-site for example)
If you go to http://www.shoutcast.com (wich it does not work on my computer for some reason), and you click (Shift + Click i think) on a radio station you download a pls file (i think), and you can view this file as text so you know it's format.
Anyways, in the pls file you are basically telling WinAmp to what computer to connect to and port number.
FIRST:
Find out what WinAmp will send to you, do this:
What you will have to do is make a "fake" server. Just write a small program (server) that displays any data it receives. So you will have to make this program listen on a port on your computer, lets say port 10000.
Then in the pls file, write something like http://127.0.0.1:10000 and open the pls file, winamp should try to connect and send a header to your server.
See the header format, so you know what to expect when the clients' WinAmp will send to your server.
SECOND:
Now the hard part is when the server sends the header to WinAmp.
Find a website that plays ShoutCast (like the link above).
Download the pls file, open it, and find out where to connect to, and port number (any radio station, does not matter).
Now you have to make another "fake" program. This time the program has to act like WinAmp (wich is a client).
Since you know what WinAmp has to send, you have to send the same thing to that ShoutCast server. So connect to a ShoutCast server with your "fake" client, and send that header.
Right away, that server will send to you it's header, and then the MP3 data. Save the data... look what you received, and see the header. That same format header your server has to send.
So, when you make your ShoutCast server, when the client connects, send that header (the one you found out in the second part), then send the MP3 data your recording.
This way the person you have to send your sound/MP3, does not need any of your programs, it only needs WinAmp...
From while i saw the Blade MP3 player, and Michael Ciurescu, help me to solve some problems and i find that there is no way to run recived stream through winamp, so i stoped annoying you, and start searching for direct player that will play the stream upon reciveing it, And while i explorering SDk i found the FullDouplex example then i develop it to stream, the following attachment able to stream sound with delay 800 ms (Without network),
My problem is i limited with this quality, (8000 HZ, 1 Channel, 8 Bits), which equale to 7 KB per packet, If you try to use beeter quality, like (48000,2,16) Winsocket will raise an error cause the packet is huge,
So i think that there is a solution to devide the array which recorded to smaller packets, in which the size of each one dosn't exceed 7000 index i.e 7KB,
But the shame i don't able to do it, so i need from any body to help me devide the primary array to smaller arrayes and send it, and you have to watch the delay, i mean the code must be fast or it will result to very high delay which meen mission failed,
Or if any body have a beeter solution, Please learn me,
Thanks in advanced for whatever help,
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...
Thanks for you link, I alerdy test directplay but for some resone it wan't work with me and i don't know why, please if any body can mix directplay with my examble or lead me to an template function which take as parameter the data, this will be approchiated,
I realy know that my request is silly but i really have no experince with directx, and the directplay exambles are diffecult not like the fulldouplex,
So if any body can help me please, its will be thanks,
Thanks in advanced for whatever help.
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...
To be honest, I haven't tapped into DirectPlay much at all. So I'm not an expert in that section of DirectX...yet. I only worked with it once or twice. All I know is that it is used in PC games for Massively Multiplayer games, and it's super fast.
Hallow While Searching the net i found, this examble i need to modify it to be send array of byte instead of string, Thanks
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...
Please Any Help, This Application Is Done, All I Need is to customize it to send array of byte per packet instead of byte per packet, Thanks
Any Help Please, Setuation Is Very Critical, Thanks.
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...
Anyways...
I don't think you can, I did not see any write function for array...
So I think your only option if you want to send byte array is to convert the byte array to string before you send using StrConv.
I'm very sorry, i know that i'm repeate my request and i know its selly,
But i'm really need help,
So please forgive me people for this mestake,
Thanks for help you provide and again sorry
Thanks a lot...
.........................................................
John F. Gouda {A.K.A}{Dominator Legend}
Software Engineer
+20-0125113313
.......................................................
Please feel free to download my projects: Http://DominatorLegend.Co.Nr
.................................................................................................... ................................................................................................ Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...