Click here to Skip to main content
15,890,527 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Set Windows login authentication option programmatically [modified] Pin
_anil_31-May-06 1:06
_anil_31-May-06 1:06 
GeneralRe: Set Windows login authentication option programmatically [modified] Pin
narayanagvs31-May-06 2:34
narayanagvs31-May-06 2:34 
QuestionTime Pin
Try30-May-06 22:11
Try30-May-06 22:11 
AnswerRe: Time Pin
Nibu babu thomas30-May-06 22:19
Nibu babu thomas30-May-06 22:19 
AnswerRe: Time Pin
_AnsHUMAN_ 30-May-06 22:47
_AnsHUMAN_ 30-May-06 22:47 
AnswerRe: Time [modified] Pin
Arsalan Malik30-May-06 23:51
Arsalan Malik30-May-06 23:51 
AnswerRe: Time Pin
echozeng31-May-06 5:28
echozeng31-May-06 5:28 
Questionhow to save audio [modified] Pin
ramyasangeet30-May-06 21:50
ramyasangeet30-May-06 21:50 
hi all,

I have extrated audio from video and i need to store the extracted audio as .wav format.
I wrote the following code to save audio in .wav format.

void CWave::Save(CFile *f)<br />
{<br />
        WAVEFORMATEX m_waveformat;<br />
	m_waveformat.wFormatTag = 1;<br />
	m_waveformat.nChannels = 1;<br />
	m_waveformat.nSamplesPerSec = 7500;<br />
	m_waveformat.nAvgBytesPerSec = 7500;<br />
	m_waveformat.wBitsPerSample = 8;<br />
	m_waveformat.nBlockAlign = 1;<br />
	m_waveformat.cbSize = 0;<br />
<br />
	f->Write("RIFF", 4) ;<br />
      DWORD dwFileSize = 20000 * m_waveformat.nBlockAlign + 36 ;<br />
	f->Write(&dwFileSize, sizeof(dwFileSize)) ;<br />
	f->Write("WAVEfmt ", 8) ;<br />
	DWORD dwFmtSize = 16L;<br />
	f->Write(&dwFmtSize, sizeof(dwFmtSize)) ;<br />
	f->Write(&m_waveformat.wFormatTag , sizeofm_waveformat.wFormatTag)) ;<br />
	f->Write(&m_waveformat.nChannels, sizeof(m_waveformat.nChannels)) ;  f->Write(&m_waveformat.nSamplesPerSec,sizeof(m_waveformat.nSamplesPerSec)); <br />
f->Write(&m_waveformat.nAvgBytesPerSec,sizeofm_waveformat.nAvgBytesPerSec)) ;<br />
f->Write(&m_waveformat.nBlockAlign, sizeof(m_waveformat.nBlockAlign)) ;<br />
f->Write(&m_waveformat.wBitsPerSample, sizeof(m_waveformat.wBitsPerSample)) ;<br />
f->Write("data", 4) ;<br />
        DWORD dwNum = 20000 * m_waveformat.nBlockAlign;<br />
	f->Write(&dwNum, sizeof(dwNum)) ;<br />
	//f->Write(m_buffer.GetBuffer(), dwNum) ;<br />
}


m_pWave.Save("c:\\temp.wav");

Everthing is working fine.A wave file is created in c:.

but when i play the wav file,the is no audio..wat is problem in it.
is that save function is correct?
do u need to add some code??

plz give me suggestions and idea..help me



cheers

sangeet

-- modified at 4:04 Wednesday 31st May, 2006
AnswerRe: how to save audio [modified] Pin
Hamid_RT30-May-06 22:20
Hamid_RT30-May-06 22:20 
QuestionSplitter Window Pin
Member 303984330-May-06 21:47
Member 303984330-May-06 21:47 
AnswerRe: Splitter Window Pin
NiceNaidu30-May-06 22:54
NiceNaidu30-May-06 22:54 
GeneralRe: Splitter Window Pin
Member 303984331-May-06 18:03
Member 303984331-May-06 18:03 
QuestionSocket Vs Port - using firwall (amended) Pin
zahid_ash30-May-06 21:24
zahid_ash30-May-06 21:24 
AnswerRe: Socket Vs Port - using firwall (amended) Pin
NiceNaidu30-May-06 23:00
NiceNaidu30-May-06 23:00 
AnswerRe: Socket Vs Port - using firwall (amended) Pin
ThatsAlok31-May-06 0:08
ThatsAlok31-May-06 0:08 
QuestionDisplaying Message Box while program(code) continues [modified] Pin
KongHL30-May-06 21:23
KongHL30-May-06 21:23 
AnswerRe: Displaying Message Box while program(code) continues [modified] Pin
Cedric Moonen30-May-06 21:38
Cedric Moonen30-May-06 21:38 
GeneralRe: Displaying Message Box while program(code) continues [modified] Pin
KongHL30-May-06 21:57
KongHL30-May-06 21:57 
GeneralRe: Displaying Message Box while program(code) continues [modified] Pin
_anil_30-May-06 22:16
_anil_30-May-06 22:16 
GeneralRe: Displaying Message Box while program(code) continues [modified] Pin
toxcct1-Jun-06 23:06
toxcct1-Jun-06 23:06 
GeneralRe: Displaying Message Box while program(code) continues [modified] Pin
_anil_1-Jun-06 23:21
_anil_1-Jun-06 23:21 
AnswerRe: Displaying Message Box while program(code) continues [modified] Pin
Ștefan-Mihai MOGA30-May-06 21:38
professionalȘtefan-Mihai MOGA30-May-06 21:38 
AnswerRe: Displaying Message Box while program(code) continues [modified] Pin
Stephen Hewitt30-May-06 22:09
Stephen Hewitt30-May-06 22:09 
GeneralRe: Displaying Message Box while program(code) continues [modified] Pin
KongHL30-May-06 21:44
KongHL30-May-06 21:44 
GeneralRe: Displaying Message Box while program(code) continues Pin
ThatsAlok31-May-06 0:03
ThatsAlok31-May-06 0:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.