jithware / brethap

https://jithware.github.io/brethap
GNU General Public License v3.0
48 stars 10 forks source link

Play audio tone #34

Closed Dylan-Cairns closed 2 years ago

Dylan-Cairns commented 2 years ago

Brethap is awesome, thanks! Just the app I've been looking for.

I would like to request the option of having an audio tone play. One tone for inhale, and another for exhale.

I personally quite dislike the sound of the tts.

I have never worked with dart/flutter so it might take me a while to figure out, but I'd be happy to give it a shot if you don't have time.

Cheers!

jithware commented 2 years ago

@Dylan-Cairns sure I can take a look at this. It's a good suggestion. I do suspect though it will require the app to have additional permissions which I'd like to keep to a minimum. No objection to you having a look if you want to learn more about dart/flutter. I quite like it. In fact brethap is my first project using it and has been a good learning experience. My programming philosophy can probably be summed up as "keep it simple ...". If a language helps me stay there, I'm happy. Dart reminds me alot of nodejs, but without all the spaghetti code.

diawinga commented 2 years ago

Brethap is awesome, thanks! Just the app I've been looking for.

I would like to request the option of having an audio tone play. One tone for inhale, and another for exhale.

I personally quite dislike the sound of the tts.

I have never worked with dart/flutter so it might take me a while to figure out, but I'd be happy to give it a shot if you don't have time.

Cheers!

I am also not experienced with darf/flutter and I was looking into how I might be able to learn it and contribute. This is a simple and short tutorial I found introducing dart / flutter :) https://www.freecodecamp.org/news/https-medium-com-rahman-sameeha-whats-flutter-an-intro-to-dart-6fc42ba7c4a3/

Dylan-Cairns commented 2 years ago

Keeping permissions to a minimum makes sense!

Just anecdotally, I have another app on my android phone which is very similar to Brethap (except closed source and a worse UI) which does play tones, and it doesn't require any permissions.

Thanks for the link @diawinga !

diawinga commented 2 years ago

Keeping permissions to a minimum makes sense!

Just anecdotally, I have another app on my android phone which is very similar to Brethap (except closed source and a worse UI) which does play tones, and it doesn't require any permissions.

Thanks for the link @diawinga !

I am also using this closed sourced app which plays sounds and the UI it's not too bad: https://play.google.com/store/apps/details?id=com.apps.paced.breathing&hl=en&gl=US Although it seems it has been abandoned and that's why I started looking for open source alternatives.

jithware commented 2 years ago

@Dylan-Cairns found a decent audio package that doesn't require extra permissions. Seems to work pretty well. If you and @diawinga wanted to add additional tones, it might be a good place to get your feet wet. Here's the changes I made: https://github.com/jithware/brethap/commit/770f1d975f20aed36c228b91b3381bfca1787ffc to get the audio working. Obviously if you add tones they'll need to be opensource/royalty free. It might be cool if you use something like audacity to create them, and save the audacity project to https://github.com/jithware/brethap/tree/master/audio.

Any time I add new preferences, I have to update the minor version of the app. This causes a reset of a previous versions preferences.

diawinga commented 2 years ago

@Dylan-Cairns found a decent audio package that doesn't require extra permissions. Seems to work pretty well. If you and @diawinga wanted to add additional tones, it might be a good place to get your feet wet. Here's the changes I made: 770f1d9 to get the audio working. Obviously if you add tones they'll need to be opensource/royalty free. It might be cool if you use something like audacity to create them, and save the audacity project to https://github.com/jithware/brethap/tree/master/audio.

Any time I add new preferences, I have to update the minor version of the app. This causes a reset of a previous versions preferences.

I installed android-sdk and Flutter SDK. I created a new emulator as well which I can launch with VSCode. I am seeing many errors related to:

uri_does_not_exist https://dart.dev/tools/diagnostic-messages#uri_does_not_exist undefined_identifier https://dart.dev/tools/diagnostic-messages#undefined_identifier

Seems something is not right with my setup. If you have any thoughts on that please let me know. Thank you image

jithware commented 2 years ago

Try running this from a terminal in your brethap directory:

flutter test

If it runs successfully, it's probably in vscode. I've noticed sometimes vscode has trouble locating the dependencies. Often restarting vscode fixes it. But you can also try running:

flutter clean
flutter pub get
diawinga commented 2 years ago

Try running this from a terminal in your brethap directory:

flutter test

If it runs successfully, it's probably in vscode. I've noticed sometimes vscode has trouble locating the dependencies. Often restarting vscode fixes it. But you can also try running:

flutter clean
flutter pub get

Thank you , what you shared helped, the errors are gone. I looked under launch.json, I assume that you are doing the testing on the browser , is that correct? Just curious, is there a way to produce a .apk and install it in the emulator? If so, any hints on that? Thank you :)

jithware commented 2 years ago

I test using a physical device, chrome and flutter test. Before I make any commits, I make sure those all look good. I probably should setup github to run flutter test before it will accept commits/pull requests. I think it's possible to do that. You can see your available devices by running flutter devices. You can select a device to run on by clicking on it in the bottom right of vscode.

I don't use an emulator, but have a look at flutter build --help that should get you in the right direction.

jithware commented 2 years ago

In release >= 1.5.0+30

Available:

diawinga commented 2 years ago

From VSCode, within the main.dart I selected the Run without debugging from the top right (see screenshot) image

I am able to select either to run it on the actual device (with debugging already enabled) or the emulator, although after a while, when the process is completed nothing happens, the app neither launches in the device or the emulator. What are the steps that you are following for launching the app so you can see it's working etc? - Thanks!

jithware commented 2 years ago

@diawinga maybe first get this running:

https://docs.flutter.dev/get-started/codelab

then have a look at:

https://docs.flutter.dev/development/tools/vs-code