Author Topic: Pure Pascal Mp3/Flac player  (Read 1080 times)

Tomxe

  • Full Member
  • ***
  • Posts: 190
Pure Pascal Mp3/Flac player
« on: July 25, 2026, 09:29:52 am »
TXelAudio is a class which can load, save to and play WAV, MP3, AIFF, CAF, AU, FLAC, OGG VORBIS, XM, IT, S3M and MOD. It can also edit sound files (cut, fade in, fade out etc.).

It's available in OPM.

Code: Pascal  [Select][+][-]
  1.   if not OpenDialog1.Execute then Exit;
  2.  
  3.   a := TXelAudio.Create;
  4.   a.LoadFromFile(OpenDialog1.Filename);
  5.   a.Cut(67.5); //seconds
  6.   a.SaveToFile('output.wav');
  7.   a.SaveToFile('output.mp3', 128); //second paramater is bitrate in kbit/s. From 112 to 320 in case of mp3
  8.   a.Play;
  9.   a.Free;

alaa123456789

  • Sr. Member
  • ****
  • Posts: 263
  • Try your Best to learn & help others
    • youtube:
Re: Pure Pascal Mp3/Flac player
« Reply #1 on: July 31, 2026, 04:05:06 pm »
TXelAudio is a class which can load, save to and play WAV, MP3, AIFF, CAF, AU, FLAC, OGG VORBIS, XM, IT, S3M and MOD. It can also edit sound files (cut, fade in, fade out etc.).

It's available in OPM.

Code: Pascal  [Select][+][-]
  1.   if not OpenDialog1.Execute then Exit;
  2.  
  3.   a := TXelAudio.Create;
  4.   a.LoadFromFile(OpenDialog1.Filename);
  5.   a.Cut(67.5); //seconds
  6.   a.SaveToFile('output.wav');
  7.   a.SaveToFile('output.mp3', 128); //second paramater is bitrate in kbit/s. From 112 to 320 in case of mp3
  8.   a.Play;
  9.   a.Free;

didnt find it on opm

cdbc

  • Hero Member
  • *****
  • Posts: 2964
    • http://www.cdbc.dk
Re: Pure Pascal Mp3/Flac player
« Reply #2 on: July 31, 2026, 07:55:22 pm »
Hi
Then "Use the source Luke"
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

wp

  • Hero Member
  • *****
  • Posts: 13687
Re: Pure Pascal Mp3/Flac player
« Reply #3 on: July 31, 2026, 08:07:07 pm »
It's available in OPM.
didnt find it on opm
It should be there - just looked for it. Search for "XelAudio".

avra

  • Hero Member
  • *****
  • Posts: 2601
    • Additional info
Re: Pure Pascal Mp3/Flac player
« Reply #4 on: August 02, 2026, 02:29:33 pm »
  a.SaveToFile('output.mp3', 128); //second paramater is bitrate in kbit/s. From 112 to 320 in case of mp3

Why imentioning 112 as a lower limit? What about 96, 64 and lower? FBitrate is an integer so these should be accepted as well.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Tomxe

  • Full Member
  • ***
  • Posts: 190
Re: Pure Pascal Mp3/Flac player
« Reply #5 on: August 02, 2026, 07:19:38 pm »
Because 112-320 works pretty well. <112 has some issues that should be fixed in the future.
But then again- mp3s below 112 kbit/s cannot be high quality, no matter what encoder they come from.

dtoffe

  • Jr. Member
  • **
  • Posts: 67
Re: Pure Pascal Mp3/Flac player
« Reply #6 on: August 04, 2026, 01:39:48 am »
Because 112-320 works pretty well. <112 has some issues that should be fixed in the future.
But then again- mp3s below 112 kbit/s cannot be high quality, no matter what encoder they come from.

Old phone lines limited audio to something like 4 khz or 8 khz, and the voices on the other side were understood. Sometimes you do not need music audio quality.

Daniel

Tomxe

  • Full Member
  • ***
  • Posts: 190
Re: Pure Pascal Mp3/Flac player
« Reply #7 on: October 03, 2026, 11:27:51 am »
XelAudio package has been updated in the OPM. It can now read more formats:

- MP3
- OGG Vorbis
- AAC
- AC3
- E-AC3
- AIFF
- AU
- CAF
- FLAC
- WAV

It can read audio tracks from:
- AVI
- MKV
- MP4/M4A



 

TinyPortal © 2005-2018