New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MoOde - ALSA loopback - SoX #67
Comments
Hi Francesco Number 2. sounds strange, as in both cases the loopback device should not be opened by cava until after the playback device output has been started and the audio settings decided. I have incorporated the changes into mpd_oled now. To be sure that the mpd_oled service is running the version with the changes could you completely uninstall mpd_oled, and then reinstall (package or source) (check I'll check the error with 1. How are you determining the 44.1K with 2? Adrian. |
Hi Adrian, About 1; Tomorrow I will do the test with new mpd_oled: sorry I am very tired: now it is 00:30 in Italy. |
Hi Francesco I'll wait for you to try the current mpd_oled before checking the issue using the headphone jack (as I don't have instant access to a Pi with a headphone jack). Regarding the playback audio rate, I am not sure how I can test that here. If the current mpd_oled doesn't solve the issue then the first steps will be to add a large delay after mpd_oled sees that Moode is playing and before cava is started. This will let you check that cava isn't running, and therefore that it doesn't have the loopback device open, and therefore that mpd_oled/cava isn't using ALSA at that time, and so any audio rate is produced by something else in the ALSA pipeline. Then, see what happens to the rate after cava starts (and opens the loopback). In the meantime, I'll see if I can check here whether Moode can register it is playing before audio playback starts, which would cause the fix in the current mpd_oled to fail. Adrian. |
Hi Francesco I can see that sometimes the mpd_oled play screen appears at least a second before I can hear audio, so I think that this may be the cause of the issue. I'll ask about currentsong.txt on the Moode forum. A possible fix would be a option for mpd_oled to delay starting cava. Adrian. |
Hi Francesco I don't think the current mpd_oled will help with the issue, and so I don't think it is worth installing it. I'll add in an option first for a delay when cava starts, for you to experiment with, and if a delay solves the issue (probably both issues) I'll raise it on the Moode forum. Adrian. |
Hi Francesco If you build the current mpd_oled from source (no package yet) I have added the -Z option to specify a number of seconds to delay starting cava after the first play. The default is 2 seconds, which seems like it might be enough (on my system) for music to be playing. However, the default could be increased, as it is only used the first time that music is played. Adrian. |
Hi Adrian, |
Hi Francesco The delay is set to start at first play after mpd_oled is started, and I believe this is working correctly. I believe the reason for what you are seeing is that mpd_oled sometimes (not always) registers first play during mpd startup (you might see when the display sceen comes on it sometimes shows a blank play screen before changinging tp the clock stop screen). It is not straightforward to determine when Moode is playing music, but the currentsong.txt said the state was "stop" when this was occuring, so I should be able to fix it. Adrian. |
Hi Francesco I have pushed an update that should stop mpd_oled interpreting the mpd startup as 'play'. This means that cava should not be started until you actually choose to play something. A delay is still needed before cava is started and the default for -Z is still 2 seconds. It is possible that an audio source can play without using the configured Loopback device (e.g. using Moode as a bluetooth speaker: http://moodeaudio.org/forum/showthread.php?tid=3788&pid=33487#pid33487), and if the first play is like this then you will probably not get the higher sample rate when you later play from a different source. Adrian. |
Hi Adrian, |
Hi Francesco mpd_oled_cava should not run until you press play and the audio is playing. If you run the following command it will tell you when mpd_oled and mpd_oled_cava were started. Perhaps you could investigate when mpd_oled_cava is starting (with the latest changes to mpd_oled)
Here is an example for me where I restart the machine, wait for the stop screen clock to appear (mpd_oled at 07:57:02), wait a minute or so, and start playing a radio station, I have -Z 10 and the music is clearly playing within a couple of seconds after the play screen appears, and the bars start rising 10 seconds after the play screen appears (mpd_oled_cava at 07:58:33) until reaching full height 5 seconds later
Adrian. |
Hi Francesco I have been rebooting a lot and saw an instance of cava starting early. The reason was that the Moode currentsong.txt had not been written although the flag for the Moode startup finish had been set. mpd_oled handles this by assuming that if the currentsong.txt file is empty or missing then the user wants to take values from MPD rather than Moode, which led to the interpretation of a play state. It is now possible to specify using MPD for values with an mpd_oled option, and so I can make Moode depend on currentsong.txt and handle the empty file case. I'll push a fix for this later. Adrian. |
Hi Francesco I have pushed an update for mpd_oled to expect currentsong.txt to be enabled with "moode". This hopefully resolves some of the difficult-to-determine states. To help debugging, when the first play is detected the currentsong.txt file is written to
Also, cava will start after the -Z delay even if you stop the audio (which could happen if -Z is large) Adrian. |
-Z 15 without any play:
-Z 15 with a play before 15sec from start:
-Z 15 with a play after 15sec from start:
|
HI Francesco You will need to build and run the latest update for the /tmp/currentsong_before_sleep.txt, and /tmp/currentsong_after_sleep.txt files to be written. The first file will say what triggered the first play, and the second will confirm that the play was still current when cava was started (assuming the fles are valid). Adrian |
Hi Adrian, |
Hi Francesco You need to build from source, and also install ( Adrian. |
Sorry Adrian, I don't follow you: I used |
Hi Francesco Did you get the latest code? In the mpd_oled directory run
The first entry should say
If it does not then to get the latest changes run
(and try
If things don't work out, just make a fresh clone of the mpd_oled repository and build and install it (there is no need to build cava again) Adrian. |
Hi Francesco Thank you for posting your results. Does it appear then that the issue is fixed with this mpd_oled update (i.e. no further changes are needed, and the headphone error can be corrected with Moode settings)? Did you have chance to experiment with the -Z option for an idea of whether 2 seconds is a reasonable default (short, and the audio always starts within this time)? Adrian. |
Hi Adrian, |
Hi Francesco Great. I'll close the issue then. I have just made a binary release. I have left the first-play file reports and the -Z option in for now, if needed for debugging, but removed the mention of -Z from the help. Once it is clear that everything is working well I will remove the file reports and the -Z option and hard-code the delay. Thanks for reporting the issue and for all your help to fix it! Adrian. |
Hello Adrian,
After several tests I am sorry to inform you that the version "mpd_oled_test" has not solved the service start.
I can say that I have two different beaviours:
Plaese let me know how can help (with additional tests and/or additional informations) to try to solve this issue.
Regards,
Francesco
P.S.: I have used moOde 7.2.1.
The text was updated successfully, but these errors were encountered: