balbuze / volumio-plugins

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

brutefir 2 breaks volumio 2.175 #51

Closed tomaszrondio closed 7 years ago

tomaszrondio commented 7 years ago

I have (had) clean volumio install. Installed brutefir2 from zip file. I got a message that installation failed because brutefir is already installed (seems to be common bug). Anyway it was visible on plugins list. Once activated it breaks volumio web UI. Ssh works fine. Restarting volumio does not help. I managed to get web UI working by running uninstall.sh and deleting /data/plugins/miscellanea/brutefir folder. Although there is no sound. in /data/configuration/miscellanea/brutefir there is only config.json

volumio@volumio:~$ systemctl status brutefir ● brutefir.service - brutefir Daemon Loaded: loaded (/etc/systemd/system/brutefir.service; disabled) Active: failed (Result: start-limit) since Fri 2017-05-19 22:17:05 UTC; 11s ago Process: 2889 ExecStart=/usr/bin/brutefir /data/configuration/miscellanea/brutefir/volumio-brutefir-config (code=exited, status=1/FAILURE) Main PID: 2889 (code=exited, status=1/FAILURE)

May 19 22:17:05 volumio systemd[1]: brutefir.service: main process exited, code=exite...URE May 19 22:17:05 volumio systemd[1]: Unit brutefir.service entered failed state. May 19 22:17:05 volumio systemd[1]: brutefir.service holdoff time over, scheduling restart. May 19 22:17:05 volumio systemd[1]: Stopping brutefir Daemon... May 19 22:17:05 volumio systemd[1]: Starting brutefir Daemon... May 19 22:17:05 volumio systemd[1]: brutefir.service start request repeated too quick...rt. May 19 22:17:05 volumio systemd[1]: Failed to start brutefir Daemon. May 19 22:17:05 volumio systemd[1]: Unit brutefir.service entered failed state.

volumio@volumio:~$ aplay -l List of PLAYBACK Hardware Devices card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI] Subdevices: 1/1 Subdevice #0: subdevice #0

balbuze commented 7 years ago

Hi, I know this problem... It's because when you first start the plugin, brutefir is not correctly configured, and cannot be reached and prevent volumio to start. But you can't configure it because volumio can't start... I have to handle this error. Sorry for that. I try to find a fix.

tomaszrondio commented 7 years ago

thanks a lot. Let me know and I will try again

balbuze commented 7 years ago

should be better now... but sometimes, UI for setting does not come... Don't forget to configure the right ouptut in advanced settings

tomaszrondio commented 7 years ago

way better. I am getting something. Plugin settings page is empty now. Rest seems to work perfectly fine. I can't find a way to debug it or see any kind of errors log. It would help I guess.

balbuze commented 7 years ago

Thanks for testing. There something very problematic in the Ui I can't figure. In fact, changing a specific line in the code make it appears, and then if back to the previous code, it works... It is like it needs to to be first initialized. The more strange is that persist through plugin install / remove. But on a fresh install... I can send you a version that includes this, but the problem is that value displayed by equaliser are not restored (just in the Ui). They appear to be 0. But the good value is used for the sound.

tomaszrondio commented 7 years ago

tell me which line has to be changed and I will try :)

balbuze commented 7 years ago

I made the changes in a new version. Now it should work... Don't forget to set and save the good output in advanced settings. If you use a RPI 2or 3 you can set filter length to the max if you experience some cut in the sound. And due to the last modification settings seems to be not restored in the Ui, but values are...

tomaszrondio commented 7 years ago

it is alive! Thank you very much! Will learn how to use it, apply custom presets and let you know.

balbuze commented 7 years ago

I uploaded a new version that should fix the UI... (values are properly restored for the equalizer)

tomaszrondio commented 7 years ago

It does not affect my life but values are not restored in my case. I uninstalled old version and installed new. Want me to try with clean volumio install?

balbuze commented 7 years ago

Weird... I will do a test with a fresh install. But do you use the very last plugin? Or I missed something when uploading.. apart that, can you use it, the equaliser, test sample filters ? Don't hesitate, I need user feedback to improve and debug

tomaszrondio commented 7 years ago

cancel! abort! I restarted volumio and everything works fine. Sorry for that... I will test sample filters as soon as possible = tomorrow or day after tomorrow and let you know.

balbuze commented 7 years ago

No problem! Have you tested the equaliser? It needs some cosmetic improvement... and what is your device, dac? Thanks

tomaszrondio commented 7 years ago

I did and it works fine as well as presets. I wouldn't be concerned about equalizer cosmetics. BruteFIR is usable in DRC and hopefully will be used that way. My dac is hifiberry dac+.

tomaszrondio commented 7 years ago

how do you create these filter .wav files? I just tried to generate some with DRC Designer and it killed volumio :)

tomaszrondio commented 7 years ago

ok. Filters haven't killed volumio but somehow configuration was saved with input and output format as S24_LE and sample rate 192000

balbuze commented 7 years ago

I uploaded yesterday a version that handles errors and avoid Ui crash when brutefir fails to start due to a wrong config. And you are right settings must match with the filters format. Let me know.

tomaszrondio commented 7 years ago

yep. I managed to break brutefir and got proper error message. Very nice!

balbuze commented 7 years ago

I struggle a bit to add a filter selector in the UI : instead of typing the name of the filter, the idea is having a dynamic list (list of file in the folder) and just select the one you want to use. Nearly ok ... And the big last improvement is to auto configure input/output and use i2s dac and volume control... If you manage to create filter, I'll be interested for testing or adding it as demo filters.

tomaszrondio commented 7 years ago

I just created first filter in my life using room eq wizard. It should flatten Visaton BG20 speaker (only driver, not room response). I hear difference but I can't tell if that is correct. Its 11pm so I can't do loud measurements. rew.wav.zip

tomaszrondio commented 7 years ago

this is what I did manually and it sounds way better. What i learned so far is that it is super important to set proper filter format. Otherwise it sounds wrong. Attached filter response will work correctly only with my set of speakers. Sometimes I get audio gaps. Increasing filter size solves it. What is filter size? :) rewmanual.wav.zip

balbuze commented 7 years ago

Increasing the filter size avoid a "buffer underflow" in alsa that hang brutefir. The systemd service restart it immediatly, but it is what you ear. If you are interrested, have a look here : https://www.ludd.ltu.se/~torger/brutefir.html the explaination would much better than mine.... Let me know if you need more or other settings...

balbuze commented 7 years ago

Thanks for sharing your filters. If you agree I will add them in demo filters as they sound much better than mine...

tomaszrondio commented 7 years ago

will read that and try to understand as much as possible :) You can do anything you want with these filters. Although I don't think it makes any sense with different speakers. But as I said - it is yours, do whatever you want. I can prepare some filters for you. Just tell me what kind you need. Last one does only that: filtermanual screenshot 2017-05-26 15 01 31

balbuze commented 7 years ago

I know it each filter is specific to one system. I just want to provide 2 ou 3 samples for user that want to test the plugin... even if the result is no better or even bad, but you can hear the effect ;-) ( I spend a lot of time reading and trying to understand brutefir and all options... The plugin is the result of what I understood, maybe not very well! )

tomaszrondio commented 7 years ago

this filter sucks. I thought it will apply only small equalization but it does more. It feels/sounds that it compresses sound as well (makes it louder). I have to investigate more what is going on and why.

balbuze commented 7 years ago

Yep it is not easy to create a good filter... Don't know if you can read french, but if yes there is a nice tutorial here : http://forum-hifi.fr/thread-2003.html and a translation here : https://www.dropbox.com/s/10xdhh83jokzbxv/REW_rePhase_tuto.pdf?dl=0

tomaszrondio commented 7 years ago

I can't read French but this translation is very good. I will learn, practice, fail, get crazy, try again and get back to you when succeed

balbuze commented 7 years ago

To avoid underflow in brutefir I set the systemd service to run as root : in this case brutefir runs with realtime priority that should avoid the problem you met.

balbuze commented 7 years ago

new version uploaded... No more manual config for output/input... But Volumio must be configured with the correct output Before enabling the plugin, and only after Loopback must be selected (it will be done automatically when finished). brutefir service run as root in this version. not fully tested...

tomaszrondio commented 7 years ago

problem I met is that my filter is probably wrong. It changes volume in full frequency range but should not. I don't get what underflow in brutefir is :)

tomaszrondio commented 7 years ago

I did a little experiment. I generated pink noise. Inserted it in Reaper DAW and put through measurement impulse response (via reaverb plugin). And that gave me pretty much what Room EQ Wizard measured: screenshot 2017-05-28 00 08 02 Then on master bus I added reaverb plugin and put filters impulse response. In theory it should flatten frequency from 400hz to 10.000hz. And it did! screenshot 2017-05-28 00 08 27

Conclusion is that I messed something up with brutefir configuration or filter formats bcs data in impulses seems to be fine.

tomaszrondio commented 7 years ago

I just installed newest version over clean volumio install. There is no option to select Output device and I can't hear sound. Config looks similar (it was hw:2 before) but I get:

ALSA lib pcm_hw.c:1713:(_snd_pcm_hw_open) Invalid value for card
ALSA I/O: Could not open audio output "hw:2": No such file or directory.
Failed to init output device.
Failed to initialise digital audio interfaces.

UPDATE: I set hifiberry as output in volumio preferences and it started to work. Music plays, equalizer works. Maybe trick was to enable I2S.

balbuze commented 7 years ago

Ok. .. In fact the plugin use volumio configuration to be configured. It's​because there's no more settings for input output. I'm working to fully automatically​configure it just by enabling the plugin... Do you output to hifiberry ?. Do you use volume control ? Edit l: what is you dac ? Hifierry plus ?

tomaszrondio commented 7 years ago

Yeah I output to hifiberry dac+. I don't use volume control. Actually this filter I uploaded before started to work properly. I have to double check and do some measurements.

In newest readme.md it says: "Set Loopback as output device in volumio playback options." which seems to be not recommended anymore.

tomaszrondio commented 7 years ago

My filters still don't work as they should. I am playing with text filters and brutefir configuration at the moment. How can I restart brutefir properly? brutefir volumio-brutefir-config says that device is busy so I guess that there is some other way.

tomaszrondio commented 7 years ago

ha! I think I nailed it! Remedy is a little console app called sox. Trick is to convert impulse response wav to raw. It cuts wav headers from file and probably something else I don't know about. sox filter.wav --bits 16 --encoding signed-integer --endian little filter.raw http://sox.sourceforge.net/

this filter cuts high frequencies by 3db. rephase.raw.zip

balbuze commented 7 years ago

good ! I'll try tomorow. I'm nearly done with the plugin autoconf, but I struggle to finish...

tomaszrondio commented 7 years ago

write me how to restart brutefir. I want to try doing custom configurations. eq on each driver + eq of room and phase response.

balbuze commented 7 years ago

To restart brutefir you can do "systemctl restart brutefir". But I think the problem is different for you. The plugin takes its configuration from volumio. The first time it is ok. But once you have set Loopback, if restart, the config becomes wrong.. in this version the only way is to disable plugin, set the right output in volumio, enable the plugin, and set Loopback in volumio. Sorry for that. It is solved in the version I have but due to other problem I can't publish it yet

tomaszrondio commented 7 years ago

If I put some custom values in config I have to restart. Saving advanced plugin configuration does restart but overwrites my changes. I only need some way to restart brutefir without overwriting my custom coeffs etc.

balbuze commented 7 years ago

If you have change something in brutefir config, the best is to do that in brutefir.tmpl this file is the template used by the plugin to create the volumio brutefir config. With that, when you save, it should be ok

tomaszrondio commented 7 years ago

great!

balbuze commented 7 years ago

If your tests bring to add new parameter let me know. I'll add it in the template file.

tomaszrondio commented 7 years ago

sure but it probably won't :) I want to try active crossover that is why I need editing config file.

balbuze commented 7 years ago

Hi. This something that might interest me... In which case do you use it? It is near Bauer binaural filter?

tomaszrondio commented 7 years ago

I build speakers on my own and need something for testing. Next step is multichannel soundcard and amp for each speaker driver to build real active system. Good read: https://www.computeraudiophile.com/ca/ca-academy/Advanced-Acourate-Digital-XO-Time-Alignment-Driver-Linearization-Walkthrough/

balbuze commented 7 years ago

I made more test with the filter you sent, and I realize that the result really depends of the filter_format setting. When changing this value, 2 cases : brutefir hangs or the sound is very distorded. The setting should match with the filter generated

tomaszrondio commented 7 years ago

Absolutely. The one I sent is 16 bits little endian.

balbuze commented 7 years ago

I (quickly) read the article you sent. Very interessant