uos stopped working when migrating from Linux Mint to Raspbian

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

uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
Hi !

I had a very functional program using uos on Mint and when I tried it , I had a SIGSEGV problem issue in uos_addInToDevOut, just like in that thread :

https://forum.lazarus.freepascal.org/index.php/topic,31069.0.html

I tried very hard to use the same parameters, but the better I could get was no error, but the sound (flac), ran in a few seconds (instead of minutes) silently.

Does anyone know where I went wrong ? (My Raspbian is Buster on the Raspberry 4B 4Go)
Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
Hello.

Hum, difficult to help without code...

Anyway, could you try this:

Download the RasPi arm32 version of StrumPract (done with uos)..
https://github.com/fredvs/strumpract/releases/tag/1.8.2 

Then just unzip it somewhere, no install needed.

And run it.

If it works, maybe it is a problem with your code.


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

Re: uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
Thanks for the quick answer !

I'm sorry about the absence of code, it's just so long that I don't know which part to quote AND the one where the problem seems to be is identical to the one in that thread I mentionned.

Anyway, I have an interesting phenomena with strumpract :
- When I double-click on a file in the list from the "audio file" window, I have the same result that I had in my program :
the file is played but it ends in a few seconds, and I can hear no sound !
- if I load it from the window "dock panel" with the button "...", the file is played normally and I can hear the sound...
I used a flac file.

I think I will try to use the libraries from strumpract and try to compare the codes if it still doesn't work in my program
Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
Hello.

> I think I will try to use the libraries from strumpract and try to compare the codes if it still doesn't work in my program

StrumPract use the same libraries that uos.
But, you may try of course.

> - When I double-click on a file in the list from the "audio file" window, I have the same result that I had in my program :
> the file is played but it ends in a few seconds, and I can hear no sound !
> - if I load it from the window "dock panel" with the button "...", the file is played normally and I can hear the sound...
> I used a flac file.

Hum, interesting, I will try this asap on my Rpi and write you later.

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

Re: uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
You were right : replacing the libraries didn't change anything.
I tried to look at the strumpract source code, but I can't find a *.lpi file...

Here are bits of my code :

procedure TForm1.FormActivate(Sender: TObject);
var
  inifile: Tinifile;
  ordir: string;
  PortAudioFileName: string;
  SndFileFileName: string;
  Mpg123FileName: string;
  Mp4ffFileName: string;
  FaadFileName: string;
{$IFDEF Darwin}
  opath: string;
{$ENDIF}

begin
  ordir := application.Location;

...

   {$IFDEF linux}
    {$if defined(cpu64)}
  PortAudioFileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
  SndFileFileName := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
  Mpg123FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so';
  Mp4ffFileName := ordir + 'lib/Linux/64bit/LibMp4ff-64.so';
  FaadFileName := ordir + 'lib/Linux/64bit/LibFaad2-64.so';
  //Edit5.Text := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so';
  //Edit6.Text := ordir + 'lib/Linux/64bit/plugin/libbs2b-64.so';
{$else}
  PortAudioFileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
  SndFileFileName := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';
  Mpg123FileName := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so';
  Mp4ffFileName := ordir + 'lib/Linux/32bit/LibMp4ff-32.so';
  FaadFileName := ordir + 'lib/Linux/32bit/LibFaad2-32.so';
  //Edit5.Text := ordir + 'lib/Linux/32bit/plugin/libsoundtouch-arm.so';
  //Edit6.Text := ordir + 'lib/Linux/32bit/plugin/libbs2b-32.so';
{$endif}

            {$ENDIF}

 uos_LoadLib(PChar(PortAudioFileName), PChar(SndFileFileName), PChar(Mpg123FileName),  PChar(Mp4ffFileName), PChar(FaadFileName), nil);    

...

end;


And the procedure which started the bug :


Procedure TFrmDisco.ChargeSon(nPlayer: integer; LePath: string);
var
  samformat: shortint;
  temptime: ttime;
  ho, mi, se, ms: word;
begin
     uos_CreatePlayer(nPlayer);
     If Fileexists(LePath) then
        begin
             InputIndex1 := uos_AddFromFile(0, PChar(LePath), -1, 0, 256);

             //uos_InputAddDSPVolume(0, InputIndex1, 1, 1);

             {$if defined(cpuarm)} // needs lower latency

             uos_AddIntoDevOut(nPlayer, -1, 100000, -1, 2, 0, 256, -1); /// REPLACING LINE
             //uos_AddIntoDevOut(0, -1, 0.3, -1, -1, 0, 1024, -1); INITIAL LINE

             {$else}
             uos_AddIntoDevOut(0, -1, -1, -1, -1, 0, 1024, -1);
             {$endif}        
...


The SIGSEGV message used to happen when the latency zas set at 0.3
Changing it to 100000 just turned the issue into playing the file silent and in a few seconds...
Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
Hello.

StrumPract was done using msegui widgetset.

For the players it uses:

  Outputindex1 := uos_AddIntoDevOut(theplayer, -1, configfo.latplay.Value, uos_InputGetSampleRate(theplayer, Inputindex1),
            uos_InputGetChannels(theplayer, Inputindex1), samformat, 1024 * 8, -1);

For cpu arm, configfo.latplay.Value is set to 0.3 .

Imho, your parameters are strange:

 uos_AddIntoDevOut(nPlayer, -1, 100000, -1, 2, 0, 256, -1); /// REPLACING LINE

A latency is between 0 and 1 (100000 is too much) and the size of chunk 256 is very litle.

About the problems in StrumPract, in menu Config-Audio, you may change the latency.
Maybe you may change it until the sound is ok and then use that latency for your program.

What widgetset are you using, Lazarus LCL?

Fre;D
 

Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
Re-hello.

If you use Lazarus LCL you should load a minimum of graphics stufs while playing sound.
LCL needs lot of resources and on a little machine, like Rpi, moving graphic like view meters, showing position, etc will kill all the latency of the (little) sound card.

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

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
Re-re hello.

You may this too on your Rpi, with StrumPract disable graphic anims, like view meters, wave-form.
Disabling some graphic can save sound problems on the Rpi.

Good luck.

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

Re: uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
In reply to this post by fredvs
Hi again,

strangely, I can't find any more problems in strumpract.

I tried your settings :

uos_AddIntoDevOut(0, -1, 0.3, -1, -1, 0, 1024, -1);
For latency, I tried a wide range from 0 to 1, but it's always the same : track played quickly, no sound.

I get the SIGSEGV error with latency -1...
Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
I only had 2 graphics anim : elapsed time label and trackbar, after deactivating them, nothing changed.

I tried to plug a USB soundcard and use it instead of the default inner soundcard : no changes...
Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
(Oh, and yes, sorry, I'm using Lazarus for Raspbian)
Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
In reply to this post by jeremzw

> I tried your settings :
> uos_AddIntoDevOut(0, -1, 0.3, -1, -1, 0, 1024, -1);


Huh, my settings are:
uos_AddIntoDevOut(0, -1, 0.3, -1, -1, 0, 1024 * 8, -1);

Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
In reply to this post by jeremzw
> (Oh, and yes, sorry, I'm using Lazarus for Raspbian)

Lazarus LCL is not known as best latency friend.
Mostly LCL-GTK is not the best.

With Qt it is a few better.

You may try msegui or fpgui, those widgetsets are way better for audio.

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

Re: uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
Oh, I see, I didn't know there were several versions of lazarus
I uninstalled gtk+ and replaced it with qt5 but it's still asking LCL widgetset for "Interfaces".

I'd rather try msegui or fpgui if you say it's better, and I'll get back to you after trying.

As for settings, I had tried 1024 AND 1024*8 yes, but it made no difference.
Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
Hello.

To test your Rpi, may I propose you to do this:

Load + compile the SimplePlayer demo in /uos/examples/.

Lazarus project: simpleplayer.lpi (Lazarus has to be installed).
MSEgui project: simpleplayer.prj (MSEgui + (MSEide or ideU) has to be installed).
fpGUI project: simpleplayer_fpGUI.lpi ("pure" fpGui has to be installed, not the one of LCL).

Begin with Lazarus project: simpleplayer.lpi and see + listen what appends.

PS: Maybe a opportunity for you to jump into MSEgui and fpGUI and compare the quality of sound, you have 3 time the same program with 3 different widgets using the same sound libraries!

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

Re: uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
Well I was still struggling with Lazarus qt5 to understand how to use "interfaces" unit from LCL widgetset (but maybe my install of qt5 wasn't "clean" enough).

It makes me unable to try simpleplayer in Lazarus because it uses "Interfaces" too...

I'll try simpleplayer on the two other GUIs too.

Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
For all LCL things I use CodeTyphon.

https://www.pilotlogic.com/sitejoom/index.php/downloads/category/14-codetyphon.html

The installation is "out-of-the-box" with the Rpi.

It has all the LCL widgets (GTK, Qt, carbon, ...) included and also all the libraries needed for the Rpi.
It includes also a utility "CodeTyphon" that can convert the .lpi Lazarus project file into a Typhon project file.

For Lazarus I did have too much problems to do it work.

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

Re: uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
It's a long way !
I managed to convert the .lpi file to a typhon project, and open it into EDI Typhon, but I got 2 errors and 12 warnings while executing (in a few pas like uos.pas or uos_libsndfile.pas).
Trying to deal with that right now.
Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

fredvs
Administrator
Hello.

> but I got 2 errors and 12 warnings while executing (in a few pas like uos.pas or uos_libsndfile.pas).

I have to confess that I do not use LCL widget for Raspi applications (only msegui or fpgui).
So I did not test LCL + uos on RasPi.
If you see something wrong, please advice.

Fre,D

Reply | Threaded
Open this post in threaded view
|

Re: uos stopped working when migrating from Linux Mint to Raspbian

jeremzw
In reply to this post by jeremzw
2020-01-25-172748-1920x1200-scrot
12