consoleplay example doesn't work on Raspberry Pi

Next Topic
 
classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

consoleplay example doesn't work on Raspberry Pi

Dim Tim
Subj.  It gives the following diags on Bullseye; on Buster diags are similar, some details differ.  No sound is output.  I fixed a minor error in the consoleplay.pas (it was "SF_FileName := ordir + ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';", so it seems that the code wasn't tested at RasPi).

---

ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib conf.c:5200:(snd_config_expand) Unknown parameters {AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2  CARD 0}
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2  CARD 0}
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

Libraries are loaded.

InputIndex1 = 0
OutputIndex1 = -1
Ciao...

vlc and omxplayer do work.
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
Hello Dim Tim*

Dim Tim wrote
 I fixed a minor error in the consoleplay.pas (it was "SF_FileName := ordir + ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';", so it seems that the code wasn't tested at RasPi).
Ooops, indeed, strange that double "ordir", I will fix it asap, thanks to note it.
[EDIT] Done with uos commit 1a34f8f.

But I tested consoleplay on my Rpi3 (with the fix, of course) and here it works.

May I ask you if you can play other uos examples on your Rpi?

And if you try https://github.com/fredvs/strumpract/releases (the rpi 32 version) is it working for you?

Thanks.

Fre;D

Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
Re-hello.

If, by chance, you are able to run the rpi version of  https://github.com/fredvs/strumpract/releases , could you please, with the menu item "Config" "Audio and colors"  give a screenshot of list of devices so we can diagnose what is wrong?

(Or use the uos demo "Device Info" and give the list of devices.)

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
Re-re hello.

Maybe your config differs than the default one.
In that case, if you was able to get the list of your devices, in "consoleplay" demo, change the 2th parameter of uos_AddIntoDevOut() with one of your device (-1 is the default):

   OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, -1, -1, -1, -1, -1) ;

For example change it with

   adevice := 0;
   OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1,adevice, 0.3, -1, -1, -1, -1, -1) ;

where "adevice" is one of your device, recompile and test it, till you get one device working.

Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

Dim Tim
In reply to this post by fredvs
Hello, Fre;D.

fredvs wrote
But I tested consoleplay on my Rpi3 (with the fix, of course) and here it works.
Hmm, strange.

May I ask you if you can play other uos examples on your Rpi?
I will, tomorrow.

And if you try https://github.com/fredvs/strumpract/releases (the rpi 32 version) is it working for you?
Yes, it happily plays a track. :)  And vlc and omxplayer work also.

Here is screenshot of strumpract config window.

Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
In reply to this post by fredvs
Sorry to monopolize...

Here screenshot of device list of my Rpi3 with Raspios_ 2022-01-28-raspios-bullseye-armhf:

The sound works via HDMI here (not tested via rpi-audio-output but it should work too).

Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
In reply to this post by Dim Tim
Ooops, we were perfectly synchro....

> Yes, it happily plays a track. :)

Ha, that is good news because it uses code and libraries of uos.

So, indeed, strange that "consoleplay" fails with uos_AddIntoDevOut(().
Maybe try with other device, like explained in previous post.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

Dim Tim
This post was updated on .
Hello, Fred.

fredvs wrote
So, indeed, strange that "consoleplay" fails with uos_AddIntoDevOut(().
Maybe try with other device, like explained in previous post.
No, the big bunch of error messages are shown in uos_LoadLib.  Tried with other device (0), the same result.  uos_AddIntoDevOut failure is a consequence of incorrectly initialized libs.  deviceinfos, started from terminal, shows similar messages.

May be the problem is on my side, but I tried with Buster and Bullseye.  I consider to create an SD card with fresh default distro, as a clean test.  Well, as a last resort I can start a process with console vlc, playing a sequence of tracks. ;)  I tested, it works. omxplayer cannot play lists, and cuts off the last second of the track it's playing.

UPD: on a fresh install of "Raspberry Pi OS with desktop" from https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-32-bit there are the same errors!  
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
Hello.

Dim Tim wrote
No, the big bunch of error messages are shown in uos_LoadLib.
All that messages are from PortAudio library.
This is the "normal" feature of PortAudio, it is not really errors but "try to load features".
See: http://uos-forum.108.s1.nabble.com/Redirect-message-in-terminal-to-a-log-file-td839.html
and here: https://github.com/fredvs/uos/issues/33

Is "audacity" working in your Rpi ( to install:> sudo apt-get install audacity )?
It uses also Portaudio.

Could you run audacity via terminal (just do > audacity)?
There will also have lot of messages, you may compare the result with consoleplay.

In your first post, for the result of consoleplay, I see:

Dim Tim wrote
...
Libraries are loaded.

InputIndex1 = 0
OutputIndex1 = -1
Ciao...
It means that the libraries (Portaudio and LibSndfile) are correctly loaded but assigning output fails.
What I dont understand is that StrumPract is working for you and not consoleplay (both use same audio libs).

What version of fpc do you use?  (for StrumPract release, fpc 3.2.2 was used.)
From where did you download RpiOS and what version?

Fre;D

Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
Re-hello.

Dim Tim wrote
UPD: on a fresh install of "Raspberry Pi OS with desktop" from https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-32-bit there are the same errors!  
Ooops, I did not see it.
Hum, the same than mine....

What Rpi do you use?
I have a Rpi3 and did not try on the last Rpi4.

Fred
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

Dim Tim
In reply to this post by fredvs
fredvs wrote
All that messages are from PortAudio library.
This is the "normal" feature of PortAudio, it is not really errors but "try to load features".
Ah.  A little silly.  I'd use a switch for that.  But it seems, it's usual for linux GUI programs started from terminal.
Is "audacity" working in your Rpi
Yes, just tried - works.
Could you run audacity via terminal (just do > audacity)?
There will also have lot of messages, you may compare the result with consoleplay.
Yes, they are identical in "ALSA" part.
It means that the libraries (Portaudio and LibSndfile) are correctly loaded but assigning output fails.
What I dont understand is that StrumPract is working for you and not consoleplay (both use same audio libs).
Maybe I'll try later different values for device parameter.
What version of fpc do you use?  (for StrumPract release, fpc 3.2.2 was used.)
Generally I use trunk :), but just installed (with fpcupdeluxe) stable 2.2 with fpc 3.2.2 for testing.  Result is the same.  Cross-compiling on Windows.  JFYI: in define.inc I uncommented just 3 defines:

{$DEFINE portaudio}  // uncomment to enable portaudio In/Out sound port
{$DEFINE sndfile}      // uncomment to enable sndfile (wav, ogg, flac audio file)
{$DEFINE mpg123}   // uncomment to enable mpg123 (mp3 audio file)
What Rpi do you use?
I have a Rpi3 and did not try on the last Rpi4.
The same here.  I have RPi3 B and RPi3 B+, identical behaviour.  RPi4 is too hot for me. :)
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
This post was updated on .
Hello.

Dim Tim wrote
Generally I use trunk :), but just installed (with fpcupdeluxe) stable 2.2 with fpc 3.2.2 for testing.  Result is the same.  Cross-compiling on Windows.
Hum, this is the only different thing that I see.
I dont trust in cross-compiling so all the StrumPract binaries in releases are compiled with fpc on a "real" Rpi.

For this (because installing fpc is a hard game) I use "fpc-ootb" version of fpc for Rpi.
https://github.com/fredvs/freepascal-ootb/releases
Just choose the OS in assets, unzip it and run-use "fpc-ootb-32", no need to install anything.

But, of course you may install the official fpc for arm-rpi.

I will give you (asap) a binary version of "consoleplay' compiled on the Rpi and so you may try if it is ok.

By the way, did you try "SimplePlayer" GUI uos demo, is it working on your Rpi?

Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
For compiling consoleplay, in console do:

> cd /directory_of_uos/examples/

> /directory_of_fpc-ootb/fpc-ootb-32 -oconsoleplay -Mobjfpc -Sh -Fcutf8 -B -Xs -CX -XX -O1 -FUunits -vewinhq consoleplay.pas
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
This post was updated on .
Hello.

In attachment, consoleplay binary compiled on the Rpi.

consoleplay-rpi32.bz2

Do you have the same issue while running it?

> cd /directory-of-consoleplay

> ./consoleplay
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

Dim Tim
This post was updated on .
In reply to this post by fredvs
Hello, Fred!

fredvs wrote
Hum, this is the only different thing that I see.
I dont trust in cross-compiling so all the StrumPract binaries in releases are compiled with fpc on a "real" Rpi.
All my life I cross-compiled, for am an embedder and usually deal with MCU-s. :)
For this (because installing fpc is a hard game) I use "fpc-ootb" version of fpc for Rpi.
I prefer fpcupdeluxe ( https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases ) to install fpc and Lazarus.  But RPi is too slow and RaspiOS somewhat inconvenient for software development.  Maybe it's better to resort to vlc.

In attachment, consoleplay binary compiled on the Rpi.
Now it works, yes.  Then I'd rather give up.  Sorry for wasting your time...

UPD: printed Pa_OpenStream error - 9997, i.e. paInvalidSampleRate.  SampleRate is 44100.  Seems, parameters incorrectly passed to the C library function.
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
Dim Tim wrote
In attachment, consoleplay binary compiled on the Rpi.
Now it works, yes.  Then I'd rather give up.  Sorry for wasting your time...
You did not waste my time but sorry me that I could not help to find where did the problem come from.
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

Dim Tim
Hello, Fred.
fredvs wrote
You did not waste my time but sorry me that I could not help to find where did the problem come from.
Now I found where the problem appears, but not why.  Maybe I should open an issue in FPC bug tracker - if the example works when compiled natively and fails after cross-compilation.  Or maybe tweaking FPC compile parameters may help.  I believe that compiler source is the same for native and cross-compiler, with some conditionals.  Anyway, thanks for help! :)
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
In reply to this post by Dim Tim
Dim Tim wrote
UPD: printed Pa_OpenStream error - 9997, i.e. paInvalidSampleRate.  SampleRate is 44100.  Seems, parameters incorrectly passed to the C library function.
Hello Dim Tim.

Oops, I did not see this.
Indeed very strange.

Could you try something like this cross-compiled:
_________________

program cdouble_test;
    {$mode objfpc}
   uses ctypes;
    var
      i: integer = 44100;
      d: cdouble;
      begin
        d := cdouble(i);
        writeln(d);
     end.
______________

In "direct-compil" I get this:

> fred@fredvs ~> ./cdouble_test
> 4.4100000000000000E+004

Do you get the same in cross-compil?
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

Dim Tim
Sorry, alerts were off, didn't notice your reply. :)

Sure, an example as simple as this gives the same result.  To check it out, we should create a library (preferrably a C library), with a function with the same parameters by number and type, and with the same calling convention (for 64 bits, luckily, there is only one, but for 32 bits there are several).
Reply | Threaded
Open this post in threaded view
|

Re: consoleplay example doesn't work on Raspberry Pi

fredvs
Administrator
Hello.

Is it possible for you to give me the complete command-line that you use to cross-compile consoleplay demo?

And also give as zip-attachment the binary of consoleplay that you get after cross-compiling  ?

Thanks.

Fre;D
12