Recent

Author Topic: Microphone and audio in Linux  (Read 17263 times)

proxy3d

  • Jr. Member
  • **
  • Posts: 76
Microphone and audio in Linux
« on: November 14, 2012, 09:10:07 am »
microphone and audio in Linux
1) how to get sound from a microphone?
2) how to play the sound received from a microphone?

Simple example under Linux. I can use standard modules Lazarus for this?

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Microphone and audio in Linux
« Reply #1 on: November 14, 2012, 09:38:08 am »
PortAudio apparently allows recording and playback, see:
http://wiki.lazarus.freepascal.org/Multimedia_Programming#Playing_Sounds

Perhaps FredvS can answer here as well, I imagine he must know a bit more about PortAudio ;)
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

proxy3d

  • Jr. Member
  • **
  • Posts: 76
Re: Microphone and audio in Linux
« Reply #2 on: November 14, 2012, 09:51:16 am »
PortAudio apparently allows recording and playback
it is installed with Lazarus 1.0.2? (Default)
I would like to implement this standard modules of Lazarus (which is set for all users with Lazarus by default).

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Microphone and audio in Linux
« Reply #3 on: November 14, 2012, 10:18:19 am »
Well, I assume that following the links in the article I linked to will tell you the answer. You could always look through your own Lazarus directory to find the answer as well.

There may also be other ways of doing this/other libraries, I just skimmed through the wiki page looking for "record".

Edit: searched the forum for the keyword "microphone". Apparently people have been using the ACS library for that.

Good luck - and could you update the wiki page to say which library supports recording if you found a solution? That will surely help others when searching for this?

Thanks.
« Last Edit: November 14, 2012, 10:21:37 am by BigChimp »
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

proxy3d

  • Jr. Member
  • **
  • Posts: 76
Re: Microphone and audio in Linux
« Reply #4 on: November 14, 2012, 10:26:29 am »
I've seen this page before posting, but if I understand correctly, all these modules are not included in the standard Lazarus. I thought fpSound is standard Lazarus (I saw FP prefix and thought fpSound included Lazarus). Unfortunately, in the Wiki is very little documentation on the sound.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Microphone and audio in Linux
« Reply #5 on: November 14, 2012, 11:10:15 am »
Then it might be best to go through the fpsound source code and document as you go...

fpsound sounds more like an FPC thing though, so you might be able to find things in the FPC documentation...
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

proxy3d

  • Jr. Member
  • **
  • Posts: 76
Re: Microphone and audio in Linux
« Reply #6 on: November 14, 2012, 11:32:20 am »
I found the documentation fpSound only Wiki, there is little text. Where you can read a more complete documentation on fpSound?

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Microphone and audio in Linux
« Reply #7 on: November 14, 2012, 11:36:49 am »
Quote
Perhaps FredvS can answer here as well, I imagine he must know a bit more about PortAudio

With PortAudio, Yes, you can ! (but with fpSound I cannot)

The easier way is to use Bass audio library (but not open-source and not free for commercial app)

http://www.un4seen.com/

If you want a open lib, the best is to use PortAudio with Sndfile (see here, first topic http://www.lazarus.freepascal.org/index.php/topic,17599.0.html). Try Dynamic_Portaudio (first link),  there are some examples included.

« Last Edit: November 14, 2012, 12:04:26 pm by Fred vS »
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

proxy3d

  • Jr. Member
  • **
  • Posts: 76
Re: Microphone and audio in Linux
« Reply #8 on: November 14, 2012, 11:43:11 am »
Pörtaudio not standard library in Linux? To work with Pörtaudio need not standard modules Lazarus?

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Microphone and audio in Linux
« Reply #9 on: November 14, 2012, 12:01:57 pm »
Quote
PortAudio not standard library in Linux?

No. Edit : Sorry, i do not understand. (had read PortAudio not standard library in Lazarus  :-X ).
PortAudio is working for many OS, included Linux, of course.

Download that package. https://sites.google.com/site/fiensprototyping/dynportaudio.tar.gz
Unzip it, and, with Lazarus, load the *.lpi examples.
« Last Edit: November 14, 2012, 12:11:25 pm by Fred vS »
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

proxy3d

  • Jr. Member
  • **
  • Posts: 76
Re: Microphone and audio in Linux
« Reply #10 on: November 14, 2012, 12:59:03 pm »
I said wrong. PortAudio to work need to install a program or library in Linux? Or I can work with sound after you install package?

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Microphone and audio in Linux
« Reply #11 on: November 14, 2012, 01:41:01 pm »
Yes, PortAudio is library written in C. You can download/install it from repositories of your distro or from here: http://www.portaudio.com/download.html. Alternatively, you can download sources and compile yourself (you need GNU C compiler, "make" etc., there are instructions).

Once you have it, you need freepascal bindings for PortAudio, they are here: http://sourceforge.net/projects/pascalportaudio/
I tried few days ago, it plays sound but I didn't test any microphone.

Or try the link posted by Fred vS.
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/

proxy3d

  • Jr. Member
  • **
  • Posts: 76
Re: Microphone and audio in Linux
« Reply #12 on: November 14, 2012, 01:47:41 pm »
Sorry, it uses an external library. I need the code without the use of external programs and libraries.

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Microphone and audio in Linux
« Reply #13 on: November 14, 2012, 02:04:19 pm »
I don't understand you. In the end, there are OSS, Alsa, PulseAudio or whatever. They all are external and written in C/C++. Linux and Unix versions of PortAudio are connected to OSS/ALSA.

Well, here is some older project (2003), Pascal bindings directly to ALSA: http://freecode.com/projects/alsapas. I didn't test.
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/

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Microphone and audio in Linux
« Reply #14 on: November 14, 2012, 02:16:05 pm »
Quote
Sorry, it uses an external library. I need the code without the use of external programs and libraries.
Then you have to know what sound driver the system use: ALSA? Jack? OSS? etc?
and use the corresponding API...
PortAudio can be linked statically though (but I forgot about the license).

 

TinyPortal © 2005-2018