× General discussions, feature requests for CodeTyphon Project and discussions that don't fit in any of the other specific CodeTyphon forum categories.

Question How To PLAY a sound wav or mp3 in my Project??

  • lestroso
  • lestroso's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 3 months ago #9767 by lestroso
Hi to everybody,

is there a simple manner to play a sound once or when i want??

I have already seen all the Ocean example... but they are too complicated!!!

A simple manner?? a simple Library?? Any Idea??

Thanks A lot,

lestroso :blush:

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
4 years 3 months ago - 4 years 3 months ago #9772 by Sternas Stefanos
Replied by Sternas Stefanos on topic How To PLAY a sound wav or mp3 in my Project??
Sir
my suggestion is pl_OpenALS library of CodeTyphon Studio
CodeOcean has samples and all runtime libraries
codetyphon\CodeOcean\0_libraries

PilotLogic Architect and Core Programmer
Last edit: 4 years 3 months ago by Sternas Stefanos.
The following user(s) said Thank You: lestroso

Please Log in or Create an account to join the conversation.

  • lestroso
  • lestroso's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 3 months ago #9773 by lestroso
Replied by lestroso on topic How To PLAY a sound wav or mp3 in my Project??
Thanks a lot Sternas.....I'll take a look!!! Best regards,

Lestroso :woohoo:

Please Log in or Create an account to join the conversation.

  • Fred
  • Visitor
  • Visitor
4 years 3 months ago - 4 years 3 months ago #9775 by Fred
Hello.

There is also uos ( github.com/fredvs/uos ).

Libraries for Windows, Linux, RPI, FreeBSD, OSX are included.
Examples for LCL, fpGUI, MSE and console are included too. (working out of the box).

Sadly the pl_UOS library included in Code Typhon is out of date (use, please, last commits of github.com/fredvs/uos )

PS: @ Sternas, you are welcome, when you have time, to commit the (lot of) changes from uos-GitHub. :blush:

Fre;D
Last edit: 4 years 3 months ago by Fred.

Please Log in or Create an account to join the conversation.

  • lestroso
  • lestroso's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 3 months ago #9777 by lestroso
Replied by lestroso on topic How To PLAY a sound wav or mp3 in my Project??
Dear Fred,

I thank you so much!!!! I appriciate a lot your answer!!! I 'll take a look.. i hope will easy to use...Thanks a lot again,

Lestroso :woohoo:

Please Log in or Create an account to join the conversation.

  • lestroso
  • lestroso's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 3 months ago - 4 years 3 months ago #9778 by lestroso
Replied by lestroso on topic How To PLAY a sound wav or mp3 in my Project??
Dear friend, i have found a way very easy to play a sound but only in windows,,..works also well in windows10!!!!
Best regards,
lestroso :woohoo:
Playing Sounds
Windows only: using the Windows API

You can use the Windows API to play e.g. wav files:

...
uses MMSystem;
...
sndPlaySound('C:\sounds\test.wav', snd_Async or snd_NoDefault);

The fail-safe way, which will allow appending paths and nonlatin file names is:

sndPlaySound(pchar(UTF8ToSys('C:\sounds\test.wav')), snd_Async or snd_NoDefault);

This works very fine in Typhon!!!!! Cheers, Lestroso :woohoo:
Last edit: 4 years 3 months ago by lestroso.

Please Log in or Create an account to join the conversation.

  • Fred
  • Visitor
  • Visitor
4 years 3 months ago #9779 by Fred
@ lestroso : Nice but you will not be able to change volume, nor do a seek, nor apply DSP effect, nor have view meters, ...

Fre;D

Please Log in or Create an account to join the conversation.

  • lestroso
  • lestroso's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 3 months ago #9780 by lestroso
Replied by lestroso on topic How To PLAY a sound wav or mp3 in my Project??
Hi Fred,

it's complicated your library....and there're no instructions how to use it. Also webplayer go for me in Crash!!!

In any case thanks a lot...

best regards,

lestroso :woohoo:

Please Log in or Create an account to join the conversation.

  • Fred
  • Visitor
  • Visitor
4 years 3 months ago #9781 by Fred
Hello.

it's complicated your library....and there're no instructions how to use it.


In the Code-Typhon forum : www.pilotlogic.com/sitejoom/index.php/fo...-version-1-0-is-here

Also in the wiki : wiki.freepascal.org/uos

But the best instructions are in the comments of uos.pas code and in examples.


Also webplayer go for me in Crash!!!


With what os (Windows/Linux/osx) ? When do it crash ?

Fre;D

Please Log in or Create an account to join the conversation.

  • lestroso
  • lestroso's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 3 months ago - 4 years 3 months ago #9782 by lestroso
Replied by lestroso on topic How To PLAY a sound wav or mp3 in my Project??
Hi Fred!!

Thanks for theinstructions links...i'll see them as soon as possible....

Well webplayer crash.. i don't know why...when i push button to play...Crash..... I'm using WINDOW10 and HP PAVILLON G SERIES 4 gb ram corei5 64bit.
One question Fred... Is it possible with your library enclose a sound in the final exe??? without loading external data folder???

Best Regards,

Lestroso :lol:
Last edit: 4 years 3 months ago by lestroso.

Please Log in or Create an account to join the conversation.

  • Fred
  • Visitor
  • Visitor
4 years 3 months ago - 4 years 3 months ago #9783 by Fred

Well webplayer crash.. i don't know why...when i push button to play...Crash..... I'm using WINDOW10 and HP PAVILLON G SERIES 4 gb ram corei5 64bit.


Oooops, I just tested it with Windows 10 and, indeed, it crash. :(
I will fix it asap (aaargh, sure new pseudo-protection done by Microsoft for web-access ).
The good news is that webplayer tested on last Linux and FreeBSD is working ok.


Is it possible with your library enclose a sound in the final exe??? without loading external data folder???

If you store your audio-file into resource (.res) and compile it with the exe => of course it is possible.

Fre;D
Last edit: 4 years 3 months ago by Fred.

Please Log in or Create an account to join the conversation.

  • Fred
  • Visitor
  • Visitor
4 years 3 months ago #9786 by Fred

lestroso wrote: Hi Fred!!
Well webplayer crash...
Lestroso :lol:


Hello.

OK, fixed in last release ( github.com/fredvs/uos )

Many thanks to note it.

Fre;D

Please Log in or Create an account to join the conversation.

  • lestroso
  • lestroso's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
4 years 3 months ago #9787 by lestroso
Replied by lestroso on topic How To PLAY a sound wav or mp3 in my Project??
Your welcome Fred....Thanks again a lot...

but do you know how to enclose sound as resource in .rsc file in typhon?? Thanks Fred....

Bye

Lestroso :(

Please Log in or Create an account to join the conversation.

  • Fred
  • Visitor
  • Visitor
4 years 3 months ago - 4 years 3 months ago #9788 by Fred

lestroso wrote: but do you know how to enclose sound as resource in .rsc file in typhon??
Lestroso :(



wiki.freepascal.org/Lazarus_Resources

Fre;D
Last edit: 4 years 3 months ago by Fred.

Please Log in or Create an account to join the conversation.