How change BitRate in StockAudioRecorder

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

How change BitRate in StockAudioRecorder

Postby jeanrl » August 28th, 2004, 6:55 pm

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.
jeanrl
Active Member
Active Member
 
Posts: 8
Joined: August 28th, 2004, 6:51 pm

Postby Kambiz » August 29th, 2004, 8:40 am

You should change the audio format.

The bit rate of "PCM 8.000 kHz, 16 Bit, Mono" is 128 kbps.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Postby jeanrl » August 29th, 2004, 7:22 pm

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.
jeanrl
Active Member
Active Member
 
Posts: 8
Joined: August 28th, 2004, 6:51 pm

Postby Johnny_Bit » August 31st, 2004, 6:50 am

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.
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby Kambiz » August 31st, 2004, 8:41 am

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

No, it's not possible.

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

44.100 * 16 * 2 = 1411.2 kbps
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Postby jeanrl » August 31st, 2004, 11:39 am

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
jeanrl
Active Member
Active Member
 
Posts: 8
Joined: August 28th, 2004, 6:51 pm

Postby Johnny_Bit » August 31st, 2004, 1:20 pm

Do you want on-the-fly compression?
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby jeanrl » September 1st, 2004, 1:10 pm

If possible, yes!
jeanrl
Active Member
Active Member
 
Posts: 8
Joined: August 28th, 2004, 6:51 pm

Postby Johnny_Bit » September 1st, 2004, 5:17 pm

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
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby jeanrl » September 1st, 2004, 5:29 pm

Ok, but as I choose another format?
jeanrl
Active Member
Active Member
 
Posts: 8
Joined: August 28th, 2004, 6:51 pm

Postby Johnny_Bit » September 5th, 2004, 6:56 am

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.
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby jeanrl » September 5th, 2004, 9:32 pm

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.
jeanrl
Active Member
Active Member
 
Posts: 8
Joined: August 28th, 2004, 6:51 pm

Postby Johnny_Bit » September 6th, 2004, 6:36 am

Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby jeanrl » September 6th, 2004, 1:50 pm

Ok, thank's a lot. :wink:
jeanrl
Active Member
Active Member
 
Posts: 8
Joined: August 28th, 2004, 6:51 pm

Postby jeanrl » September 7th, 2004, 1:28 pm

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
jeanrl
Active Member
Active Member
 
Posts: 8
Joined: August 28th, 2004, 6:51 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron