Recent

Author Topic: Create a sine wave audio tone - Linux  (Read 3711 times)

Aruna

  • Sr. Member
  • ****
  • Posts: 458
Re: Create a sine wave audio tone - Linux
« Reply #15 on: August 13, 2024, 05:06:59 pm »
Compiles and runs, still no sound :-( Please see the attached screenshot

If frequency is 5 Hz indeed, you cannot hear it.  ;D
True, but I would have thought even at 1Hz you should be able to hear it as a click on a metronome. I just made a screencast please watch till the end, the problem is fully captured here. It is 3 minutes but shows you the issue clearly. My first language is not English so my apologies for the accent :-)
Debian GNU/Linux 11 (bullseye)
https://pascal.chat/

Fred vS

  • Hero Member
  • *****
  • Posts: 3366
    • StrumPract is the musicians best friend
Re: Create a sine wave audio tone - Linux
« Reply #16 on: August 13, 2024, 05:25:26 pm »
Hello Aruna.
Thanks for the video.  ;)

Here a other from my system:
https://github.com/fredvs/test/releases/download/fpc323/sinewave_with_sound.mp4

Did you copy Portaudio library in the root directory of /sinewave_with_sound/, like in my video?
« Last Edit: August 14, 2024, 12:21:24 am 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

Aruna

  • Sr. Member
  • ****
  • Posts: 458
Re: Create a sine wave audio tone - Linux
« Reply #17 on: August 13, 2024, 05:37:40 pm »
Did you copy Portaudio library in the root directory of /sinewave_with_sound/, like in my video?
Yes I did. Screenshot attached.
Debian GNU/Linux 11 (bullseye)
https://pascal.chat/

Fred vS

  • Hero Member
  • *****
  • Posts: 3366
    • StrumPract is the musicians best friend
Re: Create a sine wave audio tone - Linux
« Reply #18 on: August 13, 2024, 05:50:48 pm »
Hum...  :-\
Do you have "audacity" app installed, is it working?

In lot of Linux distros, Portaudio is installed by default.
You can try using portaudio installed on the system by changing:

Code: Pascal  [Select][+][-]
  1.  {$if defined(CPUAMD64) and  defined(linux) }
  2.    // PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
  3.         PA_FileName := ordir + 'LibPortaudio-64.so';
  4.  {$ENDIF}
   

with this:

Code: Pascal  [Select][+][-]
  1.  {$if defined(CPUAMD64) and  defined(linux) }
  2.    // PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
  3.         PA_FileName := 'system';
  4.  {$ENDIF}    


To install portaudio on your system (or check if installed):
Code: Pascal  [Select][+][-]
  1. $ sudo apt-get install libportaudio2

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

Aruna

  • Sr. Member
  • ****
  • Posts: 458
Re: Create a sine wave audio tone - Linux
« Reply #19 on: August 13, 2024, 11:29:40 pm »
Hello @Fred vS the last *.zip file you sent worked. The sine wave note sounds so clear and pure (wow). Quick question about UOS, if I wanted to play an internet radio stream can UOS handle that? For anyone interested the working zip file is HERE.
« Last Edit: August 13, 2024, 11:36:14 pm by Aruna »
Debian GNU/Linux 11 (bullseye)
https://pascal.chat/

Fred vS

  • Hero Member
  • *****
  • Posts: 3366
    • StrumPract is the musicians best friend
Re: Create a sine wave audio tone - Linux
« Reply #20 on: August 13, 2024, 11:52:11 pm »
Hello @Fred vS the last *.zip file you sent worked. The sine wave note sounds so clear and pure (wow).
I am very happy that it works for you.  ;D

Quick question about UOS, if I wanted to play an internet radio stream can UOS handle that?
Yes, of course, take a look at /uos/examples/conswebstream.lpi and /uos/examples/simplewebplayer.lpi
Note that the radio-sites url in the examples are old, not sure they still exist.
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

Aruna

  • Sr. Member
  • ****
  • Posts: 458
Re: Create a sine wave audio tone - Linux
« Reply #21 on: August 14, 2024, 12:02:00 am »
Quick question about UOS, if I wanted to play an internet radio stream can UOS handle that?
Yes, of course, take a look at /uos/examples/conswebstream.lpi and /uos/examples/simplewebplayer.lpi
Note that the radio-sites url in the examples are old, not sure they still exist.
Great! I will replace the url's if they no longer exist.

@Fred vS You had posted a *.mp4 file somewhere earlier in this thread that shows you testing the code on your system. I am unable to locate this any longer. Woudl you please post it again if you do not mind? I had some questions for you on the distro and some other things I saw. Thank you very much once again for all your help and time.
Debian GNU/Linux 11 (bullseye)
https://pascal.chat/

Fred vS

  • Hero Member
  • *****
  • Posts: 3366
    • StrumPract is the musicians best friend
Re: Create a sine wave audio tone - Linux
« Reply #22 on: August 14, 2024, 12:22:20 am »
Great! I will replace the url's if they no longer exist.
This one is working, just tested:
http://stream-uk1.radioparadise.com/mp3-128
Note that the demo conswebstream.lpi must be run via a terminal (because you need to enter keys).

@Fred vS You had posted a *.mp4 file somewhere earlier in this thread that shows you testing the code on your system. I am unable to locate this any longer.
This one ?
https://github.com/fredvs/test/releases/download/fpc323/sinewave_with_sound.mp4
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

