Author Topic: BASS for ARM Linux  (Read 143201 times)

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #50 on: 18 Feb '13 - 17:56 »
The latest BASS version (2.4.10) is now up in the first post.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #51 on: 25 Feb '13 - 17:47 »
The latest version (2.4.1) of the BASSOPUS add-on is now up in the first post.

trentggg

  • Guest
Re: BASS for ARM Linux
« Reply #52 on: 20 Mar '13 - 21:19 »
Wanted to report on how things are working for me on Raspberry Pi.

Overall it works really well. Things are fast and normally sounds great.

I've had a few issues. The first is that sometimes (not very often) when I change songs (in my game, changing areas or toggling sound on and off) the audio output will go down the tubes. I don't know how to describe it but it becomes very laggy and sort of
on and off" ie not playing for a while then playing a brief bit of lagged music and repeat.

The second issue I have I think I'd had on other platforms too be seems to be greater here. When I turn the music off in my game, sound effects start playing either not at all or just brief little "blips" (for short sound effects.) When the music is playing they play correctly. No idea what causes this.

Anyhow, overall it's good, thanks for the port!

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #53 on: 21 Mar '13 - 16:06 »
That sounds strange. For comparison, have you also implemented a version of your game that uses the standard Linux version of BASS, and if so, do you ever have the same problems with that? One thing you could try is seeing if increasing the BASS_CONFIG_DEV_BUFFER setting (prior to calling BASS_Init) has any effect.

trentggg

  • Guest
Re: BASS for ARM Linux
« Reply #54 on: 23 Mar '13 - 01:02 »
I have. I've not experienced the issue on anything but the Raspberry Pi. As for that setting, I'm currently setting it to 4096 because if I don't, the sound is _always_ choppy. What would you recommend setting it to?

Thanks,
Trent

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #55 on: 25 Mar '13 - 14:27 »
The BASS_CONFIG_DEV_BUFFER option setting is in milliseconds, so 4096 seems a bit high, ie. it's asking for a buffer of over 4 seconds. The default setting is 40ms. Please try raising that in 10ms increments to find when the sound stops being choppy, and then see if the other problems still happen.

scrww

  • Posts: 5
Re: BASS for ARM Linux
« Reply #56 on: 26 Mar '13 - 13:05 »
hi, I'me trying to run a mono app with bass in RPi, and I've a noise when change between songs, and sometimes de noise continue during the song.
We've tried ti change the Buffer but don't have good results.

The first song is always right.

Thanks for your help!!! :-[

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #57 on: 26 Mar '13 - 13:33 »
What sort of noise is it? If you have a recording, you can upload it here...

   ftp.un4seen.com/incoming/

To confirm whether the problem is something specific to the ARM Linux version or something more general, please see if you can reproduce it on the standard/x86 Linux platform too.

scrww

  • Posts: 5
Re: BASS for ARM Linux
« Reply #58 on: 26 Mar '13 - 13:42 »
In a Linux standard (ubuntu) the mono app run perfect.
I don't have a record, but the noise is like a "click" or when a speaker is broken (my speakers are right;)
The noise is always when change a song to the next, and sometimes the noise appear in bucle during de song (every 2-3 seconds)

When I init BASS first time in the first song, all is right...

scrww

  • Posts: 5
Re: BASS for ARM Linux
« Reply #59 on: 27 Mar '13 - 07:50 »
Sorry, I detect that the noise is at the end of the song. If I play one song, the noise appear when it finish

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #60 on: 27 Mar '13 - 14:58 »
OK. So the noise appears after playback reaches the end of a file, and whether another file is played or not doesn't have any effect on the noise? Does the noise continue if you free the BASS channel, eg. call BASS_StreamFree? What about if you call BASS_Pause or BASS_Stop?

scrww

  • Posts: 5
Re: BASS for ARM Linux
« Reply #61 on: 27 Mar '13 - 16:32 »
Both, after playback one file, and when I use a playlist.
I tried with BASS_StreamFree and the result isthe same.

Could it be a problem with ALSA drivers? Maybe BASS required some config different...

Thanks

SteveS

  • Guest
Re: BASS for ARM Linux
« Reply #62 on: 27 Mar '13 - 16:58 »
OK, I'm now confused. I have a small app running on my RPi (hardfp) which works well. It receives (over a TCP socket) a playlist, which it then proceeds to play. I have my own windows player (written with BASS of course!) which sends it the playlist.

However, there are some MP3 files that the ARM player won't load, which give me error 41 (unsupported file format), which work fine on the PC. I am specifying BASS_STREAM_PRESCAN, although if I don't it makes no difference. The files are 192kbps encoded, fixed (and were encoded using LAME).

Since the file plays in Windows I'm guessing there isn't too much wrong with it. Is there anything I can do to further diagnose my problem?

Any hints gratefully received  :)

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #63 on: 27 Mar '13 - 17:29 »
Both, after playback one file, and when I use a playlist.
I tried with BASS_StreamFree and the result isthe same.

Could it be a problem with ALSA drivers? Maybe BASS required some config different...

Does the noise sound like a short piece of sound repeating? If so, perhaps the ALSA driver is repeating the output buffer instead of stopping when it's empty. Here's an update (softfp) with a little modification for you to try...

   www.un4seen.com/stuff/libbass.so

Let me know whether it makes any difference. Also, if you can make a recording of the noise, please do so.

OK, I'm now confused. I have a small app running on my RPi (hardfp) which works well. It receives (over a TCP socket) a playlist, which it then proceeds to play. I have my own windows player (written with BASS of course!) which sends it the playlist.

However, there are some MP3 files that the ARM player won't load, which give me error 41 (unsupported file format), which work fine on the PC. I am specifying BASS_STREAM_PRESCAN, although if I don't it makes no difference. The files are 192kbps encoded, fixed (and were encoded using LAME).

Since the file plays in Windows I'm guessing there isn't too much wrong with it. Is there anything I can do to further diagnose my problem?

Are you using the standard BASS library version or the "mp3-free" version? If the latter, please try the former. If you still have the problem, please upload one of the affected files to have a look at here...

   ftp.un4seen.com/incoming/

Also, just to be clear, are you only sending a list of filenames to the device or are you sending the files too? If the latter, what happens if you place the troublesome files on the device in advance, and pass them to BASS_StreamCreateFile? Also, to confirm that the files are fine, is other software on the device able to play them?

SteveS

  • Guest
Re: BASS for ARM Linux
« Reply #64 on: 27 Mar '13 - 18:07 »
I'm using standard.
The files are on a networked drive (mounted via CIFS). mpg321 can play them from the network, and many of the files play fine.
I did some experimentation which leads me to believe that it's actually an issue with that, rather than anything BASS is doing.
Put simply, copying the files to SD, they play fine. Using StreamCreateFileUser allowed me to put some diagnostics in. If I use stat or fstat on the filename, I don't always get the true size of the file.
I put in some additional code so that if StreamCreateFile fails, I try with my user procs, and surprise! the files play fine.
It's been a while since I did system level coding for *ix, but I'll go down that route for all files once I have reliable methods.

If I use STREAMFILE_BUFFER, can I use SetPos reliably on the channel? I have lead-in and lead-out values for each track so I get "gapless" playback on my Windows version, and I'm passing those on too, and it would be nice if that was compatible.

SteveS

scrww

  • Posts: 5
Re: BASS for ARM Linux
« Reply #65 on: 28 Mar '13 - 07:29 »
Both, after playback one file, and when I use a playlist.
I tried with BASS_StreamFree and the result isthe same.

Could it be a problem with ALSA drivers? Maybe BASS required some config different...

Does the noise sound like a short piece of sound repeating? If so, perhaps the ALSA driver is repeating the output buffer instead of stopping when it's empty. Here's an update (softfp) with a little modification for you to try...

   www.un4seen.com/stuff/libbass.so

Let me know whether it makes any difference. Also, if you can make a recording of the noise, please do so.

OK, I'm now confused. I have a small app running on my RPi (hardfp) which works well. It receives (over a TCP socket) a playlist, which it then proceeds to play. I have my own windows player (written with BASS of course!) which sends it the playlist.

However, there are some MP3 files that the ARM player won't load, which give me error 41 (unsupported file format), which work fine on the PC. I am specifying BASS_STREAM_PRESCAN, although if I don't it makes no difference. The files are 192kbps encoded, fixed (and were encoded using LAME).

Since the file plays in Windows I'm guessing there isn't too much wrong with it. Is there anything I can do to further diagnose my problem?

Are you using the standard BASS library version or the "mp3-free" version? If the latter, please try the former. If you still have the problem, please upload one of the affected files to have a look at here...

   ftp.un4seen.com/incoming/

Also, just to be clear, are you only sending a list of filenames to the device or are you sending the files too? If the latter, what happens if you place the troublesome files on the device in advance, and pass them to BASS_StreamCreateFile? Also, to confirm that the files are fine, is other software on the device able to play them?

YESSSS!!!!
www.un4seen.com/stuff/libbass.so
Run perfect, without any noise between songs!!!! Thanks very much!!!

This is our code:
Can't u take a look, and give us if there is any best way to use BASS better?
 //BassNet.Registration("your email", "your regkey");
            BassNet.Registration("xxxxxxx,xxxxxxxx");
         if(_info == null)
         _info = Bass.BASS_GetInfo();
         //LogsFromPlayer.WriteLog(0,_info.ToString());
            if (Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, System.IntPtr.Zero))
            {
                _info = Bass.BASS_GetInfo();
                _deviceLatencyMS = _info.latency;
            LogsFromPlayer.WriteLog(0,string.Format("Info :{0}",  _info.ToString()));
            LogsFromPlayer.WriteLog(0,string.Format("DeviceLantecy  :{0}",_deviceLatencyMS.ToString()));
            }
            else
            if(Bass.BASS_ErrorGetCode().ToString() != "BASS_ERROR_ALREADY")
                     LogsFromPlayer.ErrorLog(0, "Bass_Init error!");
                //MessageBox.Show(this, "Bass_Init error!");
         
         
           // BassFx.BASS_FX_GetVersion();
           // create a secure timer

            if (_updateTimer == null)
            {
                _updateTimer = new Un4seen.Bass.BASSTimer(_updateInterval);
                _updateTimer.Tick += new EventHandler(timerUpdate_Tick);
                _updateTimer.Start();
            }
         
   
   
   
   public override bool play()
        {
         BassNet.Registration(...);
            base.play();
            //_updateTimer.Stop();
            try
            {       
           if (!InTransaction)
                {
                    InTransaction = true;
               // create a stream channel from a file
                    _stream = Bass.BASS_StreamCreateFile(_filePathTemaAReproducir, 0L, 0L, BASSFlag.BASS_DEFAULT);
                    if (_stream != 0 && Bass.BASS_ChannelPlay(_stream, false))
                    {
                        // render wave form (this is done in a background thread, so that we already play the channel in parallel)
                        LogsFromPlayer.WriteLog(0, "Play. FilePath = " +  Path.GetFileName(_filePathTemaAReproducir));
                        Bass.BASS_SetVolume((_volume / 100.0f));
                    }
                    else
                    {
                        //Console.WriteLine("Error = {0}", Bass.BASS_ErrorGetCode());
                        LogsFromPlayer.WriteLog(0, string.Format("Stream error: {0}", Bass.BASS_ErrorGetCode()));
                    }
                InsertarTemasReproducidos(_actualTema);
                }
             else
                {
                    LogsFromPlayer.WriteLog(0,"Siguiente canción esperando. La anterior aún esta sonando.");
                }

                _playing = true;
                this._playing = true;
            }
            catch (Exception ex)
            {
                LogsFromPlayer.ErrorLog(0,"Play Audio: " + ex.Message);
            }
            return true;
        }[/i][/b]

SteveS

  • Guest
Re: BASS for ARM Linux
« Reply #66 on: 28 Mar '13 - 09:43 »
Hi Ian

Regarding my "some files don't play", I think I have the answer.
Obviously I don't have the source for BASS, so I'm guessing here, but on ARM Linux on the RPi, if I execute a stat on the files in question, I get -1 back, with error set to EOVERFLOW.

If you use the same thing to determine a file size, you'll get the same problem. I did find that BASS copes well with a file reported as zero length, but not otherwise. Maybe clearing the stat structure to all zeros before the stat call would help as a workaround.

Until I figure out how to deal with "large files", I'll keep plugging away, and report any findings I have.
I'm not helped by not being able to use fstat64 (or stat64) without triggering a segmentation fault, I guess because my stat structure is too small, as I haven't figured out exactly which pre-processor defines I need to get it to work correctly. Sigh.


SteveS

  • Guest
Re: BASS for ARM Linux
« Reply #67 on: 28 Mar '13 - 10:19 »
OK. I have my own FILEPROCs which work correctly now :)
By adding -D_LARGEFILE64_SOURCE and -D_FILE_OFFSET_BITS=6, I get large file support in calls like lseek and fstat. This changes the sizeof(off_t) from 4 to 8 (not surprisingly), and seems to fix the local issue with fstat failing to get the correct file size.

Obviously, this doesn't help the standard BASS_StreamCreateFile(), since it will call the 32 bit versions (and get 32 bit sized results).

Since this only happens on a networked file (CIFS) and not local files, I'm guessing it's related to the CIFS stuff and translating the results, so definitely internal stuff (since the files aren't actually that big (<10MB)). Still, I have a workaround which makes my RPi player work reliably, which is what I actually want.

I'd be happy to test a build of the hf version with these defines in, since I know I have a rig which will quickly tell me if it fixes it or not :)

Steve

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #68 on: 28 Mar '13 - 16:35 »
YESSSS!!!!
www.un4seen.com/stuff/libbass.so
Run perfect, without any noise between songs!!!! Thanks very much!!!

Great! To further narrow down what exactly was causing the problem, I will need some information from ALSA, so I will email you a debug BASS version to get that.

OK. I have my own FILEPROCs which work correctly now :)
By adding -D_LARGEFILE64_SOURCE and -D_FILE_OFFSET_BITS=6, I get large file support in calls like lseek and fstat. This changes the sizeof(off_t) from 4 to 8 (not surprisingly), and seems to fix the local issue with fstat failing to get the correct file size.

Obviously, this doesn't help the standard BASS_StreamCreateFile(), since it will call the 32 bit versions (and get 32 bit sized results).

Since this only happens on a networked file (CIFS) and not local files, I'm guessing it's related to the CIFS stuff and translating the results, so definitely internal stuff (since the files aren't actually that big (<10MB)). Still, I have a workaround which makes my RPi player work reliably, which is what I actually want.

I'd be happy to test a build of the hf version with these defines in, since I know I have a rig which will quickly tell me if it fixes it or not :)

Good to hear that you found the cause of the problem. I seem to recall that _FILE_OFFSET_BITS=64 was already defined, but apparently not! Here's an update (hardfp) for you to try, which has been built with it defined...

   www.un4seen.com/stuff/libbass.so

Let me know if you still have any trouble with that.

trentggg

  • Guest
Re: BASS for ARM Linux
« Reply #69 on: 30 Mar '13 - 20:48 »
Sorry for the late reply. Ian, I was setting BASS_CONFIG_BUFFER without DEV. Setting DEV to 50 fixes the music lag (didn't test too much yet.) The sound effects problem is still there. I don't know if I mentioned but I have the same problem on desktop Linux on some machines. One thing I just noticed, if I set music volume to 1/255 it works fine but with music off, sound effects don't play right.

goobliata

  • Posts: 26
Re: BASS for ARM Linux
« Reply #70 on: 30 Mar '13 - 21:27 »
The music issue where it randomly goes haywire still happens.
In case it helps, I made a recording: http://trent.gamblin.ca/tmp/Memo.m4a
This is the music that was playing at the time:
http://www.monster-rpg.com/wiki/m2ost/ogg/chase.ogg
At the time this happened I think I pressed the "volume up" key
(not a hardware key but the one my game assigns the function.)

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #71 on: 2 Apr '13 - 14:38 »
Ian, I was setting BASS_CONFIG_BUFFER without DEV. Setting DEV to 50 fixes the music lag

That's good to know. I'll increase the default to 50ms in the next update.

The sound effects problem is still there. I don't know if I mentioned but I have the same problem on desktop Linux on some machines. One thing I just noticed, if I set music volume to 1/255 it works fine but with music off, sound effects don't play right.

I'll send you debug BASS version to get some info on what's happening internally, eg. with ALSA.

SteveS

  • Guest
Re: BASS for ARM Linux
« Reply #72 on: 5 Apr '13 - 12:16 »

Quote
Good to hear that you found the cause of the problem. I seem to recall that _FILE_OFFSET_BITS=64 was already defined, but apparently not! Here's an update (hardfp) for you to try, which has been built with it defined...

   www.un4seen.com/stuff/libbass.so

Let me know if you still have any trouble with that.

That works perfectly, and I no longer need my own FILEPROC code.
I'm guessing that's not the only difference between it and the previous version.

On the default hardware (bcm2835) the previous version suffered a little from clicks during playback, although playback via a cheap LogiLink C-Media USB audio was fine.

However, this version doesn't have those during playback on either. Of course, it could have been latency caused by my FILEPROC code, but I trimmed those back to the bare essentials, of course.

Many thanks for this.

Will you be rolling the _FILE_OFFSET_BITS=64 version out in an official build soon?

All I need to do now is finish building my add-on hardware (LCD display and some buttons to allow easy stop/pause/prev/next and shutdown) and tweak the UI a bit. Seems a bit odd, since it will run headless, but there is a web server in there as well as being able to control it from a PC...

Thanks again

Steve

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS for ARM Linux
« Reply #73 on: 5 Apr '13 - 15:13 »
Good to hear that the update is working well for you. The _FILE_OFFSET_BITS=64 modification will indeed be in the next official release builds, which will hopefully be available quite soon (just want to get to the bottom of scrww's and trentg's issues first). In the meantime, you can continue to use the build above (it's a release build).

colin

  • Guest
Re: BASS for ARM Linux
« Reply #74 on: 25 Apr '13 - 00:58 »
Hello,
I want to play 2 stereo sound synchronized with sound card ESI UDJ6 ( 6 outputs card 24 bits).
I have a novice question :
where I install files .so, I am under raspberry pi hard float ?
What's the method to compile program ? An example of command line with gcc if you have !

Thanks a lot