Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
naxels opened this issue May 13, 2021 · 6 comments
Open

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

naxels opened this issue May 13, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@naxels
Copy link

naxels commented May 13, 2021

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
Copy link
Collaborator

Thanks for your issue. 🤝
We will take it into consideration.

@sepandhaghighi sepandhaghighi added the bug Something isn't working label May 14, 2021
@sepandhaghighi
Copy link
Owner

@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

@naxels
Copy link
Author

naxels commented May 14, 2021

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
Copy link
Owner

@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
Copy link
Owner

@sadrasabouri Would you please handle this issue?

@sadrasabouri
Copy link
Collaborator

Sure, ASAP.

@sadrasabouri sadrasabouri self-assigned this May 15, 2022
sadrasabouri added a commit that referenced this issue Nov 27, 2022
sepandhaghighi pushed a commit that referenced this issue Nov 29, 2022
* add : `silence.wav` added.

* add : `sound_check` function added.

* change : `sound_check` moved to `run` function.

* log : changes logged. (#49)

* fix : tests fixed.

* change : `SOUND_WARNING_MESSAGE` changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants