Lazarus

Programming => Graphics and Multimedia => Audio and Video => Topic started by: pascalbythree on July 21, 2022, 01:28:29 pm

Title: Audio component pack for Microphone in support, Raspberry
Post by: pascalbythree on July 21, 2022, 01:28:29 pm
Hey FPC Brothers,

Does anybody have a name for a extra component pack for audio support on Raspberry Linux ?

Audio Component Suite does not seem to run with audio IN

UOS is to complex, and PXL does not seem to support it.

The idea is to program a graphic equalizer on my Televison, with a HDMI cable to my  RPI.

Just for Show!

Maybe somebody knows a differrent solution on the internet,

Greets Wouter van Wegen, PascalByThree
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: PascalDragon on July 21, 2022, 01:39:21 pm
If the Linux distribution in question is using PulseAudio you could simply hook yourself at the corresponding monitoring device. I do the same for my light organ. When I'm home from work I can provide you with the necessary units.
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: pascalbythree on July 21, 2022, 01:42:12 pm
C00L, can you please send them up to woutervanwegen@gmail.com ? Great thanks in advance!
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: Fred vS on July 21, 2022, 01:55:01 pm
UOS is to complex, and PXL does not seem to support it.

Hello.

May I ask you what is to complex with uos and what is PXL?
Tenor sound aplications working on Rpi, like Audacity, use the same libraries as uos.

[EDIT] There was a answer to your topic on uos forum some years ago:
http://uos-forum.108.s1.nabble.com/Microphone-IN-to-equalizer-on-Raspberry-td662.html


Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: PascalDragon on July 21, 2022, 09:25:04 pm
C00L, can you please send them up to woutervanwegen@gmail.com ? Great thanks in advance!

There isn't much to send. I'm using the PulseAudio units from here (https://github.com/andrewd207/fpc-pulseaudio) and the important parts of the code are as follows:

Code: Pascal  [Select][+][-]
  1. uses
  2.   pulse_simple;
  3.  
  4. var
  5.   pulse: PPASimple;
  6.   ss: TPASampleSpec;
  7.   err: cint;
  8.   buf: array[0..Pred(4096)] of Byte;
  9. begin
  10.   ss.Init;
  11.   ss.Format := sfFloat32LE;
  12.   ss.Rate := 44100;
  13.   ss.Channels := 1;
  14.   pulse := TPASimple.New(Nil, 'NameForApp', sdRECORD, Nil, 'NameForStream', @ss, Nil, Nil, @err);
  15.   if not Assigned(pulse) then begin
  16.     Writeln('Failed to connect to PulseAudio server; error: ', err);
  17.     Halt(1);
  18.   end;
  19.  
  20.   while { whatever condition } do begin
  21.     if pulse^.Read(@buf[0], Length(buf), Nil) < 0 then
  22.       Continue;
  23.  
  24.     { do something with the sample }
  25.   end;
  26.  
  27.   pulse^.Free;
  28. end.
  29.  

Once you've started your application you can start e.g. PavuControl and in the Record tab you can select which monitor should be used for the client you connected. PulseAudio will remember this as long as the NameForApp stays the same.

May I ask you what is to complex with uos and what is PXL?

Platform eXtended Library (https://asphyre.net/products/pxl)
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: Fred vS on July 21, 2022, 10:33:34 pm
May I ask you what is to complex with uos and what is PXL?

Platform eXtended Library (https://asphyre.net/products/pxl)

Ha, ok, thans for the info.
( But PXL seems to not use PulseAudio too or I miss something about "PXL does not seem to support it" because uos also use PulseAudio (if installed) otherwise directly ALSA lib ).

Also I am not sure it will be easy for the OP to create a graphic equalizer using only the PulseAudio methods.
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: pascalbythree on July 22, 2022, 12:17:18 pm
Code: Pascal  [Select][+][-]
  1. program WVW_PULSE;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}
  7.   cthreads,
  8.   {$ENDIF}
  9.   Classes, SysUtils, CustApp,   pulse_simple, pulse_sample, ctypes, pulse_def, crt;
  10.   { you can add units after this }
  11.  
  12. type
  13.  
  14.   { TMyApplication }
  15.  
  16.   TMyApplication = class(TCustomApplication)
  17.   protected
  18.     procedure DoRun; override;
  19.   public
  20.       pulse: PPASimple;
  21.   ss: TPASampleSpec;
  22.   err: cint;
  23.   buf: array[0..Pred(4096)] of Byte;
  24.   i : integer;
  25.     constructor Create(TheOwner: TComponent); override;
  26.     destructor Destroy; override;
  27.     procedure WriteHelp; virtual;
  28.   end;
  29.  
  30. { TMyApplication }
  31.  
  32. procedure TMyApplication.DoRun;
  33. var
  34.   ErrorMsg: String;
  35.   X : integer;
  36. begin
  37.   // quick check parameters
  38.   ErrorMsg:=CheckOptions('h', 'help');
  39.   if ErrorMsg<>'' then begin
  40.     ShowException(Exception.Create(ErrorMsg));
  41.     Terminate;
  42.     Exit;
  43.   end;
  44.  
  45.   // parse parameters
  46.   if HasOption('h', 'help') then begin
  47.     WriteHelp;
  48.     Terminate;
  49.     Exit;
  50.   end;
  51.  
  52.   { add your program here }
  53.  
  54.     ss.Init;
  55.   ss.Format := sfFloat32LE;
  56.   ss.Rate := 44100;
  57.   ss.Channels := 1;
  58.   pulse := TPASimple.New(Nil, 'WvW pulseaudio Client', sdRECORD, Nil, 'WvW Qualizer!', @ss, Nil, Nil, @err);
  59.   if not Assigned(pulse) then begin
  60.     Writeln('Failed to connect to PulseAudio server; error: ', err);
  61.     Halt(1);
  62.   end;
  63.  
  64.   Writeln('WVW Server Connected');
  65.  
  66.   repeat
  67.     inc(i);
  68.     if i = 1000 then i:=1;
  69.  
  70.     if pulse^.Read(@buf[0], Length(buf), Nil) < 0 then Continue;
  71.  
  72.    Write('WVW '+IntToStr(i)+' ');
  73.  
  74.    write(buf[0]);
  75.    for X:=1 to Length(buf) do write(buf[X]);
  76.  
  77.    delay(155);
  78.  
  79.   until keypressed;
  80.  
  81.   pulse^.Free;
  82.  
  83.   // stop program loop
  84.   Terminate;
  85. end;
  86.  
  87. constructor TMyApplication.Create(TheOwner: TComponent);
  88. begin
  89.   inherited Create(TheOwner);
  90.   StopOnException:=True;
  91. end;
  92.  
  93. destructor TMyApplication.Destroy;
  94. begin
  95.   inherited Destroy;
  96. end;
  97.  
  98. procedure TMyApplication.WriteHelp;
  99. begin
  100.   { add your help code here }
  101.   writeln('Usage: ', ExeName, ' -h');
  102. end;
  103.  
  104. var
  105.   Application: TMyApplication;
  106. begin
  107.   Application:=TMyApplication.Create(nil);
  108.   Application.Title:='My Application';
  109.   Application.Run;
  110.   Application.Free;
  111. end.
  112.  

Can you please also help debugging this? It does seem to run and give plenty of values. Probably i need more of your expert, to receive audio signal values to writeln in this console application.

Afther hat i can make it more c00l to look in the GUI.

But i do need another small start to receive values.

In the repeat until keypressed loop;

Greetz, Wouter

Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: Fred vS on July 22, 2022, 02:51:33 pm
Code: Pascal  [Select][+][-]
  1. program WVW_PULSE;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}
  7.   cthreads,
  8.   {$ENDIF}
  9.   Classes, SysUtils, CustApp,   pulse_simple, pulse_sample, ctypes, pulse_def, crt;
  10.   { you can add units after this }
  11.  
  12. type
  13.  
  14.   { TMyApplication }
  15.  
  16.   TMyApplication = class(TCustomApplication)
  17.   protected
  18.     procedure DoRun; override;
  19.   public
  20.       pulse: PPASimple;
  21.   ss: TPASampleSpec;
  22.   err: cint;
  23.   buf: array[0..Pred(4096)] of Byte;
  24.   i : integer;
  25.     constructor Create(TheOwner: TComponent); override;
  26.     destructor Destroy; override;
  27.     procedure WriteHelp; virtual;
  28.   end;
  29.  
  30. { TMyApplication }
  31.  
  32. procedure TMyApplication.DoRun;
  33. var
  34.   ErrorMsg: String;
  35.   X : integer;
  36. begin
  37.   // quick check parameters
  38.   ErrorMsg:=CheckOptions('h', 'help');
  39.   if ErrorMsg<>'' then begin
  40.     ShowException(Exception.Create(ErrorMsg));
  41.     Terminate;
  42.     Exit;
  43.   end;
  44.  
  45.   // parse parameters
  46.   if HasOption('h', 'help') then begin
  47.     WriteHelp;
  48.     Terminate;
  49.     Exit;
  50.   end;
  51.  
  52.   { add your program here }
  53.  
  54.     ss.Init;
  55.   ss.Format := sfFloat32LE;
  56.   ss.Rate := 44100;
  57.   ss.Channels := 1;
  58.   pulse := TPASimple.New(Nil, 'WvW pulseaudio Client', sdRECORD, Nil, 'WvW Qualizer!', @ss, Nil, Nil, @err);
  59.   if not Assigned(pulse) then begin
  60.     Writeln('Failed to connect to PulseAudio server; error: ', err);
  61.     Halt(1);
  62.   end;
  63.  
  64.   Writeln('WVW Server Connected');
  65.  
  66.   repeat
  67.     inc(i);
  68.     if i = 1000 then i:=1;
  69.  
  70.     if pulse^.Read(@buf[0], Length(buf), Nil) < 0 then Continue;
  71.  
  72.    Write('WVW '+IntToStr(i)+' ');
  73.  
  74.    write(buf[0]);
  75.    for X:=1 to Length(buf) do write(buf[X]);
  76.  
  77.    delay(155);
  78.  
  79.   until keypressed;
  80.  
  81.   pulse^.Free;
  82.  
  83.   // stop program loop
  84.   Terminate;
  85. end;
  86.  
  87. constructor TMyApplication.Create(TheOwner: TComponent);
  88. begin
  89.   inherited Create(TheOwner);
  90.   StopOnException:=True;
  91. end;
  92.  
  93. destructor TMyApplication.Destroy;
  94. begin
  95.   inherited Destroy;
  96. end;
  97.  
  98. procedure TMyApplication.WriteHelp;
  99. begin
  100.   { add your help code here }
  101.   writeln('Usage: ', ExeName, ' -h');
  102. end;
  103.  
  104. var
  105.   Application: TMyApplication;
  106. begin
  107.   Application:=TMyApplication.Create(nil);
  108.   Application.Title:='My Application';
  109.   Application.Run;
  110.   Application.Free;
  111. end.
  112.  

Can you please also help debugging this?


Hello.

If you use samples as float, like defined in:

Code: Pascal  [Select][+][-]
  1. ss.Format := sfFloat32LE;

you should use a array of float vs byte to store the samples in the buffer:

Code: Pascal  [Select][+][-]
  1.  buf: array[0..Pred(4096)] of cfloat;


Also you will have a range error with this:
 
Code: Pascal  [Select][+][-]
  1. for X:=1 to Length(buf) do write(buf[X]);

Better to use this:
 
Code: Pascal  [Select][+][-]
  1. for X:=1 to high(buf) do write(buf[X]);
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: pascalbythree on July 24, 2022, 03:24:14 pm
So... if i work very long on this piece of source code then i will end up having a graphic equalizer ? or can you supply me with more code/help?


Screenshot so far attached !

code now using:

Code: Pascal  [Select][+][-]
  1.      program WVW_PULSE;
  2.      
  3.     {$mode objfpc}{$H+}
  4.      
  5.     uses
  6.       {$IFDEF UNIX}
  7.       cthreads,
  8.       {$ENDIF}
  9.       Classes, SysUtils, CustApp,   pulse_simple, pulse_sample, ctypes, pulse_def, crt;
  10.       { you can add units after this }
  11.      
  12.     type
  13.      
  14.       { TMyApplication }
  15.      
  16.       TMyApplication = class(TCustomApplication)
  17.       protected
  18.         procedure DoRun; override;
  19.       public
  20.           pulse: PPASimple;
  21.       ss: TPASampleSpec;
  22.       err: cint;
  23.       buf: array[0..Pred(4096)] of Byte;
  24.       i : integer;
  25.         constructor Create(TheOwner: TComponent); override;
  26.         destructor Destroy; override;
  27.         procedure WriteHelp; virtual;
  28.       end;
  29.      
  30.     { TMyApplication }
  31.      
  32.     procedure TMyApplication.DoRun;
  33.     var
  34.       ErrorMsg: String;
  35.       X : integer;
  36.     begin
  37.       // quick check parameters
  38.       ErrorMsg:=CheckOptions('h', 'help');
  39.       if ErrorMsg<>'' then begin
  40.         ShowException(Exception.Create(ErrorMsg));
  41.         Terminate;
  42.         Exit;
  43.       end;
  44.      
  45.       // parse parameters
  46.       if HasOption('h', 'help') then begin
  47.         WriteHelp;
  48.         Terminate;
  49.         Exit;
  50.       end;
  51.      
  52.       { add your program here }
  53.      
  54.         ss.Init;
  55.       ss.Format := sfFloat32LE;
  56.       ss.Rate := 44100;
  57.       ss.Channels := 1;
  58.       pulse := TPASimple.New(Nil, 'WvW pulseaudio Client', sdRECORD, Nil, 'WvW Qualizer!', @ss, Nil, Nil, @err);
  59.       if not Assigned(pulse) then begin
  60.         Writeln('Failed to connect to PulseAudio server; error: ', err);
  61.         Halt(1);
  62.       end;
  63.      
  64.       Writeln('WVW Server Connected');
  65.      
  66.       repeat
  67.         inc(i);
  68.         if i = 1000 then i:=1;
  69.      
  70.         if pulse^.Read(@buf[0], Length(buf), Nil) < 0 then Continue;
  71.      
  72.        Write('WVW '+IntToStr(i)+' ');
  73.      
  74.        writeln('****************************************************************');
  75.            
  76.            for X:=1 to high(buf) do write(IntToStr(x) + ' = ' + IntToStr(buf[X]) + ' ');
  77.      
  78.            writeln('****************************************************************');
  79.          
  80.        delay(155);
  81.      
  82.       until keypressed;
  83.      
  84.       pulse^.Free;
  85.      
  86.       // stop program loop
  87.       Terminate;
  88.     end;
  89.      
  90.     constructor TMyApplication.Create(TheOwner: TComponent);
  91.     begin
  92.       inherited Create(TheOwner);
  93.       StopOnException:=True;
  94.     end;
  95.      
  96.     destructor TMyApplication.Destroy;
  97.     begin
  98.       inherited Destroy;
  99.     end;
  100.      
  101.     procedure TMyApplication.WriteHelp;
  102.     begin
  103.       { add your help code here }
  104.       writeln('Usage: ', ExeName, ' -h');
  105.     end;
  106.      
  107.     var
  108.       Application: TMyApplication;
  109.     begin
  110.       Application:=TMyApplication.Create(nil);
  111.       Application.Title:='My Application';
  112.       Application.Run;
  113.       Application.Free;
  114.     end.
  115.      
  116.  
  117.  
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: Fred vS on July 24, 2022, 04:16:37 pm
So... if i work very long on this piece of source code then i will end up having a graphic equalizer ? or can you supply me with more code/help?


Screenshot so far attached !

code now using:

Code: Pascal  [Select][+][-]
  1.      program WVW_PULSE;
  2.      
  3.     {$mode objfpc}{$H+}
  4.      
  5.     uses
  6.       {$IFDEF UNIX}
  7.       cthreads,
  8.       {$ENDIF}
  9.       Classes, SysUtils, CustApp,   pulse_simple, pulse_sample, ctypes, pulse_def, crt;
  10.       { you can add units after this }
  11.      
  12.     type
  13.      
  14.       { TMyApplication }
  15.      
  16.       TMyApplication = class(TCustomApplication)
  17.       protected
  18.         procedure DoRun; override;
  19.       public
  20.           pulse: PPASimple;
  21.       ss: TPASampleSpec;
  22.       err: cint;
  23.       buf: array[0..Pred(4096)] of Byte;
  24.       i : integer;
  25.         constructor Create(TheOwner: TComponent); override;
  26.         destructor Destroy; override;
  27.         procedure WriteHelp; virtual;
  28.       end;
  29.      
  30.     { TMyApplication }
  31.      
  32.     procedure TMyApplication.DoRun;
  33.     var
  34.       ErrorMsg: String;
  35.       X : integer;
  36.     begin
  37.       // quick check parameters
  38.       ErrorMsg:=CheckOptions('h', 'help');
  39.       if ErrorMsg<>'' then begin
  40.         ShowException(Exception.Create(ErrorMsg));
  41.         Terminate;
  42.         Exit;
  43.       end;
  44.      
  45.       // parse parameters
  46.       if HasOption('h', 'help') then begin
  47.         WriteHelp;
  48.         Terminate;
  49.         Exit;
  50.       end;
  51.      
  52.       { add your program here }
  53.      
  54.         ss.Init;
  55.       ss.Format := sfFloat32LE;
  56.       ss.Rate := 44100;
  57.       ss.Channels := 1;
  58.       pulse := TPASimple.New(Nil, 'WvW pulseaudio Client', sdRECORD, Nil, 'WvW Qualizer!', @ss, Nil, Nil, @err);
  59.       if not Assigned(pulse) then begin
  60.         Writeln('Failed to connect to PulseAudio server; error: ', err);
  61.         Halt(1);
  62.       end;
  63.      
  64.       Writeln('WVW Server Connected');
  65.      
  66.       repeat
  67.         inc(i);
  68.         if i = 1000 then i:=1;
  69.      
  70.         if pulse^.Read(@buf[0], Length(buf), Nil) < 0 then Continue;
  71.      
  72.        Write('WVW '+IntToStr(i)+' ');
  73.      
  74.        writeln('****************************************************************');
  75.            
  76.            for X:=1 to high(buf) do write(IntToStr(x) + ' = ' + IntToStr(buf[X]) + ' ');
  77.      
  78.            writeln('****************************************************************');
  79.          
  80.        delay(155);
  81.      
  82.       until keypressed;
  83.      
  84.       pulse^.Free;
  85.      
  86.       // stop program loop
  87.       Terminate;
  88.     end;
  89.      
  90.     constructor TMyApplication.Create(TheOwner: TComponent);
  91.     begin
  92.       inherited Create(TheOwner);
  93.       StopOnException:=True;
  94.     end;
  95.      
  96.     destructor TMyApplication.Destroy;
  97.     begin
  98.       inherited Destroy;
  99.     end;
  100.      
  101.     procedure TMyApplication.WriteHelp;
  102.     begin
  103.       { add your help code here }
  104.       writeln('Usage: ', ExeName, ' -h');
  105.     end;
  106.      
  107.     var
  108.       Application: TMyApplication;
  109.     begin
  110.       Application:=TMyApplication.Create(nil);
  111.       Application.Title:='My Application';
  112.       Application.Run;
  113.       Application.Free;
  114.     end.
  115.      
  116.  
  117.  

Hello.

With your code you get the value of each sample stored in the buffer.
Using sfFloat32LE the value is befween -1 / 1 and will be translated by the sound card into electric current for the loudspeakers.


Quote
i will end up having a graphic equalizer

Hum, a graphic equalizer change the value of the data, is it what you want?
Or maybe you want a graphic spectrum representation of the data?

See picture, the first panel is a graphic spectrum and the second is a graphic equalizer where you can change the values.
In both case you will need to apply DSP filters to the data of he buffer, using Fourier transform, to get/set the frequencies.
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: Fred vS on July 24, 2022, 04:37:02 pm
Code: Pascal  [Select][+][-]
  1. buf: array[0..Pred(4096)] of Byte;
  2. ....
  3. ss.Format := sfFloat32LE;
  4. ...
  5. for X:=1 to high(buf) do write(IntToStr(x) + ' = ' + IntToStr(buf[X]) + ' ');

Re-hum, like explained in previous posts, buf should be a array of float and not of byte:
I let you with your code beause, obviously, you dont read/answer to my posts.
And excuse me for trying to help you.

Good luck.
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: pascalbythree on July 24, 2022, 06:16:28 pm
Can you please send me up the FPC code for the Panneau Dock 1 ? Greetz, Wouter.

That will be great help.!

PS:

"a graphic spectrum representation of the data"

is the end task. From a 3.5mm line or Microphone Input
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: Fred vS on July 24, 2022, 06:39:03 pm
Can you please send me up the FPC code for the Panneau Dock 1 ? Greetz, Wouter.

That will be great help.!

Sorry but it uses the "to complex" uos audio-pack.  :-[

The Panneau Dock 1 is part of the StrumPract (https://github.com/fredvs/strumpract/) project that uses msegui and uos.

In uos demos there is a uos simple console app to show spectrum:
https://github.com/fredvs/uos/blob/main/examples/consolespectrum.pas

Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: Fred vS on July 25, 2022, 01:09:49 am
In uos demos there is a uos simple console app to show spectrum:
https://github.com/fredvs/uos/blob/main/examples/consolespectrum.pas

Ooops, that demo was not updated with last uos methods.
The same for the LCL demo FormSpectrum.

This was fixed in last commit of uos, done just now.
Sorry for the trouble if you did try to compile those demos.

Those demos use a audio file as input.

If you want the same result with the input of the device, like a mic, change the line:
Code: Pascal  [Select][+][-]
  1. InputIndex1 := uos_AddFromFile(PlayerIndex1,(pchar(SoundFilename)));

with this.
Code: Pascal  [Select][+][-]
  1. InputIndex1 := uos_AddFromDevIn(PlayerIndex1);  // To use the device input, like mic.
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: pascalbythree on July 25, 2022, 12:28:35 pm
   // Spectrum : create  bandpass filters with alsobuf set to false, how many you want:
   
Code: Pascal  [Select][+][-]
  1.  uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 10000,20000, 1, -1, 10000,20000, 1, false, nil);
  2.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 6000, 10000, 5, -1, 6000, 10000, 5, false, nil);
  3.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 4000, 6000,  5, -1, 4000, 6000,  5, false, nil);
  4.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 2500, 4000,  5, -1, 2500, 4000,  5, false, nil);
  5.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 1000, 2500,  5, -1, 1000, 2500,  5, false, nil);
  6.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 700,  1000,  5, -1, 700,  1000,  5, false, nil);
  7.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 500,  700,   5, -1, 500,  700,   5, false, nil);
  8.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 300,  500,   5, -1, 300,  500,   5, false, nil);

And did i give the right paramaters for uos_InputAddFilter, like above ? Grtz W
Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: Fred vS on July 25, 2022, 01:12:13 pm
   // Spectrum : create  bandpass filters with alsobuf set to false, how many you want:
   
Code: Pascal  [Select][+][-]
  1.  uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 10000,20000, 1, -1, 10000,20000, 1, false, nil);
  2.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 6000, 10000, 5, -1, 6000, 10000, 5, false, nil);
  3.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 4000, 6000,  5, -1, 4000, 6000,  5, false, nil);
  4.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 2500, 4000,  5, -1, 2500, 4000,  5, false, nil);
  5.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 1000, 2500,  5, -1, 1000, 2500,  5, false, nil);
  6.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 700,  1000,  5, -1, 700,  1000,  5, false, nil);
  7.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 500,  700,   5, -1, 500,  700,   5, false, nil);
  8.      uos_InputAddFilter(PlayerIndex1, InputIndex1, -1, 300,  500,   5, -1, 300,  500,   5, false, nil);

And did i give the right paramaters for uos_InputAddFilter, like above ? Grtz W

More or less...  ;)

Tip: If you are using Lazarus, do Ctrl+Click on uos_InputAddFilter and it will jump to the declaration of the method with all the infos in comment.

So, for a spectrum-frequencies filter, use those parameters (take a look at consolespectrum or formspectrum demo):

Code: Pascal  [Select][+][-]
  1.  uos_InputAddFilter(PlayerIndex1, InputIndex1,
  2.             3, 10000,20000, 1,
  3.             3, 10000,20000, 1, False, nil);
  4.  
  5.         uos_InputAddFilter(PlayerIndex1, InputIndex1,
  6.             3, 6000,10000, 1,
  7.             3, 6000,10000, 1, False, nil);
  8.  
  9.         uos_InputAddFilter(PlayerIndex1, InputIndex1,
  10.             3, 4000,6000, 1,
  11.             3, 4000,6000, 1, False, nil);
  12.            
  13.            uos_InputAddFilter(PlayerIndex1, InputIndex1,
  14.             3, 2500,4000, 1,
  15.             3, 2500,4000, 1, False, nil);
  16.  
  17.         uos_InputAddFilter(PlayerIndex1, InputIndex1,
  18.             3, 1000, 2500, 1,
  19.             3, 1000, 2500, 1, False, nil);
  20.  
  21.         uos_InputAddFilter(PlayerIndex1, InputIndex1,
  22.             3, 700,1000, 1,
  23.             3, 700,1000, 1, False, nil);
  24.            
  25.            uos_InputAddFilter(PlayerIndex1, InputIndex1,
  26.             3, 500,700, 1,
  27.             3, 500,700, 1, False, nil);
  28.  
  29.         uos_InputAddFilter(PlayerIndex1, InputIndex1,
  30.             3, 300,500, 1,
  31.             3, 300,500, 1, False, nil);


PS: To use-install uos, just download the source from https://github.com/fredvs/uos, using the green button Code + Download zip.
Then unzip the code somewhere and with Lazarus click on open project and choose /uos/examples/formspectrum.lpi.
Nothing more needs to be installed.

Title: Re: Audio component pack for Microphone in support, Raspberry
Post by: pascalbythree on November 30, 2022, 01:43:50 pm
https://github.com/andrewd207/PascalAudio

https://github.com/andrewd207/fpc-pulseaudio

Jow!, After finishing up another project, i am asking weither somebody knows the right versions for FPC and LAZARUS to compile eatch one of the components as in URL above ?

Greets, Wouter van Wegen --> PascalByThree

I am re-installing linux mint. Later i have to compile it on a RPI3. First see how it goes on the PC side.

PS: I also questioned it in another topic. Othewise:

https://forum.lazarus.freepascal.org/index.php?topic=61423.msg462102#msg462102
TinyPortal © 2005-2018