sepandhaghighi / nafas

🧘‍♂️ Breathing Gymnastics Application
MIT License
102 stars 6 forks source link

Sound doesn't play, yet no error.. #49

Closed naxels closed 1 month ago

naxels commented 3 years ago

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!

sadrasabouri commented 3 years ago

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

sepandhaghighi commented 3 years ago

@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')
  2. Install pyobjc and repeat the first step

Best Regards

naxels commented 3 years ago

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!
sepandhaghighi commented 3 years ago

@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 commented 2 years ago

@sadrasabouri Would you please handle this issue?

sadrasabouri commented 2 years ago

Sure, ASAP.