Giter Club home page Giter Club logo

Comments (11)

grahamperrin avatar grahamperrin commented on May 16, 2024 3

… pull dev or main and try again. …

Thanks! Working (audible) with main pulled to my everyday FreeBSD 14.0-CURRENT environment.

I have not tested with a fresh installation of any version of FreeBSD, let's assume that the enhancements will be equally good in these environments.

from arttime.

grahamperrin avatar grahamperrin commented on May 16, 2024 2

Less confused now, I overlooked the obvious, for me, setenv

% echo $0
/bin/tcsh
% setenv XDG_DATA_DIRS /usr/local/share
% pulseaudio --start
W: [(null)] caps.c: Normally all extra capabilities would be dropped now, but that's impossible because PulseAudio was built without capabilities support.
% /usr/local/share/sounds/freedesktop/stereo/message-new-instant.oga
/usr/local/share/sounds/freedesktop/stereo/message-new-instant.oga: Permission denied.
% pacat /usr/local/share/sounds/freedesktop/stereo/message-new-instant.oga
% pacat $XDG_DATA_DIRS/sounds/freedesktop/stereo/message-new-instant.oga
% arttime --nolearn -a trafficlightgreen -b trafficlightred -t "I heard the gong. Now I'll set a goal, then see a notification and …"
% 

yes, I hear a sound.

Proof that it works, there remains the question of how best to set things.

from arttime.

poetaman avatar poetaman commented on May 16, 2024 1

@grahamperrin On first glance it looks like arttime wasn't able to find music file to play. I thought freedesktop would have come up with standard install directory spec. On Linux freedesktop sounds are installed under /usr/share/sounds/freedesktop/stereo/*. Does a file like /usr/share/sounds/freedesktop/stereo/message-new-instant.oga exist on your FreeBSD DE? I will anyway add an option to specify sound file on the command line, though it will be helpful to know where are freedesktop sounds installed by default. I found a post that looks relevant here: https://www.reddit.com/r/freebsd/comments/ojp3tl/the_freedesktoporg_is_no_longer_a_viable_resource/.

It would be nice to figure out all possible standard directories to look sound files, and have a few defaults not just one...

Thanks for posting to discussions, for other readers, they might find this useful: #26

from arttime.

poetaman avatar poetaman commented on May 16, 2024 1

@grahamperrin pull dev or main and try again. You shouldn't have to set environment variable as arttime now looks for some standard directories if XDG_DATA_DIRS is not set. Also, if a system has ogg123 then it is preferred over paplay. I am not sure if pulseaudio daemon has anything to do with paplay (on my linux machine pulseaudio --start and pulseaudio --end have no effect on paplay producing sound), but I anyway went ahead and made that change. Can you check again if the issues you mention about pulse daemon have any relation to paplay? I heard some stutter again in ogg123 on Linux VM, it happens once in a while. Changes are in 3a20eba

from arttime.

poetaman avatar poetaman commented on May 16, 2024

From https://specifications.freedesktop.org/sound-theme-spec/sound-theme-spec-latest.html:

If you're an application author and you want to install sounds so that they can be used by your application, you should at least install the sound file in the "freedesktop" theme. This means installing a stereo WAV file in $XDG_DATA_DIRS/sounds/freedesktop/stereo/

And $XDG_DATA_DIRS on my Linux machines is: /usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share. arttime is currently just looking under /usr/share/sounds/freedesktop/stereo/. So I will have to fix it for freedesktop systems anyway... Arttime perhaps should also carry a default sound file in its repository, in case it is unable to find a sound in standard directories, it can play that default notification sound file. The default sound on Linux/Unix is message-new-instant.oga which has a 22KB file size. Not sure if it requires any license to be copied though...

Btw, on my Linux system pacat /path/to/file creates a sharp white noise, and paplay /path/to/file plays sound correctly.

A few questions:

  • Is the environment variable XDG_DATA_DIRS defined in your FreeBSD DE?
    • If yes, what's the value?
    • Are there any sound files under $XDG_DATA_DIRS/sounds/freedesktop/stereo.
      • If yes, is there a file message-new-instant.oga?
  • Do you have https://www.freshports.org/devel/xdg-utils/ installed?
    • If no, does installing change anything? (like message-new-instant.oga becomes available under XDG_DATA_DIRS)?
  • What is your Desktop Environment?

from arttime.

poetaman avatar poetaman commented on May 16, 2024

@grahamperrin I have added a commit where arttime finds message-new-instant.oga under all possible colon-separated directories of $XDG_DATA_DIRS/sounds/freedesktop/stereo. Not sure if it will fix it for BSD, this commit made it to main anyway to benefit Linux DEs that follow freedesktop spec.

from arttime.

grahamperrin avatar grahamperrin commented on May 16, 2024

⚙ D24810 Ensure defintion of XDG_DATA_DIRS @tcberner

% file /usr/share/sounds
/usr/share/sounds: cannot open `/usr/share/sounds' (No such file or directory)
% echo $XDG_DATA_DIRS
XDG_DATA_DIRS: Undefined variable.
% pkg info -x devel/xdg-utils
xdg-utils-1.1.3_2
% pkg info -x kde5
kde5-5.24.6.22.08.1
% cd dev/arttime
% git branch
* main
  oldbsdtput
% git pull
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 14 (delta 5), reused 8 (delta 5), pack-reused 3
Unpacking objects: 100% (14/14), 9.46 KiB | 151.00 KiB/s, done.
From https://github.com/reportaman/arttime
   2cd785d..c5e36a3  main       -> origin/main
   1df6a96..c5e36a3  dev        -> origin/dev
Updating 2cd785d..c5e36a3
Fast-forward
 README.md                      |  2 +-
 bin/arttime                    |  3 ++-
 share/arttime/textart/freebsd1 | 38 +++++++++++++++++++-------------------
 3 files changed, 22 insertions(+), 21 deletions(-)
% ./install.sh 
Progress: 100% done
Installation complete!
Restart your terminal application, type 'arttime' and press Enter.
% 

No sound from arttime (the undefined variable, above), so …

937d380 noted with thanks.

% locate message-new-instant.oga
/usr/local/share/sounds/freedesktop/stereo/message-new-instant.oga
% xdg-settings --help
Use 'man xdg-settings' or 'xdg-settings --manual' for additional info.
% 

xdg-settings(1)

Below: clearly, I'm confused :-)

% xdg-settings set XDG_DATA_DIRS /usr/local/share
Use 'man xdg-settings' or 'xdg-settings --manual' for additional info.
% xdg-settings --list
Known properties:
  default-url-scheme-handler    Default handler for URL scheme
  default-web-browser           Default web browser
% 

from arttime.

grahamperrin avatar grahamperrin commented on May 16, 2024

hier(7)

FreeBSD bug 261349 – Modernise hier(7)

from arttime.

poetaman avatar poetaman commented on May 16, 2024

@grahamperrin If I got it right, at the moment DE installation on FreeBSD does not conform to freedesktop spec in setting XDG_DATA_DIRS for the user. But it seems they have those sound files installed anyway. If FreeBSD's fix to set XDG_DATA_DIRS will take time, I can add an if condition in my code for BSD and bypass looking up XDG_DATA_DIRS directory, and look up a few standard locations like /usr/share/sounds... and /usr/local/share/sounds.... If message-new-instant.oga is found then it will be played. Another possibility as I mentioned previously is to add this sound file in the repository of arttime in a new directory and not look up XDG_DATA_DIRS for Linux and BSD. Though I don't know where to look for its license file... A fix will anyway be welcome as I intend to add a feature where user can pass an option like --sound <sound_file_name>, and <sound_file_name> will be looked up under XDG_DATA_DIRS (expecting users to pass entire path is a bit ugly).

As a sidenote, please update the origin's url:

git remote get-url origin --all
git remote set-url origin https://github.com/poetaman/arttime.git
git remote get-url origin --all

from arttime.

grahamperrin avatar grahamperrin commented on May 16, 2024

… was closure premature? (I didn't think of documentation; sorry.)


… the issues you mention about pulse daemon …

#26, yes? (Should we continue there?)

from arttime.

poetaman avatar poetaman commented on May 16, 2024

@grahamperrin It was ok to close, we can continue discussion there. And your original issue got resolved, any further commits to main should only improve things, which they did in 0c2a0cb, check #26 (comment). Thanks!!

from arttime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.