Solved

playing sound using direct sound

Posted on 2001-06-18
5
255 Views
Last Modified: 2013-12-03
hi,
im try to play wave file
in this format:
8 khz,16 bit (sampled at),mono.

in the lpDirectSound->CreateSoundBuffer() func
i supply WAVEFORMATEX structure with this parmeters:
    wf.wFormatTag = ; //i dont know
    wf.nChannels = 1;
    wf.nSamplesPerSec = 8000;
    wf.nBlockAlign = 2;
    wf.nAvgBytesPerSec =wf.nSamplesPerSec*wf.nBlockAlign;
    wf.wBitsPerSample = 16;

the sound that i receive is very slow
and with lot of noise.
(in very slow i mean that the voice
 is spread on long time)

the format of the sound file that i try to play,
is as codec output, before any manipulations (include pcm).

i dont know the correct parameter for field wf.wFormatTag in the WAVEFORMATEX structure.

is the direct sound is the good way for this task?
 
TIA.

///////////
19-6-01

the original file is not  pcm format, but now i convert it to pcm format, for using WAVE_FORMAT_PCM.
(Also, my code already based on Microsoft sample in direct sound documentation).
But the problem persists. (The sound spread on long time)

Its lock likes frequency mismatch,
May the hardware or driver translate the data as lowest sample rate so all sample take more time when playing it.
0
Comment
Question by:stern_b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6202060
check out example in
http://msdn.microsoft.com/library/wcedoc/wcegmm/dsover_25.htm
About WAVEFORMATEX
see
http://msdn.microsoft.com/library/psdk/directx/DX8_VB/hh/directx8_vb/_dx_waveformatex_dxaudio_vb.htm
1-st parameter of WAVEFORMATEX
must be set to WAVE_FORMAT_PCM or WAVE_FORMAT_DRM.


0
 
LVL 23

Expert Comment

by:chensu
ID: 6205025
>i dont know the correct parameter for field wf.wFormatTag in the WAVEFORMATEX structure.

Use WAVE_FORMAT_PCM if it is in PCM format.

>is the direct sound is the good way for this task?

If you just want to simply play a wave file, using the PlaySound API function is much easier.
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 200 total points
ID: 6248981
No reaction, I hope , my comment helps. Alex
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6697023
If this proposed answer has helped you, please accept it, grade it and close this question.  If it is not, reject it and add comments as to your progress and what else is needed.

Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6791205
Zero response from Asker or expert(s) since my last follow up request, therefore can only assume that the Proposed Answer served the need.  Closing today.

I am sorry to see that Asker has not returned to update and finalize this question.  I am, therefore, force accepting this question.  In the event the Asker returns with additional needs related to this question, please respond and continue the collaboration process.
 
If there are questions in this regard, please comment and I'll return when I can.
 
The HELP DESK link on the left is informative, and includes this site's Guidelines and Member Agreement as well as assistance related to Questions and Answers.  Here is the QA link, as a reference.
 
http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp

--->  While I'm here anyway, letting all know that we have added quite a number of new Topic Areas, as you'll see from the link below:

http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question