No internet connection
  1. Home
  2. Ideas

Sound feedback from button

By Simon Franglen @Simon_Franglen
    2021-05-19 17:32:15.802Z

    Can you play sounds through Soundflow - through the Mac OS when on the screen or via the tablet if on a surface. We want haptic response etc…

    Solved in post #2, click to view
    • 5 replies
    1. Yea I believe you can use afplay. @JesperA you do this right?

      Reply1 LikeSolution
      1. Correct. afplay works great for a lot of things. But in this case @Simon_Franglen osascript -e "beep" might be better.

        In script:

        sf.system.exec({
            commandLine: "osascript -e 'beep'",
        });
        
        sf.system.exec({
            commandLine: "afplay /System/Library/Sounds/Funk.aiff",
        });
        
        1. Andrew Scheps @Andrew_Scheps
            2024-02-26 17:14:29.719Z

            FWIW for some reason osascript doesn't work from SoundFlow in Ventura... afplay with a path does.

            Maybe a Security thing

        2. S
          In reply toSimon_Franglen:
          Simon Franglen @Simon_Franglen
            2021-05-21 09:29:06.278Z2021-05-21 11:33:10.944Z

            BTW - Found this on afplay commands:

            https://ss64.com/osx/afplay.html

            afplay
            
            Audio File Play.
            
            Syntax
                  afplay [option...] audio_file
            
            Options: (may appear before or after arguments)
               -v VOLUME
               --volume VOLUME
                    Set the volume for playback of the file
                    Apple does not define a value range for this, but it appears to accept
                    0=silent, 1=normal (default) and then up to 255=Very loud.
                    The scale is logarithmic and in addition to (not a replacement for) other volume control(s).
               -h
               --help
                    Print help.
            
               --leaks
                    Run leaks analysis.
            
               -t TIME
               --time TIME
                    Play for TIME seconds
                    >0 and < duration of audio_file.
            
               -r RATE
               --rate RATE
                    Play at playback RATE.
                    practical limits are about 0.4 (slower) to 3.0 (faster).
            
               -q QUALITY
               --rQuality QUALITY
                    Set the quality used for rate-scaled playback (default is 0 - low quality, 1 - high quality).
            
               -d
               --debug
                    Debug print output.
            Play can be cancelled with Ctrl-C
            
            Examples
            
            Play music.wav for 5 seconds:
            $ afplay music.wav -t 5
            
            Play jolene.mp3:
            $ afplay jolene.mp3
            
            Play jolene.mp3 at half speed:
            $ afplay jolene.mp3 -r 0.5
            
            1. Nice, thanks for sharing!