breaktimer-app icon indicating copy to clipboard operation
breaktimer-app copied to clipboard

Ability to set custom sounds for break start and end

Open snnsnn opened this issue 5 years ago • 11 comments

Hi, thank you for the great app. I have been looking something to replace gnomo-pomodoro which can run on any linux distros. I was asking if you could implement ability to use custom sound for breaks and end of breaks notifications. Also ability to accept terminal commands like run, start, stop etc, would be terrific.

snnsnn avatar Oct 14 '19 07:10 snnsnn

Custom sounds is not a bad idea, yeh.

What exactly do you mean for the terminal commands though. You mean you'd like a cli version of the app?

tom-james-watson avatar Oct 14 '19 08:10 tom-james-watson

No, not the cli version, but ability to control breaktimer via terminal commands from other apps, something like:

// To pause the timer
$ breaktimer pause

// Or resume it
$ breaktimer resume

Vs code can run custom commands on workspace load or unload etc. If one forgets to start or resume the timer, he can always rely on these custom commands for certain tasks.

I used to use it https://gnomepomodoro.org this way, but I had to switch to lighter distro.

snnsnn avatar Oct 14 '19 08:10 snnsnn

Will make this issue just be for setting custom sounds.

cli commands is now a separate issue here - https://github.com/tom-james-watson/breaktimer-app/issues/25

tom-james-watson avatar Feb 02 '20 12:02 tom-james-watson

I've actually finished adding support for those cli args FYI - check https://github.com/tom-james-watson/breaktimer-app/issues/25

tom-james-watson avatar Feb 02 '20 13:02 tom-james-watson

Custom sounds would be great! By the way what's the etiquette here on GitHub for such '+1's?

You can give thumbs up to messages:

image

tom-james-watson avatar Mar 18 '20 08:03 tom-james-watson

A workaround would be to add the your custom wav files to /Applications/BreakTimer.app/Contents/Resources/app/app/renderer/sounds, and rename the old files to something like gong_start.wav.bak and gong_end.wav.bak. Then renaming your custom files into gong_start.wav and gong_end.wav

jasonkena avatar Apr 21 '20 07:04 jasonkena

Yup that should work as a workaround if you desperately want this

tom-james-watson avatar Apr 21 '20 08:04 tom-james-watson

I've tried this on Windows and it keeps the original gong sounds. Is there another directory besides the one in AppData I can try? I've got a whole nostalgia thing going so I set my sounds as an snes game pause. Awesome program btw. EDIT: I just needed to restart the computer/program for it to use the new sounds. 🤦

simpledn avatar Apr 06 '21 16:04 simpledn

Keeping this open because some users would like to see this. If you don't care about the feature anymore @snnsnn then you can simply unsubscribe from the issue on the right hand side.

tom-james-watson avatar Apr 07 '21 08:04 tom-james-watson

\\ move to proper directory
$ cd /Applications/BreakTimer.app/Contents/Resources/app/app/renderer/sounds

\\ backup and remove .wav files
$ cp gong_start.wav gong_start.wav.backup && cp gong_end.wav going_end.wav.backup
$ rm gong_start.wav && rm gong_end.wav

\\ download .m4a audio and convert to .wav with proper filename 
$ youtube-dl -f 140 'https://www.youtube.com/watch?v=ZZ5LpwO-An4' -o - | ffmpeg -i  pipe: gong_start.wav
$ youtube-dl -f 140 'https://www.youtube.com/watch?v=TeKk48HGMcI' -o - | ffmpeg -i pipe: gong_end.wav

I used this thread to try and get some custom sounds but I found that only the gong_start.wav sound was actually used for both start and end sounds. After a little poking around in source I found that in /breaktimer-app-master/app/renderer/components/break.tsx line 307-309 there's a comment that says that they sidestepped an issue by just using the same function for both.

 // For some reason the end gong sometimes sounds very distorted, so just
 // reuse the start gong.
      ipcRenderer.invokeGongStartPlay();

I think the issue was actually with their audio file as when I just play it on my mac it sounds distorted. I've changed line 309 and am trying to package from source with $ sudo npm run package but I'm running into an issue where it prints that /tmp/build6582765436.sh: line 2: concurrently: command not found If I try it without sudo $ npm run package then I get something like /var/folders/c7/d94jfgcj1x71nm0q4ypy_6f80000gn/T/build6589469756.sh: line 2: concurrently: command not found

UPDATE I get this when I try to $ npm i

npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"^5.65.0" from the root project
npm ERR!   peer webpack@"4.x.x || 5.x.x" from @webpack-cli/[email protected]
npm ERR!   node_modules/@webpack-cli/configtest
npm ERR!     @webpack-cli/configtest@"^1.0.4" from [email protected]
npm ERR!     node_modules/webpack-cli
npm ERR!       dev webpack-cli@"^4.8.0" from the root project
npm ERR!       3 more (@webpack-cli/configtest, @webpack-cli/info, @webpack-cli/serve)
npm ERR!   11 more (babel-loader, css-loader, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from [email protected]
npm ERR! node_modules/file-loader
npm ERR!   dev file-loader@"^3.0.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^4.0.0" from [email protected]
npm ERR!   node_modules/file-loader
npm ERR!     dev file-loader@"^3.0.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/james/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/james/.npm/_logs/2022-07-19T02_22_51_350Z-debug-0.log

After googling the first line error I found I tried $ npm i reactstrap --legacy-peer-deps and it printed this out:

npm WARN deprecated [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated [email protected]: Disk image license agreements are deprecated by Apple and will probably be removed in a future macOS release. Discussion at: https://github.com/argv-minus-one/dmg-license/issues/11
npm WARN deprecated [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

added 1528 packages, and audited 1529 packages in 2m

177 packages are looking for funding
  run `npm fund` for details

20 vulnerabilities (19 moderate, 1 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

❗at this point I was able to finally run $ npm run package and I got a functioning .app with the gong_end enabled 💯

~~At this point, I am out of my depth here.~~ I am invincible!!

~~Any help would be appreciated.~~

~~Better yet, we could just fix gong_end.wav, maybe add the option to turn Start and End on/off individually, and push it to the main.~~

At this point I have an .app that does what I want it to do. If someone wanted just a start or just an end sound, they could just make the corresponding .wav empty. The only improvement at this point, since I'm using a 2m song, would be to heave the End button also kill the running audio player. As it stands, if I end the break early the song keeps playing. This could be a feature to get me to actually take the damn break tbh.

Here's a video of it working.

This is where I got the inspo for doing any of this.

insasquatchcountry avatar Jul 19 '22 00:07 insasquatchcountry

lol at your choice of song

I actually like the idea of having a single audio file play out whilst the break is running

tom-james-watson avatar Jul 19 '22 07:07 tom-james-watson