DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How change BitRate in StockAudioRecorder

 
   Reply to topic    DELPHI AREA Forum Index -> DELPHI AREA's Products
View previous topic :: View next topic  
Author Message
jeanrl
Member


Joined: 28 Aug 2004
Posts: 8

PostPosted: 28/08/04 18:55    Post subject: How change BitRate in StockAudioRecorder Reply with quote

I like change the BitRate in StockAudioRecorder because it's record very hight (1411 kbps) and I like 128 kpbs.
How change?
Thank's and escuse for my inglish.
Back to top
View user's profile
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 414
Location: Tehran, Iran

PostPosted: 29/08/04 08:40    Post subject: Reply with quote

You should change the audio format.

The bit rate of "PCM 8.000 kHz, 16 Bit, Mono" is 128 kbps.
Back to top
View user's profile Send e-mail Visit poster's website
jeanrl
Member


Joined: 28 Aug 2004
Posts: 8

PostPosted: 29/08/04 19:22    Post subject: Reply with quote

It's possible "PCM 44.100 kHz, 16 Bit, Stereo" with 128 kbps?
If yes please show me how I do.
Thansk's very mouch.
Back to top
View user's profile
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 158

PostPosted: 31/08/04 06:50    Post subject: Reply with quote

PCM is not compressed! thos kbps is data size for one second. I Think you want to get MP3? Am I right? If yes then simply record PCM, and then using Some compressor (ex. LAME) to compress it.
Back to top
View user's profile
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 414
Location: Tehran, Iran

PostPosted: 31/08/04 08:41    Post subject: Reply with quote

jeanrl wrote:
It's possible "PCM 44.100 kHz, 16 Bit, Stereo" with 128 kbps?

No, it's not possible.

Code:
Samples Per Second * Bits Per Sample * Number of Channels = Bit Rate

44.100 * 16 * 2 = 1411.2 kbps
Back to top
View user's profile Send e-mail Visit poster's website
jeanrl
Member


Joined: 28 Aug 2004
Posts: 8

PostPosted: 31/08/04 11:39    Post subject: Reply with quote

Hi Johnny_Bit and Kambiz.

Jhonny it is accurately this that I am making, however the record this being very big because of bitreats them high, understend?

Ok, thank's to all for the attention.

Jean
jeanrl@netsite.com.br
Back to top
View user's profile
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 158

PostPosted: 31/08/04 13:20    Post subject: Reply with quote

Do you want on-the-fly compression?
Back to top
View user's profile
jeanrl
Member


Joined: 28 Aug 2004
Posts: 8

PostPosted: 01/09/04 13:10    Post subject: Reply with quote

If possible, yes!
Back to top
View user's profile
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 158

PostPosted: 01/09/04 17:17    Post subject: Reply with quote

As far as I remember you simply chose other format than PCM, in my windows it's a preety big list of format, and most interesting for you as I assume is Frauhoffer Institute MP3... If you don't have it you should check mp3dev.org for LAME codec
Back to top
View user's profile
jeanrl
Member


Joined: 28 Aug 2004
Posts: 8

PostPosted: 01/09/04 17:29    Post subject: Reply with quote

Ok, but as I choose another format?
Back to top
View user's profile
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 158

PostPosted: 05/09/04 06:56    Post subject: Reply with quote

Currently I cannot help you, because my system has big problems that i cannot solve, wich includes problems with encoders, but you can check Virtual Dub source code, they got some good wor on it.
Back to top
View user's profile
jeanrl
Member


Joined: 28 Aug 2004
Posts: 8

PostPosted: 05/09/04 21:32    Post subject: Reply with quote

Ok, very thank's for your attention, but only more a question, can say me where finds the "Virtual Dub source code"?

Very thansk's.
Back to top
View user's profile
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 158

PostPosted: 06/09/04 06:36    Post subject: Reply with quote

SourceForge - VirtualDub
SourceForge - NanDub
VirtualDub
VirtualDub download @ SourceForge
Back to top
View user's profile
jeanrl
Member


Joined: 28 Aug 2004
Posts: 8

PostPosted: 06/09/04 13:50    Post subject: Reply with quote

Ok, thank's a lot.
Back to top
View user's profile
jeanrl
Member


Joined: 28 Aug 2004
Posts: 8

PostPosted: 07/09/04 13:28    Post subject: Reply with quote

I obtain with these installed functions to call codec however my question is as to pass codec chosen to StockAudioRecorder using the chosen compression?