Aruna

  • Sr. Member
  • ****
  • Posts: 458
Re: Create a sine wave audio tone - Linux
« Reply #23 on: August 14, 2024, 12:38:30 am »
This one is working, just tested:
http://stream-uk1.radioparadise.com/mp3-128
Yes it does I just tested as well.

Note that the demo conswebstream.lpi must be run via a terminal (because you need to enter keys).
Noted and understood. Thank you!

@Fred vS You had posted a *.mp4 file somewhere earlier in this thread that shows you testing the code on your system. I am unable to locate this any longer.
This one ?
Quote
https://github.com/fredvs/test/releases/download/fpc323/sinewave_with_sound.mp4
Yes!
Debian GNU/Linux 11 (bullseye)
https://pascal.chat/

Aruna

  • Sr. Member
  • ****
  • Posts: 458
Re: Create a sine wave audio tone - Linux
« Reply #24 on: August 14, 2024, 03:52:58 pm »
Quick question about UOS, if I wanted to play an internet radio stream can UOS handle that?
Yes, of course, take a look at /uos/examples/conswebstream.lpi and /uos/examples/simplewebplayer.lpi
Note that the radio-sites url in the examples are old, not sure they still exist.
Hello @Fred vS I tried the simplewebplayer.lpi and it does work. I had to enable the SoundTouch plugin and then it started playing very clear sound. I have a question, some url's work and others do not. Do you know why is this? Please have a look at the attached screenshots.

The urls I tried are below:
http://cast5.magicstreams.gr:8010/stream ( This plays once you enable Sound Touch)
https://radio.lotustechnologieslk.net:2020/stream/hirufmgarden ( This does not play )
(Try plugging in both urls in your browser and both will play.)

Very nice work by the way!



Debian GNU/Linux 11 (bullseye)
https://pascal.chat/

Fred vS

  • Hero Member
  • *****
  • Posts: 3366
    • StrumPract is the musicians best friend
Re: Create a sine wave audio tone - Linux
« Reply #25 on: August 14, 2024, 07:49:44 pm »
Hello Aruna

The urls I tried are below:
http://cast5.magicstreams.gr:8010/stream ( This plays once you enable Sound Touch)
Hum, very strange, here it works with or without SoundTouch.
Maybe a problem of latency?
Try to change in main_wsp.pas, line 362, this code:
 
Code: Pascal  [Select][+][-]
  1.      {$else}
  2.        Out1Index := uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, In1Index),
  3.        ...
  4.       {$endif}    
with this
Code: Pascal  [Select][+][-]
  1.      {$else}
  2.        Out1Index := uos_AddIntoDevOut(PlayerIndex1, -1, 0.8, uos_InputGetSampleRate(PlayerIndex1, In1Index),
  3.        ...
  4.       {$endif}    

The urls I tried are below:
https://radio.lotustechnologieslk.net:2020/stream/hirufmgarden ( This does not play )
Indeed, here it does not work too.
Maybe it is because https:// (secured url).
Sadly I dont have much skin in fphttpclient.pas, maybe there is something to do to access https.   :-[

Very nice work by the way!
Thanks!  ;)
« Last Edit: August 15, 2024, 12:37:26 am 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

Fred vS

  • Hero Member
  • *****
  • Posts: 3366
    • StrumPract is the musicians best friend
Re: Create a sine wave audio tone - Linux
« Reply #26 on: August 14, 2024, 11:46:29 pm »
https://radio.lotustechnologieslk.net:2020/stream/hirufmgarden ( This does not play )

Hello Aruna.
Could you try with the last commit of uos ? :
https://github.com/fredvs/uos

It should be fixed.
Thanks to note it.
« Last Edit: August 15, 2024, 01:08:27 am 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

Fred vS

  • Hero Member
  • *****
  • Posts: 3366
    • StrumPract is the musicians best friend
Re: Create a sine wave audio tone - Linux
« Reply #27 on: August 15, 2024, 05:07:24 pm »
Re-hello.
Note that playing https url will work only with fpc 3.3.1.
I did try using fpc 322 but it did not work.  :-X
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

Aruna

  • Sr. Member
  • ****
  • Posts: 458
Re: Create a sine wave audio tone - Linux
« Reply #28 on: August 15, 2024, 06:35:55 pm »
https://radio.lotustechnologieslk.net:2020/stream/hirufmgarden ( This does not play )
Hello Aruna.
Could you try with the last commit of uos ? :
https://github.com/fredvs/uos

It should be fixed.
Thanks to note it.
I just tried it and everything works. Thank you for taking the time. Please see the attached screenshot. @Fred vS when I load your project into my Lazarus IDE it pops up a second source editor. Why is this happening? It does not get in my way or prevent me from writing code or buidling I am just curious as to why this happens?
Debian GNU/Linux 11 (bullseye)
https://pascal.chat/

Fred vS

  • Hero Member
  • *****
  • Posts: 3366
    • StrumPract is the musicians best friend
Re: Create a sine wave audio tone - Linux
« Reply #29 on: August 15, 2024, 06:48:15 pm »
I just tried it and everything works.
Ha, excellent news, I am very happy all is ok now.  ;)

@Fred vS when I load your project into my Lazarus IDE it pops up a second source editor. Why is this happening? It does not get in my way or prevent me from writing code or buidling I am just curious as to why this happens?
Sorry but I not expert about Lazarus IDE and cannot reproduce it.
Maybe create a new topic and ask it there.

Have nice days.

Fre;D
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