Re: [fpc-pascal] playing sound files (linux and windows)
On Tue, Jun 15, 2010 at 10:28 AM, Henry Vermaak henry.verm...@gmail.comwrote: On 15 June 2010 08:37, Alexander Grau a...@grauonline.de wrote: For Linux, I think it can be simple as opening a file and writing the raw audio data to it - using a simple WAV header reader or even an MP3 decoder for FPC, it should be possible to directly use the sound device (/dev/dsp): Note that OSS is deprecated, so this solution won't last very long. True. I've written my last OSS-only application a year ago and it didn't work on over 50% of computers I've tried it on. Now I use Alsa or Jack. Jack is very simple to use and very powerfull, but not available everywhere. Alsa is everywhere. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Op 2010-06-14 17:31, Henry Vermaak het geskryf: Note that the fpc libsndfile example is outdated (it uses oss). There Outdated is correct. The version in FPC 2.4.1 doesn't currently compile, and references data structures not defined in the libsndfile unit. I have a ESD (Esound daemon) header conversion that plays a single file perfect on multiple linux distro's, but when I try and play multiple files in succession, it plays all of them at the same time and doesn't wait for one to complete before starting the next. There doesn't seem much help on libesd either, but I'll take another look today. :-( If you're not worried about gpl, then I'd probably use libao. As long as it is very simple to deploy, or better, included with most linux distros, then it's better. My sound requirements is not very high. As long as I can play wav, ogg or mp3 (any format will do really, but mp3 is not standard with Linux) and play one file after the other without delays. I have random sound clips that together make up a English or Afrikaans sentence. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Op 2010-06-14 15:37, Graeme Geldenhuys het geskryf: Has anybody managed to play sound files under both Linux and Windows? Thanks for everybody's responses. I'll work my way through all of them today. Now I understand all the comments on the net about the state of audio (and gaming) on Linux. It's a damn mess with 1000's of options and each one in a different state of development or functionality. Has anybody tried SDL (Simple-Direct-Media)? I know SDL Graphics works well with Free Pascal, but not sure about the Audio part. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On Tue, Jun 15, 2010 at 10:44 AM, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Op 2010-06-14 15:37, Graeme Geldenhuys het geskryf: Has anybody tried SDL (Simple-Direct-Media)? I know SDL Graphics works well with Free Pascal, but not sure about the Audio part. Audio works just fine. You can use SDL_Mixer library (though it has its own glitches). thanks, dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
dmitry boyarintsev schrieb: On Tue, Jun 15, 2010 at 11:37 AM, Alexander Grau a...@grauonline.de wrote: This is not the most elegant (or easiest) solution, however it has no dependencies to any libraries :) The solution still depends upon decompression libraries. However, they can be statically linked. Yes, correct - I was assuming that uncompressed WAV files are being used - For compressed audio data, there might exist decompressors and decoders for FPC already ... or at least Delphi code for it :-) thanks, dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Mit freundlichen Grüßen/Best regards Alexander Grau Grau GbR Hardware Software Solutions Eschenweg 12 32609 Huellhorst Germany www.grauonline.de Tel: +49 (0) 5741 2301259 Fax: +49 (0) 5741 235530 E-Mail: i...@grauonline.de ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On 15 June 2010 07:44, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Op 2010-06-14 15:37, Graeme Geldenhuys het geskryf: Has anybody managed to play sound files under both Linux and Windows? Thanks for everybody's responses. I'll work my way through all of them today. Now I understand all the comments on the net about the state of audio (and gaming) on Linux. It's a damn mess with 1000's of options and each one in a different state of development or functionality. You'll probably find that there's 1000's of sound libraries for windows, too. There are different concepts here: sound architecture in the kernel (alsa, oss (deprecated)), sound daemons (pulseaudio, jack, arts, esd), file format reading/writing and decoding of codecs (mp3, ogg, etc). On top of these you get the libraries that try and make this cross platform. You can do _very_ cool things with audio on linux. I've got a friend that runs a recording studio on ubuntu :) Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On 15 June 2010 08:37, Alexander Grau a...@grauonline.de wrote: For Linux, I think it can be simple as opening a file and writing the raw audio data to it - using a simple WAV header reader or even an MP3 decoder for FPC, it should be possible to directly use the sound device (/dev/dsp): Note that OSS is deprecated, so this solution won't last very long. I think for getting a simple playSoundFile() API to FPC/LCL on all platforms, dependencies to 3rd-party libs can be avoided. If you want you program to be a good desktop citizen, you should talk directly to the sound daemon (pulse on gnome, phonon on kde?). Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
In our previous episode, Henry Vermaak said: I think for getting a simple playSoundFile() API to FPC/LCL on all platforms, dependencies to 3rd-party libs can be avoided. If you want you program to be a good desktop citizen, you should talk directly to the sound daemon (pulse on gnome, phonon on kde?). The fact that they are different is the main problem there. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On 15 June 2010 09:30, Marco van de Voort mar...@stack.nl wrote: In our previous episode, Henry Vermaak said: I think for getting a simple playSoundFile() API to FPC/LCL on all platforms, dependencies to 3rd-party libs can be avoided. If you want you program to be a good desktop citizen, you should talk directly to the sound daemon (pulse on gnome, phonon on kde?). The fact that they are different is the main problem there. Yes, it makes it harder. Just like gtk vs qt. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Op 2010-06-14 18:26, Vladimir Zhirov het geskryf: One more option I know of is Audorra (http://audorra.sourceforge.net/). I have not used it though, so no idea about its advantages/drawbacks. Some feedback for general FPC users thinking of using Audorra. It's 32-bit only and after some hacking (removing libc unit and cinerella dependencies) I got it compiled under 64-bit Linux. Unfortunately being able to compile it doesn't mean much. The LCL demo crashes at runtime. So out-of-the-box experience is not very nice. I'll try and create a audio-only console demo to see how that goes. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Some more feedback. I found ACS in Lazarus wiki sight and in Lazarus-CCR subversion repository. This is very old and outdated. It requires libc (kylix compatibility) unit and is x86 and 32-bit only. It has some ASM code in there (yuck!). So this was a non-starter for me. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Op 2010-06-14 18:28, dmitry boyarintsev het geskryf: There's proper example in FCL how to use OpenAL to play .wav, .ogg .mp3 files. I can't find an example for loading a .wav file. I managed to extract the initialization and finalization code for OpenAL from the FCL examples, but now the main part is the call alSourcePlay(buffer) , but I don't know how to populate the buffer with a WAV file. Any hints or sample code. The sample included in FCL 2.4.1 loads MAD, A52, OGG and ModPlug only. Google revealed a tutorial using AlutLoadWavFile(), but that is in the unofficial utilities library, it's not part of the standard OpenAL 1.1 spec, and not included in Linux. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
If you can wait a few days, I'll extract a working windows/linux demo from my sourcode for you. Right now I'm really busy. - PŮVODNÍ ZPRÁVA - Od: Graeme Geldenhuys graemeg.li...@gmail.com Komu: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org Předmět: Re: [fpc-pascal] playing sound files (linux and windows) Datum: 15.6.2010 - 13:29:43 Op 2010-06-14 18:28, dmitry boyarintsev het geskryf: There's proper example in FCL how to use OpenAL to play .wav, .ogg .mp3 files. I can't find an example for loading a .wav file. I managed to extract the initialization and finalization code for OpenAL from the FCL examples, but now the main part is the call alSourcePlay(buffer) , but I don't know how to populate the buffer with a WAV file. Any hints or sample code. The sample included in FCL 2.4.1 loads MAD, A52, OGG and ModPlug only. Google revealed a tutorial using AlutLoadWavFile(), but that is in the unofficial utilities library, it's not part of the standard OpenAL 1.1 spec, and not included in Linux. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Kaspersky Internet Security 2010 + Kaspersky Mobile Security jen za 1199,-Kč. Ochraňte svůj počítač i mobil před zneužitím či ztrátou dat. Kupte si 2 produkty za cenu jednoho. www.kaspersky.cz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Op 2010-06-15 13:30, vt...@volny.cz het geskryf: If you can wait a few days, I'll extract a working windows/linux demo from my sourcode for you. Right now I'm really busy. That would be great thanks. I can wait... the sound support is for a new project that has no official starting date yet. I'm just gathering features and what FPC supports for that project. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On Tue, Jun 15, 2010 at 3:29 PM, Graeme Geldenhuys graemeg.li...@gmail.com wrote: I can't find an example for loading a .wav file. I managed to extract the initialization and finalization code for OpenAL from the FCL examples, but now the main part is the call alSourcePlay(buffer) , but I don't know how to populate the buffer with a WAV file. You can download the sample from here: http://havefunsoft.com/fpc/wavetest.zip The test has been modified to support .wav files. Be warned, waveutils.pas is able to read uncompressed wav PCM files only. If .wav file uses anykind of the compression it would impossible to read it. Most of sound-processing applications allow to convert .wav to uncompressed form. thanks, dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Graeme Geldenhuys wrote: I can't find an example for loading a .wav file. [...] Any hints or sample code. The sample included in FCL 2.4.1 loads MAD, A52, OGG and ModPlug only. Google revealed a tutorial using AlutLoadWavFile(), but that is in the unofficial utilities library, it's not part of the standard OpenAL 1.1 spec, and not included in Linux. ALUT is included in Linux, although usually in a separate package (libalut*). ALUT is somewhat official, that is it's development is coordinated on the same mailing list and, although separate to openal, I don't think it will die so soon :) ALUT spec is on http://connect.creativelabs.com/openal/Documentation/The%20OpenAL%20Utility%20Toolkit.htm That said, loading uncompressed WAV files is quite easy, you can see my code on https://vrmlengine.svn.sourceforge.net/svnroot/vrmlengine/trunk/kambi_vrml_game_engine/src/audio/soundfile.pas Look for TSoundWAV.CreateFromStream method. Michalis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] playing sound files (linux and windows)
Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? If so, what sound format's are supported? ogg, wav, mp3? -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On 14 June 2010 14:37, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? fpc has bindings for libsndfile, which according to the website can read/write wav and ogg, among others. Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Graeme Geldenhuys schrieb: Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? If so, what sound format's are supported? ogg, wav, mp3? We have developed some kind of API to play a .wav file on both Windows and Mac. The Windows version is easy (below), the Mac version is long (400 lines). If someone would like to add a PlaySoundFile API to LCL/FPC, drop me a note and we will donate the Mac code for it :-) ... Regards, Alexander uses windows, mmsystem; procedure PlaySoundFile(filename: string); begin PlaySound(pchar(filename), 0, SND_FILENAME + SND_ASYNC); end; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On 14 June 2010 15:59, Graeme Geldenhuys graemeg.li...@gmail.com wrote: On 14/06/2010, Alexander Grau wrote: If someone would like to add a PlaySoundFile API to LCL/FPC, drop me a note and we will donate the Mac code for it :-) ... Thanks for that. A quick test removing the SND_ASYNC option plays multiple sound files in quick succession - just what I wanted. I'll experiment with libsndfile tomorrow, to see if I can accomplish the same under Linux. Note that the fpc libsndfile example is outdated (it uses oss). There is an example in the libsndfile source for how to play this with alsa. If you're not worried about gpl, then I'd probably use libao. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Hi Graeme Am 14.06.2010 um 15:37 schrieb Graeme Geldenhuys: Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? UltraStarDeluxe uses ffmpeg for decoding and portaudio, a C library, for playback of the stream. Corresponding headers are here: http://ultrastardx.svn.sourceforge.net/viewvc/ultrastardx/trunk/src/lib/ If so, what sound format's are supported? ogg, wav, mp3? yes, and probably even more. Regards, - Graeme - Greetings - Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On Mon, Jun 14, 2010 at 5:37 PM, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? I'd offer using OpenAL, however it requires proper libraries to be installed on Linux (afaik installed by default in all modern desktop distribs), and proper .dlls available for Windows. There's proper example in FCL how to use OpenAL to play .wav, .ogg .mp3 files. thanks, dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Has anybody managed to play sound files under both Linux and Windows? One more option I know of is Audorra (http://audorra.sourceforge.net/). I have not used it though, so no idea about its advantages/drawbacks. -- Regards, Vladimir Zhirov ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
dmitry boyarintsev skalogryz.li...@gmail.com wrote: On Mon, Jun 14, 2010 at 5:37 PM, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? I'd offer using OpenAL, however it requires proper libraries to be installed on Linux (afaik installed by default in all modern desktop distribs), and proper .dlls available for Windows. There's proper example in FCL how to use OpenAL to play .wav, .ogg .mp3 files. I second that, AL is worth considering. It was very easy for me to use, at least once I found a decent WAV loader. I have a little OpenAL kit for the Mac here: http://www.ragnemalm.se/lightweight/openal_fpc.zip On the Mac it it great: always installed, much better API than Core Audio, and portable. Havn't tried it on Linux och Windows though. And there is one problem that AL doesn't help me with (apart from loading WAV) and that is to play music. Uncompressed sound isn't useful for music. I can play that with Quicktime, but I'd like to use something cross-platform. /Ingemar ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
[I don't know if a previous email of similar content got through. Sorry if this is a double post.] As libsndfile has already been recommended, I would just add that the simplest and most fool-proof way of playing back audio (once you have figured out how to load it) is PortAudio. It abstracts away from WDM, ASIO, ALSA, Jack, CoreAudio and what not. It is in my view much easier to use than OpenAL. Up-to-date PortAudio 1.9 bindings for FPC can be obtained here (not tested on MacOS): http://sourceforge.net/projects/humus/files/ Note that UltraStarDeluxe (mentioned in another reply) seems to have bindings for PA 1.7, which is outdated. It also does not provide the platform-specific extensions. Cheers! Roland On 6/14/2010 3:37 PM, Graeme Geldenhuys wrote: Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? If so, what sound format's are supported? ogg, wav, mp3? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal