473,287 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,287 developers and data experts.

How to play a wave file on the phone (C#) - PART II

Part II: Wave file - How to read to a buffer

Wave (or Wav) is the standard format for storing audio data on the PC. As software developers, we are interested in the internal structure of the file so that we can open and read data correctly before transmitting it over the phone line.

Fortunately, there are plenty of good articles on the internet addressing the wave file format. Here is one of them: http://www.sonicspot.com/guide/wavefiles.html

We show a small excerpt from that article (thanks to sonicspot) to show the typical layout of a wave file:



From now on we will use HomeZIX software as a demostration platform to show our C# code.

There are 2 files (download from the forum here)

"houston 8kHz Mono 8.wav" is the WAV file with the famous phrase: “Houston we’ve got a problem.”

The second attachment is the C# script to (be imported to HomeZIX) which reads the WAV file. Please download and save the wave file to your C:\ drive, and then load the script into HomeZIX (by dropping an Advanced C# block into your workspace, going to the C# source code window, right clicking on the editor, and selecting File->Open.) The implementation is pretty straightforward. If you don’t care about the details, just focus on the Initialize() function where we open and read wave data into the buffer.

As we pointed out in the Part I, we just want to work with a PCM uncompressed Wave file, Mono, 8 bits per sample and 8kHz sample rate. That’s why our C# script checks to see if we are reading an appropriate file. You may change the file type-checking functionality to accommodate different formats that your voice modem supports.

Put HomeZIX in RUN mode (by selecting Manage->Run.) and click on the Advanced Script block. You should then see debug output, similar to what we are seeing here:



Now, the voice data has been loaded into the buffer. We will send it over the phone line so that whoever answers the phone will hear: “Houston, We’ve got a problem.” See you in PART III

Back to PART I
Sep 7 '07 #1
1 14830
bguyb
1
Hi
All links in the article are dead.
Mar 4 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bill Dandreta | last post by:
I posted a message ("Help with my 1st Tkinter program") a few days ago complaining that Python did not have any built in basic cross platform sound capability. I was wrong (at least partly). Python...
4
by: Dennis M. Marks | last post by:
This is a simple question. How do I preload a wave file and play it on command? -- Dennis M. Marks -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com -...
1
by: DaniloAlmeida | last post by:
Hi everyone, How are you ? Happy new year for all !!! Well I want to know how can I find some data like a tone in a recorded wave file in WindowsPCM format in 11kHz - 8bits. This file(s)...
9
by: Morris Neuman | last post by:
Im working with VS 2005 and trying to use a Hyperlink field in a datagrid to play a wave file that is not located in the website folders but is in a plain folder on the same machine, windows 2003...
4
by: I Hate My Computer | last post by:
Hi, I am looking to play a wave file in visual basic. I would like it to play from the resource file. I have added the wave file but how do I get it to play? I do have this code. Dim Sound As New...
2
by: homevista | last post by:
Our goal here: We want the PC to call a designated phone number when something happens, and report it in easy-to-understand spoken audio snippets which are saved in the form of pre-recorded wave...
6
by: homevista | last post by:
PART III: Putting things together In part I we examined the modem to verify that it supported voice. If so, we took a note about the voice data format that we would use. In the second part, we...
5
by: Slickuser | last post by:
I want to play a note in C# .NET giving a frequency like the one show below. Is it possible? C 261.6 C# 277.2 D 293.7 D# 311.1 E 329.6
8
by: raylopez99 | last post by:
I have the latest version of Visual Studio 2008 Professional, which allows you to create resource files (this is the .resx file, no?), unlike the Express version, which does not. I am trying to...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.