Skip to content

beep() does not work in Posit Workbench / Posit Cloud #50

@KennethATaylor

Description

@KennethATaylor

Hello!

I was hoping to use beep() for some long-running code, but I noticed that beep() doesn't work when coding in RStudio or Positron via Posit Workbench.

I think the main issue is that the function looks for an audio driver that would not be present on Workbench.

Workbench runs Linux, so beep() is looking for the relevant audio driver that would not be there. I think the work around for this would be to add a check function like this:

is_rstudio_server <- function() {
    info <- rstudioapi::versionInfo()
    return(info$mode == "server")

    return(FALSE)
}

Then use that to help beep() know when R and the underlying OS are running on a server (where audio drivers are unlikely) instead of a local machine. Then there would need to be some sort of intermediate function that runs the sound through the browser audio instead of trying to leverage an audio driver that is not there.

This second part is a little over my head, but AI alleges it's possible by: 1) making the audio files accessible as web assets via tools::tempdir(), 2) generating HTML/JS code that finds and plays the audio, then 3) triggering the temp HTLM file using rstudio::viewer(). No clue if this is close to the best solution or not though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions