balbuze / volumio-plugins

volumio's plugins from balbuze
190 stars 60 forks source link

Sample Rate not selectable for filters #286

Open thegarbz opened 3 years ago

thegarbz commented 3 years ago

I'm finally making headway with getting this working but I had a few problems. Following the instructions with rephase. It turns out the problem was that 96kHz Rephase filters weren't working and I think this was because Brutefir settings were set to a sample rate of 44100

To the bug / problem: It defaults to 44100Hz but when I press the down arrow there are no alternative options.

What does this mean? Is this something to do with my I2S DAC (HiFi Berry Digi+ Pro). It should support 24/96 just fine. Changing output format from Factory_S24_LE to Factory_S16_LE doesn't change it either.

Where is the sample rate selection come from? What's the limiting factor here?

balbuze commented 3 years ago

Hi! When the plugin is enabled the first time, it ask for a reboot in order to make an hw detection. Sample rate and output format comes from this detection. It may have fail in your case. Use 'reset the plugin' in the plugin settings page. Then reconfigure playback in volumio and reboot. After that, re-enable the plugin and reboot (again). Check if other samplerate are available.

thegarbz commented 3 years ago

Thanks for the quick reply. I'd already been through this process but repeated it now just for good measure. Something is wildly inconsistent. I followed your steps:

Anyway I repeated it and got the 44100 default back image

But clicking the down arrow makes all options disappear again: image

Also as a sidenote: If I add some notes to the official documentation and then send a pull request, does that request come to you or the volumio team? I'm keen to update some of the docs with some helpful notes (such as that spaces in filenames cause issues) but I want to ensure you get to check any changes first. I notice the wiki is hosted on the volumio github and not yours.

balbuze commented 3 years ago

Weird. It seems HW detection fails... Can you check without software volume mixer? For the doc, no problem. I'm in charge of it ;-). Btw, I'm working on new version for the future of volumio. Space in name will show a red warning and plenty of other fixes. For your use, you can overpass hw detection and set direcly in the config file : /data/plugins/audio_interface/brutefir/brutefir.conf.tmpl


#-----------------------
#brutefir config for volumio - b@lbuze 2020
#-----------------------
#This file is used as a template to generate the configuration file of brutefir in the plugin
#-----------------------

   # sampling_rate: ${smpl_rate}; this line is commented
    sampling_rate: 96000; #set your value here
    filter_length: ${filter_size},${numb_part}; # number of taps N,number of partition P = N*P= filter length
thegarbz commented 3 years ago

Thanks for the tip. I will play with this next weekend (travelling for work tomorrow, so no music for a week).

I tried again without the software mixers enabled. Basically the steps up above, but before re-enabling the plugin I set Mixer to None instead of Software. One step forward and one step back. HW detection seems to have worked but no combination of settings would get my DAC to lock so the Digi+ wasn't outputting anything. Additionally I got an error.

I successfully had a full array of supported options for the Digi+ Pro Screenshot 2020-10-25 141510 Screenshot 2020-10-25 141531

But even trying 44100 and Factory S24_LE which is what normally works doesn't seem to do anything.

I tried rebooting and then got the following error: Screenshot 2020-10-25 141435

Mixer was still set to None. I tried setting it to Software, but that still didn't work either, even after a reboot. So I did the reset and disable plugin dance again and am back to where I was before. HW detection seems to have failed I don't have any options to select sample rate, but it all seems to work with 44100Hz.

So I guess this could be classified as a bug that hardware detection fails.

I'm not sure if this is the expected result, but when the software mixer is set to none then the following loop occurs until systemd stops trying:

Oct 25 12:36:57 volumio volumio[1340]: ALSA I/O: Could not set audio output parameters for "hw:2":
Oct 25 12:36:57 volumio volumio[1340]: Failed to set sample format to S24_LE: Invalid argument.
Oct 25 12:36:57 volumio volumio[1340]: Failed to init output device.
Oct 25 12:36:57 volumio volumio[1340]: Failed to initialise digital audio interfaces.
Oct 25 12:36:57 volumio volumio[947]: info: [MyVolumio PluginManager] Loading plugin "my_volumio"...
Oct 25 12:36:57 volumio systemd[1]: brutefir.service: main process exited, code=exited, status=1/FAILURE
Oct 25 12:36:57 volumio systemd[1]: Unit brutefir.service entered failed state.
Oct 25 12:36:57 volumio systemd[1]: brutefir.service holdoff time over, scheduling restart.
Oct 25 12:36:57 volumio systemd[1]: Stopping brutefir Daemon...
Oct 25 12:36:57 volumio systemd[1]: Starting brutefir Daemon...
Oct 25 12:36:57 volumio systemd[1]: Started brutefir Daemon.
Oct 25 12:36:57 volumio volumio[1352]: BruteFIR v1.0m (November 2013)                                (c) Anders Torger
Oct 25 12:36:57 volumio volumio[1352]: Internal resolution is 64 bit floating point.
Oct 25 12:36:57 volumio volumio[1352]: Creating 4 FFTW plans of size 16384...finished.
Oct 25 12:36:58 volumio volumio[1352]: Loading 16 coefficient sets...finished.
Oct 25 12:36:58 volumio volumio[1352]: Realtime priorities are min = 2, usermax = 1, mid = 3 and max = 4.
Oct 25 12:36:58 volumio volumio[1352]: Warning: no support for clock cycle counter on this platform.
Oct 25 12:36:58 volumio volumio[1352]: Timers for benchmarking may be unreliable.
Oct 25 12:36:58 volumio volumio[1352]: Filters in process 0: 0 2
Oct 25 12:36:58 volumio volumio[1352]: Filters in process 1: 1 3
Oct 25 12:36:58 volumio volumio[1352]: ALSA I/O: Could not set audio output parameters for "hw:2":
Oct 25 12:36:58 volumio volumio[1352]: Failed to set sample format to S24_LE: Invalid argument.
Oct 25 12:36:58 volumio volumio[1352]: Failed to init output device.
Oct 25 12:36:58 volumio volumio[1352]: Failed to initialise digital audio interfaces.
Oct 25 12:36:58 volumio systemd[1]: brutefir.service: main process exited, code=exited, status=1/FAILURE
Oct 25 12:36:58 volumio systemd[1]: Unit brutefir.service entered failed state.
Oct 25 12:36:58 volumio systemd[1]: brutefir.service holdoff time over, scheduling restart.
Oct 25 12:36:58 volumio systemd[1]: Stopping brutefir Daemon...
Oct 25 12:36:58 volumio systemd[1]: Starting brutefir Daemon...

During that startup without the software mixer on it looks like hardware detection worked (though the log files screamed :) )

Oct 25 12:36:48 volumio volumio[947]: info: Loading i18n strings for locale en
Oct 25 12:36:48 volumio volumio[947]: AAAAAAAAAAAAAAAAAAAA-> 2 <-AAAAAAAAAAAAA
Oct 25 12:36:48 volumio volumio[947]: AAAAAAAAAAAAAAAAAAAA->  S16_LE S24_LE <-AAAAAAAAAAAAA
Oct 25 12:36:48 volumio volumio[947]: AAAAAAAAAAAAAAAAAAAA->  44100 48000 88200 96000 176400 192000 <-AAAAAAAAAAAAA
Oct 25 12:36:48 volumio volumio[947]: false and true
Oct 25 12:36:48 volumio volumio[947]: info: Auto set output format : ----->S24_LE

When software mixer is enabled I see the following error during hardware detection:

Oct 25 13:32:47 volumio volumio[949]: info: Loading i18n strings for locale en
Oct 25 13:32:47 volumio volumio[949]: ALSA lib pcm_hw.c:1713:(_snd_pcm_hw_open) Invalid value for card
Oct 25 13:32:47 volumio volumio[949]: cannot open device 'hw:softvolume': No such device
Oct 25 13:32:47 volumio volumio[949]: info: ----Hw detection failed :Error: Command failed: /data/plugins/audio_interface/brutefir/hw_params hw:softvolume >/data/configuration/audio_interface/brutefir/hwinfo.json
Oct 25 13:32:47 volumio volumio[949]: ALSA lib pcm_hw.c:1713:(_snd_pcm_hw_open) Invalid value for card
Oct 25 13:32:47 volumio volumio[949]: cannot open device 'hw:softvolume': No such device
balbuze commented 3 years ago

Ok I found the problem with software volume mixer. I will make an update including some other fixes (space in filename), swap filters detection and some other...

thegarbz commented 3 years ago

Oh brilliant, thanks.

My offer still stands to help update the documentation. As a new user it was somewhat difficult to follow, but obviously now that I know how it works it makes more sense. I'd be happy to contribute from that side just to make it all a bit more user friendly.

balbuze commented 3 years ago

Sure! I wrote the doc month ago. It's not up to date. So just send a PR to improve it!😉

balbuze commented 3 years ago

I uploaded a new version... Unfortunately, I can't check it deeply. Please let me know... What is in it ? : HW detection with softvol Warning when space in filter name (filters, target curve, impulse, generated filter) fix for swap filters attenuation +1dB if > 0 sample rate always shown close modals on all screens ...

thegarbz commented 3 years ago

Cheers, I'll put it through its paces on the weekend.

thegarbz commented 3 years ago

Well, confirmed HW detection correctly works now. 96kHz output seems to work well as detected by the DAC and 96kHz filters do too which previously didn't work at all.

File space warnings:

Thanks for the fix to hardware detection and sampling rate.

balbuze commented 3 years ago

Thanks for your feedback! I fixed the problem with space in impulse name. How does the result work for you ? Are you satisfied with your filters?

thegarbz commented 3 years ago

The result works. 96KHz filters are audibly better than 44KHz now that I can use them. I'm still not satisfied, but that will be largely me still needing to get better measurement and a more suitable target curve. I am correcting for a very nasty room response.

Curiously I have so far been very unhappy with DRC-FIR, but I wonder how much of that is due to it also trying to apply time based corrections. My living room is a cement room with glass on one wall. Pretty much the worst case scenario for a sound system so I think that maybe this automated correction is just not able to handle how bad it is. It only even produces remotely acceptable results with "minimal" set as the configuration.

Anyway I ended up updating the documentation and got carried away. I think I re-wrote most of it. I sent a PR through but if you want to preview what it looks like https://github.com/thegarbz/docs/tree/master/docs/06_Plugins_User_Manuals/00_brutefir