Functions:

function TForm1.AllocWaveFormatEx : Integer;
begin
FWaveFormat.cbSize
if acmMetrics(nil, ACM_METRIC_MAX_SIZE_FORMAT, FMaxFmtSize) <> 0 then begin
showmessage('Error getting the max compression format size.');
Result := -1;
Exit;
end;

GetMem(FWaveFormat, FMaxFmtSize);
if FWaveFormat = nil then begin
showmessage('Error allocating local memory for WaveFormatEx structure.');
Result := -2;
Exit;
end;

// initialize the format to standard PCM...
FillChar(FWaveFormat^, FMaxFmtSize, 0);
FWaveFormat.wFormatTag := WAVE_FORMAT_PCM;
FWaveFormat.nChannels := 1;
FWaveFormat.nSamplesPerSec := 11025;
FWaveFormat.nAvgBytesPerSec := 11025;
FWaveFormat.nBlockAlign := 1;
FWaveFormat.wBitsPerSample := 8;
FWaveFormat.cbSize := 0;

// store the format and tag decription strings...
GetFormatTagDetails(FWaveFormat.wFormatTag);
GetFormatDetails(FWaveFormat);

Result := 0;
end;


function TForm1.GetWaveFormat : integer;
var
acmopt : TACMFORMATCHOOSE;
err : MMRESULT;
ptmpfmt : PWAVEFORMATEX;
begin

GetMem(ptmpfmt, FMaxFmtSize);

if ptmpfmt = nil then begin
showmessage('Error allocating temporary format buffer.');
Result := -1;
Exit;
end;

Move(FWaveFormat^, ptmpfmt^, FMaxFmtSize);

// setup ACM choose fields and display the dialog...
FillChar(acmopt, sizeof(acmopt), 0); // zero out
acmopt.cbStruct := sizeof(acmopt);
acmopt.fdwStyle := ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT;
acmopt.hwndOwner := Handle;
acmopt.pwfx := FWaveFormat;
acmopt.cbwfx := FMaxFmtSize;
acmopt.pszTitle := 'Select Compression';
acmopt.fdwEnum := ACM_FORMATENUMF_INPUT;
err := acmFormatChoose(acmopt);

// if the same format was selected we don't want to reset FTotalWaveSize
// below, so act like a cancel...
if CompareMem(FWaveFormat, ptmpfmt, sizeof(TWAVEFORMATEX)) then
err := ACMERR_CANCELED;
if err <> MMSYSERR_NOERROR then begin
Move(ptmpfmt^, FWaveFormat^, FMaxFmtSize);
FreeMem(ptmpfmt);
if err = ACMERR_CANCELED then begin
Result := 0;
Exit;
end;
showmessage('Error in FormatChoose function');
Result := -2;
Exit;
end;

// store the format description...
FFormatDesc := acmopt.szFormat;

// get the format tag details, we don't need to call acmGetFormatDetails since
// that information was supplied by the choose function...
GetFormatTagDetails(acmopt.pwfx.wFormatTag);

FreeMem(ptmpfmt);

// now set the play button to a grayed state cause we don't want
// to try to play the recorded data with a different format...
FTotalWaveSize := 0;

Result := 0;
end;

function TForm1.GetFormatDetails(pfmtin : PWAVEFORMATEX) : integer;
var
acmfmtdetails : TACMFORMATDETAILS;
begin
// zero out struct...
FillChar(acmfmtdetails, sizeof(acmfmtdetails), 0);

acmfmtdetails.cbStruct := sizeof(acmfmtdetails);
acmfmtdetails.pwfx := pfmtin;
acmfmtdetails.dwFormatTag := pfmtin.wFormatTag;
acmfmtdetails.cbwfx := sizeof(TWAVEFORMATEX) + pfmtin.cbSize;

if acmFormatDetails(nil, acmfmtdetails,
ACM_FORMATDETAILSF_FORMAT) <> 0 then begin
showmessage('Warning, FormatDetails function failed');
Result := -1;
Exit;
end;

// store the format details description string...
FFormatDesc := acmfmtdetails.szFormat;

Result := 0;
end;


I tried using onFormat but I did not obtain, then I ask: It has as to pass codec chosen for the StockAudioRecorder?

Thank's and sorry for insistence.

Jean
jeanrl@netsite.com.br
Back to top
View user's profile
Display posts from previous:   
   Reply to topic    DELPHI AREA Forum Index -> DELPHI AREA's Products All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group