Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 9th, 2005, 3:29 AM   #1
clam
Newbie
 
Join Date: Aug 2005
Posts: 1
Rep Power: 0 clam is on a distinguished road
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
clam is offline   Reply With Quote
Old Aug 9th, 2005, 4:53 AM   #2
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 5 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
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.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."

- Albert Einstein
Berto is offline   Reply With Quote
Old Aug 23rd, 2005, 1:28 PM   #3
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
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.
Rory is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:00 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC