GithubHelp home page GithubHelp logo

beepr's People

Contributors

aedobbyn avatar csgillespie avatar nowosad avatar rasmusab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beepr's Issues

quiet hours

I love your package and use it all the time. I'd love it if you could add "quiet hours" logic as to whether to actually beep or not. For long runs I kickoff before bed I sometimes forget to mute my machine and have woken up to the beep!

The first pass implementation of this would be to just pass a character vector to beep like c("22:00", "07:00") (defaults to NULL, i.e., doesn't respect quiet time so as not to break current usage) and then compare against "now" (chron::times might be a good approach internally to convert the input and compare it to the Sys.time). This is pretty straight forward and I could submit a PR if this is something you'd be willing to add.

A next step off of this would be to build an options argument that can be set globally for the package so you don't have to pass it in with each beep call. I've seen this in other packages, but haven't done it myself, so I'd have to research a bit more how it is done.

Anyway, let me know what you think.

Can't play beepR in Arch Linux

Hi. Im using Arch Linux with Rstudio.

Unfortunately, beepr is not working.

I run beep() function and nothing happens. My audio cards are ok.

Any idea of whats happening?

beep(0) on RStudio Server

This works on local desktop version of R. I am not able to hear anything when I run this function on the R Studio Server. Any suggestions what I need to do get it work on the Server ?

WISH: Make package lightweight by dropping dependency on 'stringr'

The 'stringr' package depends on 'stringi', which is quite heavy and takes a long time to install from source. Looking at the source code, 'beepr' uses:

  • stringr::str_detect()
  • stringr::str_replace_all()
  • stringr::str_trim()

These can easily be replaced by base::grepl() and base::gsub(), e.g.

str_detect <- function(string, pattern, ignore_case = TRUE) {
  grepl(pattern, string, ignore.case = ignore_case)
}

str_replace_all <- function (string, pattern, replacement) {
  gsub(pattern, replacement, string)
}

str_trim <- function(string) {
  gsub("(^[[:space:]]+|[[:space:]]+$)", "", string)
}

Doing so would make 'beepr' depend on only 'audio'.

suggestion

The package is awesome! I just have a suggestion. I think that an incredible sound missing is the chorus of Take on Me (A-Ha). Due to fact that Take on Me is an anthem of a generation and specially important for ecologists in Brazil that use R in their daily routine and are very moved with the potential use of ping().

Library doesn't fully load from command line (Linux Mint)

The ping command does not work for me when running R at the Linux command line. It does work in RStudio.

After exploring a bit, I found that, while the function 'ping' loads after I call 'library(pingr)', none of the other functions are loaded into the session. So 'ping()' fails to make any sounds.

This is in R v3.1.0 beta (2014-03-28 r65330) -- "Spring Dance"
in Linux Mint 14.

beepr with RStudio server?

It looks like it is possible to use beepr with RStudio server but i could not find a tutorial. This is what I get when I try to run it:

> beepr::beep(4)
Warning message:
In value[[3L]](cond) :
  beep() could not play the sound due to the following error:
Error in play.default(x, rate, ...): no audio drivers are available

Could you point me in the right direction?

Soundbites echo at the end

4,6,7,11 echos a duplicate portion of the soundbite after its finished playing

called from console in RStudio:

echos function calls
4 beepr::beep(4)
6 beepr::beep(6)
7 beepr::beep(7)
11 beepr::beep(11)

RStudio Server Support?

I've just installed beepr on RStudio Server, i read somewhere i would work, but it isn't working.
Is there a special config or RS Server isn't supported?

thanks.

Some of the sounds have a stutter

On Windows 10 x64, R 4.0.2, Rstudio 1.3.1056, some of the sounds seem to have a stutter, repeating the last millisecond of the sound.

By ear, I can hear it on "complete", "ready", "shotgun", and "sword".

It's trivial and in no way harms the functional purpose of the (very useful!) package, but just thought it best to report this.

Recent beep() problem with Linux... and fix proposal

Hi,

Thank you for this useful small package.

The beep function doesn't work anymore on my computer, returning that "no audio drivers are available"

I've recently upgraded my Linux Fedora box from release 21 to 22, and also upgraded all my R packages. So, I don't know if the problem is related to some R packages or the Linux distribution.

It comes out that the problem is not related to the audio driver, but that it finds its origin in the "is_wav_fname" function, which returns FALSE even if fname is a valid wav file.

"is_wav_fname" uses "ignore.case(".wav$"), which is deprecated.

So, I replaced
"str_detect(fname, ignore.case(".wav$"))
by
"str_detect(fname, fixed(".wav", ignore_case=TRUE))

and this solves the problem.

Bart

suggestion - add path

Cool package !!!
I have a suggestion. I'd like to ping local wave file.
So, could you add "path" parameter to "ping" function?
Like this
ping <- function (sound = 1, path = NULL, expr = NULL) {
[...]
if (!is.null(path)) {
sound_path <- path
}
else {
sound_path <- system.file(paste("sounds/", sound_fname,
sep = ""), package = "pingr")
}
play_file(sound_path)
}

Can you tag current release as v0.1

Hi Rasmus

Nice package.

Can you tag the current release as v0.1 so I can ensure I always explicitly pull this version using install_github(rasmusab/[email protected]) as opposed to a development version.

Also any plans to get it on CRAN?

Thanks

Joe

BUG: MS Windows requires download.file(..., mode = "wb")

beep(url) uses:

if(download.file(sound, destfile = temp_file, quiet = TRUE) == 0) { # The file was successfully downloaded

to download the file. However, download.file() defaults to mode = "w" (text mode), which works fine on Linux and macOS, but on MS Windows, it'll automagically turn \n (LF) into \r\n (CRLF) and vice versa, also in binary files. To avoid this, explicitly specify mode = "wb", i.e.

        if(download.file(sound, destfile = temp_file, mode = "wb", quiet = TRUE) == 0) { # The file was successfully downloaded

Project says GPL-3.0 license, but includes sounds from video games

Since sounds used within beepr are from Final Fantasy, Warcraft 2, Facebook, DOOM, etc., I think it may clash with the validity of the package license when the files are included in the distribution of the package itself.

I think removing them would help the distribute-ability of the package and help keep compliance with the license. Instead, they can just be made links to resource files to other places, since the package supports playing sounds from a url.
Like
beep("http://www.wolfensteingoodies.com/archives/olddoom/sounds/dsshotgn.wav")
instead of
beep(7)

Rstudio Jobs and beepR

Hi,

Since Rstudio 1.2, we can run different jobs in background. (See this article)
I tried to run a small script with a beep() call but I don't hear anything.

Example script

library(beepr)
Sys.sleep(2)
beep(1)
cat("Done \n")

Do you think it's possible to tweak Rstudio or the package in a way this can work ?

PS : Awesome package, thanks a lot !

Could this work in a Shiny app?

I love this package and use it a lot! I recently tried it in a Shiny app and could not get the sound to go in a deployed app. It works perfectly when I use shiny::runApp() from Rstudio. My deployed Shiny app's log shows the package loading fine and no errors related to the Beepr package. Is there something fundamental to a Shiny app that would prevent it from working?

Suggestion aplay

Hi, it would be great if you can include aplay instead or apart from vlc, cause it is almost ever installed and it is a very little program, anyways I tried to and it seems no hard, I could fork it if you want:
alsaplay <- function(fname) {
system(paste("aplay -q", fname),
ignore.stdout = TRUE, ignore.stderr=TRUE,wait = FALSE)
invisible(NULL)
}

paplay not working with Ubuntu 20.04

Perhaps it's specific to my system, but no sound comes from paplay when playing wav files (no error also). play_aplay() and play_vlc() both work.

Maybe aplay could be first in the if/else hierarchy of play_file(). Or add an option to choose which program to use with beep().

Multiple calls crash R/Rstudio

Hi Rasmus, thanks for the function, I use it in almost everything. However I've just realised it may have been the cause of all my crashed R sessions - please see this bug which RStudio team just closed cos it's probably not specific to them i.e. is an R core issue:

rstudio/rstudio#3549 (comment)

Thanks!

Add URL and BugReports to DESCRIPTION

To make it easier to find this GitHub repos from CRAN package pages and elsewhere, please consider adding URL and BugReports fields to the DESCRIPTION file.

beepr crashes R on Windows 10 & 11 machines

Hi, I'd like to mention an issue I encountered when using beepr on a Windows 10 and 11 machines. I should mention that the Windows 11 machine is equipped with 16gb RAM, i7 12th Gen Intel and an RTX 3070. Also, I am using R 4.1.1 on both machines. When performing some analysis (e.g., GWR) and I am using the beepr package after some code chunk, in order to notify me that the chunk completed the analysis, R crashes right after the notification sound of beepr. If I don't use the notifications from beepr ``R continues without any problem. The same happened with other Windows machines (I tried it with my friends laptop). Any ideas of why might that happens? Thanks

Cannot play some files on OSX

> beepr::beep( "http://www.wavsource.com/snds_2014-07-06_8028356563048763/sfx/ocean.wav" )
Message d'avis :
In value[[3L]](cond) :
  beep() could not play the sound due to the following error:
Error in load.wave(fname): incomplete file

Seems to be related to the audio package which does not think the file is fine.

I can get this to work

download.file( "http://www.wavsource.com/snds_2014-07-06_8028356563048763/sfx/ocean.wav", 
  "/tmp/ocean.wav" )
system( "open /tmp/ocean.wav" )

This uses iTunes which you can definitely assume is available. Otherwise we could use vlc, but it might not be on the PATH which is what nchar(Sys.which("vlc")) >= 1 cares about. Could do e.g. :

system( "open -a vlc /tmp/ocean.wav" )

Beep on error

Hello! This is a great package.

What do you think about an extension to only beep on error? Something along the lines of:

library(beepr)

beep_on_error <- function(inp, error_beep = 9) {
  q_inp <- substitute(inp)
  
  msg <- paste0("An error occurred in ", deparse(q_inp))
  e <- simpleError(msg)
  
  tryCatch(inp, error = function(e) {
    message(paste0(msg, ": ", e$message))
    beep(error_beep)
  })
}

beep_on_error(log("foo"))
#> An error occurred in log("foo"): non-numeric argument to mathematical function

beep_on_error(log(3))
#> [1] 1.098612

This doesn't work with the forwards pipe but maybe it's worth looking into. If you like, I'm happy to submit a PR.

ping is looping!

I'm running Linux (Ubuntu 13.10), and I installed and tried out ping. I ran the
ping( ) function a few times from the Rstudio command tab, and now I have several 'ping!' noises on an infinite loop.

I think my VLC is set up to repeat a file by default; It's probably possible to use the command line flag --no-loop to fix this.

Cool idea for a package by the way :)

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.