nafas icon indicating copy to clipboard operation
nafas copied to clipboard

Sound doesn't play, yet no error..

Open naxels opened this issue 3 years ago • 6 comments

Description

For some reason the sound (wav's) doesn't play while nafas also doesn't report an error..

Steps/Code to Reproduce

pip3 install nafas

python3 -m nafas

Expected Behavior

Sound should play when I start a breathing program

Actual Behavior

The program starts and counters start, however no sound is played. I double checked if my audio is on, but for some reason it just won't play

I even went and ran the command while being inside the install location (because it has the sounds subfolder), still nothing: /usr/local/lib/python3.9/site-packages/nafas

Operating System

MacOS 11.3.1 on a MacBook Pro 13" Intel Using the iTerm app

Python Version

Python 3.9.5

Nafas Version (Use : nafas.__version__)

0.4

Thank you for making this app! really appreciate the work!

naxels avatar May 13 '21 20:05 naxels

Thanks for your issue. :handshake: We will take it into consideration.

sadrasabouri avatar May 14 '21 08:05 sadrasabouri

@naxels

Thanks for your comment 🙏🙏 It's something related to playsound library. Unfortunately, I don't have access to an OSX-based device, if it's possible for you, please check the following in your system and then inform me :

  1. Install playsound library in your system and test it
>>> from playsound import playsound
>>> playsound('/path/to/a/sound/file/you/want/to/play.mp3')
  1. Install pyobjc and repeat the first step

Best Regards

sepandhaghighi avatar May 14 '21 09:05 sepandhaghighi

Thank you,

After running the playsound command, it failed, telling me there was an AppKit error.

Running pip3 install pyobjc installed the required libraries and then running the playsound again, solved the problem.

Now running nafas also plays the sounds :)

I guess the question that remains is: Could it be possible to return an error when playsound returns an error/fails for this to nafas?

In the code I see this only happens when debug is set:

try:
        playsound.playsound(sound_path)
    except Exception:
        if debug:
            print(SOUND_ERROR_MESSAGE)```

Surprisingly I would have hoped that playsound package would have had a dependency on macOS to
resolve this automatically on install..

Thank you!

naxels avatar May 14 '21 13:05 naxels

@naxels

Thanks for your efforts 🥇

Now running nafas also plays the sounds :)

Good news, now we have a solution 👍

I guess the question that remains is: Could it be possible to return an error when playsound returns an error/fails for this to nafas? In the code I see this only happens when debug is set:

Yes, we did this to ensure that this program works on all systems (at least without sound) But we will add an option to test the sound system at the beginning and warn the user

Surprisingly I would have hoped that playsound package would have had a dependency on macOS to resolve this automatically on install..

Yeah, it's a bit weird! We will try to solve this in a future release

Best Regards

sepandhaghighi avatar May 14 '21 17:05 sepandhaghighi

@sadrasabouri Would you please handle this issue?

sepandhaghighi avatar May 12 '22 20:05 sepandhaghighi

Sure, ASAP.

sadrasabouri avatar May 13 '22 05:05 sadrasabouri