TStockAudioPlayer (minimal time to record)

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

TStockAudioPlayer (minimal time to record)

Postby Nuken » March 20th, 2006, 8:09 pm

Hi!
I need to record from SoundCard's LineIn signal length of 20 ms in TMemoryStream. Is it possible with TStockAudioRecorder?
I do this and do not get normal signal (just some spikes).
BufferCount=4, BufferLength=10ms, async=true.
Can anyone help with TStockAudioRecorder's settings or example?
Thank you very much!!!
Last edited by Nuken on March 23rd, 2006, 8:04 am, edited 1 time in total.
Nuken
Member
Member
 
Posts: 4
Joined: August 28th, 2005, 4:34 pm

Postby Kambiz » March 21st, 2006, 1:25 pm

Did you select LineIn line for recording?
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Nuken » March 22nd, 2006, 4:15 pm

Kambiz wrote:Did you select LineIn line for recording?


Before record is started i make
StockAudioRecorder.DeviceID:=WAVE_MAPPER;
Nuken
Member
Member
 
Posts: 4
Joined: August 28th, 2005, 4:34 pm

Postby Kambiz » March 22nd, 2006, 4:32 pm

It's not enough.

You should tell Windows which line you want to use for recording. As default the selected recording line is Microphone.

You can use either Windows control panel or AudioMixer component to select LineIn.

The following topic may help you a bit:
http://www.delphiarea.com/forum/viewtopic.php?t=479
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Kambiz » March 22nd, 2006, 4:42 pm

The following function is what you need.

Code: Select all
uses
  WaveMixer;

function SelectLineInForRecording: Boolean;
var
  LineID: Integer;
begin
  Result := False;
  with TAudioMixer.Create(nil) do
    try
      DestinationID := 1;
      for LineID := 0 to LineCount - 1 do
        if Lines[LineID].ComponentType = cmSrcLine then
        begin
          Master.SelectedLine := LineID;
          Result := True;
          Break;
        end;
    finally
      Free;
    end;
end;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby cozturk » March 22nd, 2006, 4:54 pm

cozturk
Moderator
Moderator
 
Posts: 63
Joined: June 30th, 2005, 5:39 am
Location: Istanbul - Turkiye

Postby Nuken » March 23rd, 2006, 8:01 am

Thank you Kambiz and cozturk!
In system audiosettings LineIn is choosen for recording.
I have another question. I use resolution 16 bit. Record is done into SoundStream of TMemoryStream type. Each cell of stream after the record was done has value of what type (byte or smallint)? I ask about this because in case of 16 bit system represents data about one sample made by soundcard in two bytes which must be converted in one value of smallint type.
Nuken
Member
Member
 
Posts: 4
Joined: August 28th, 2005, 4:34 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 0 guests

cron