![]() |
turning integers into sound?
Hi,
This isn't exactly specific to Visual Basic, but I will be working in VB .NET, so I suppose this is the right forums for it. If I have a lump of raw data, essentially integers from 0 to 255, how am I able to turn this into sound? I imagine there is some sort of encoding process, and to get good quality sound (enough to hear words and such) might be a bit more difficult, but right now in VB, I just want to know if I have a file like 255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255 then I will hear a high pitched sound, some silence (or really low pitched, whatever), then more high pitched noise. I dont really care about the time frame, it could all happen in half a second, I just need to get from the raw data stage to the sound being output through speakers, sound card, whatever. Cheers, thanks in advance for any help, Simon |
http://www.faqs.org/rfcs/rfc2326.html <--- that should help you get started.
Basically from what i have done on streams, when i was making a file uploader, for anything like an image, you have to read it as bytes, which can be converted into an ASCII code but i found that when i converted it into an ACSII code and then re-byte'd it it didnt work, so you will have to be handling raw data. |
I'm not sure how the RFCs would help - what you described was similar to pulse code modulation (regularly sampling sound within a given resolution at a constant frequency - http://searchnetworking.techtarget.c...14284,00.html).
As for piping them to the speakers, wav files use PCM so the raw sound data can be directly fed to the mixer...A family of APIs (winmm.dll) in a WAVEHDR Struct(ure) - see the low level sound functions in the winsdk (http://msdn.microsoft.com/library/de...waveinopen.asp) - all unmanaged code of course. You're right though, realistically it'd need some sort of compression using a PCM encoder like Lame or Guliverkli if the stream's traversing the internet. However, if you could post more details of what you're trying to achieve that'd be good, as there's no point reinventing a whole load of great sound related technologies that are readily available. |
| All times are GMT -5. The time now is 5:29 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC