Recent

Author Topic: Join wav files  (Read 48462 times)

KMagic

  • Full Member
  • ***
  • Posts: 100
Join wav files
« on: February 01, 2014, 01:42:16 am »
  I got 5 wav files. I want to join these files in different orders (eg: 1-2-3-4-5,4-3-1-2-5...) and play the sound each time I click a button without a window media appearing and without a long interval between the files. Does anyone know which audio component in Lazarus can help me with this?   8-)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Join wav files
« Reply #1 on: February 01, 2014, 05:06:38 am »
It doesn't ... sound... like you actually need to "join" files together and produce another wav file. Instead it ...sounds... like you want to play these files in the different order.

If playback (in an arbitrary order) is the only task you need to do, then you could use "openal" package that uses openal library. Pretty cross-platform solution (if that matters).

The "joining" is achieved by feeding the sound-buffer by a proper wav file.

There's a very basic example given at openal package, that reads "uncompressed" wav file and plays it. See fpc/packages/openal/examples/wavopenal.pas

At the procedure  alPlay (at the example file) you'll see that a wave buffer is being read from .wav file and then pushed to the sounds buffer (by calling alBufferData and alSourceQueueBuffer).
So that's the place you'd like to change. Once one file is read completely, you'd need to start the next file and keep feeding the buffer from it... and so on...

...sounds... easy, right?


KMagic

  • Full Member
  • ***
  • Posts: 100
Re: Join wav files
« Reply #2 on: February 03, 2014, 02:55:15 am »
 Where can I find the tutorials for openAL for Lazarus?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Join wav files
« Reply #3 on: February 03, 2014, 03:08:55 am »
Try online! Google.com is awesome for the search purposes.

This one should work: http://www.noeska.com/doal/tutorials.aspx ... but look here too: http://comments.gmane.org/gmane.comp.ide.lazarus.general/50954



KMagic

  • Full Member
  • ***
  • Posts: 100
Re: Join wav files
« Reply #4 on: February 03, 2014, 02:03:17 pm »
I had read the tutorials in noeska.com. However, for lesson 1, when I downloaded the sample code and compliled, there was an error. Program cannot find the unit al,altypes and alut. Why are there these units but not openAL?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8834
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Join wav files
« Reply #5 on: February 03, 2014, 04:42:13 pm »
Quote
Why are there these units but not openAL?
FPC ships its own openal header translation, that website has its own. If you're planning to use what the website teaches, then use what they provide (even though in general it should be sufficient to replace those 3 units with just 'openal' provided the procedure headers are compatible).

KMagic

  • Full Member
  • ***
  • Posts: 100
Re: Join wav files
« Reply #6 on: February 03, 2014, 04:55:40 pm »
I don't really understand what you are saying. Can you say it in detail?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Join wav files
« Reply #7 on: February 03, 2014, 05:00:26 pm »
HE says search noeska.com for the headers of openAL to download. or use the included headers after you have corrected the uses clause to use the correct units.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

KMagic

  • Full Member
  • ***
  • Posts: 100
Re: Join wav files
« Reply #8 on: February 03, 2014, 05:06:00 pm »
what do you mean by headers? Is it the interface part in an unit?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Join wav files
« Reply #9 on: February 03, 2014, 05:11:31 pm »
header are the units that describe the functions of a dll/SO they are called headers in C/C++ (.h files) and its stuck with me. Any way those .pas files that you are missing must be provided by noeska.com or see search your lazarus folder in which units the missing declaration can be found and use them instead.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

KMagic

  • Full Member
  • ***
  • Posts: 100
Re: Join wav files
« Reply #10 on: February 03, 2014, 05:18:02 pm »
 I downloaded the first link in this site:http://www.noeska.com/doal/downloads.aspx

and cannot find the 3 .pas files. What should I do now?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Join wav files
« Reply #11 on: February 03, 2014, 05:23:01 pm »
it has an openal.pas file that is the header file I was talking about. where did you get the example application you try to compile?

I see the problem better ask noeska.com about that. but first try to replace the 3 units with openal and see if that helps a bit. 
« Last Edit: February 03, 2014, 05:27:07 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

KMagic

  • Full Member
  • ***
  • Posts: 100
Re: Join wav files
« Reply #12 on: February 03, 2014, 05:25:16 pm »
I have made a openal.ppu file from the openal.pas. I download the example in the bottom of this site:http://www.noeska.com/doal/lesson1.aspx

KMagic

  • Full Member
  • ***
  • Posts: 100
Re: Join wav files
« Reply #13 on: February 03, 2014, 05:43:42 pm »
If I replace the 3 units with openal, there will be an error in the TAluint type.
  Can you suggest me another component that can help me with the problem that I said in my title?

Fred vS

  • Hero Member
  • *****
  • Posts: 3726
    • StrumPract is the musicians best friend
Re: Join wav files
« Reply #14 on: February 03, 2014, 05:56:23 pm »
Quote
Can you suggest me another component that can help me with the problem that I said in my title?

You may try uos : https://github.com/fredvs/uos/

And take a look at "Multi Player" example...
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018