Recent

Author Topic: Needed a simple audio player component  (Read 6209 times)

Davo

  • Full Member
  • ***
  • Posts: 134
Needed a simple audio player component
« on: May 29, 2014, 03:48:56 pm »
I'm building a spoken countdown clock and need a very simple component that will play pre-recorded voice files. I've searched and read the many references to audio in the Lazarus Forum but am uncertain how to proceed. Can you please suggest a suitable component?

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Needed a simple audio player component
« Reply #1 on: May 29, 2014, 04:10:15 pm »
I don't know about "component" but there's many libraries around. Usually, they are just headers to cross-platform third-party libraries (written in C, like PortAudio). If your files are MP3, search for headers to MPG123 library. Or try search for UOS, maintained by FredVS - forum member.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Davo

  • Full Member
  • ***
  • Posts: 134
Re: Needed a simple audio player component
« Reply #3 on: May 31, 2014, 05:03:52 pm »
Thanks for your replies Blaazen and BigChimp. Your assistance is really appreciated.

I tried the uos player and did successfully incorporate it into my application. It's a great player but it is really overkill for what I want. Since I don't mind my application being restricted to Windows I turned instead to the plain vanilla call playsound(filepath,0,0) which is sufficient for my purposes. As for the volume control I used a trackbar named tbVolumeControl and modified a code snippet that I found on another thread as follows :

procedure Tcontrolpanel.tbVolumeChange(Sender: TObject);
var
  MyWaveOutCaps: TWaveOutCaps;
  Volume: LongInt;
begin
  Volume:= 50000 * tbVolume.position div 100;
  if WaveOutGetDevCaps(
    WAVE_MAPPER,
    @MyWaveOutCaps,
    sizeof(MyWaveOutCaps))=MMSYSERR_NOERROR then
      WaveOutSetVolume(WAVE_MAPPER, Volume);
end;


Again thanks for your help.

 

metis

  • Sr. Member
  • ****
  • Posts: 301
Re: Needed a simple audio player component
« Reply #4 on: June 27, 2014, 06:16:42 pm »
Hi Davo,

ever tried "eSpeak" ?

http://espeak.sourceforge.net/

metis
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

 

TinyPortal © 2005-2018