-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: volume change event support #37
Conversation
Thanks a lot for doing this, I'd be happy to help test (on ios only, my app doesn't support android atm) if you @ me when it's ready to be tested! :) |
Hey @TowhidKashem, this is now ready to test on version |
hey sorry for the late reply, I wanted to wait till the weekend to port my app over from As for the volume visualization, it works great for when the user is speaking (input audio). But it seems the lib doesn't support output audio at the moment, is that right? That's something that would be very useful for my use case: I am building a simulated phone call experience, so when the user is talking I want their speech to be visualized and when they stop talking I send the transcript to the server which creates a response via an LLM and converts it to audio via a TTS service and returns that mp3 to the user which I then play on the phone using Do you think that's something that's possible to support or maybe it's something that should be implemented outside of the lib? Besides this I tested this feature and the lib overall on iOS and I didn't find any issues on a real device (iPhone 13 pro max on iOS 17.6.1)! It felt pretty stable, as I get closer to releasing my app I'll be testing on more devices/simulators and can open issues if I find any. And just a small suggestion incase it's easy to complement (otherwise ignore this) but it would be nice to be able to configure the duration for how long it takes for the lib to stop listening after speech end. I think now it uses the default system duration of 3 seconds (?) on iPhone but that's a tad too slow for me, maybe like 2.5 or 2 would feel better... Anyway thanks again for all the work, looks like u put a lot of effort into it and it shows! |
Hey @TowhidKashem, thank you so much for the feedback! To address your points:
However this should also affect the Android intent setting for We'll also need to add additional timer to match the Android |
That makes sense don't worry about it then! And thanks for letting me know about the undocumented feature in expo-av. I would have never found that otherwise! If that doesn't work I was thinking I might be able to use the audio file as input source in this lib (since u seem to support that):
...and get the sound levels that way somehow. Cause now I send the audio from the server to the RN side as a base64 string which I then play directly in expo-av via loading it as a data uri string. Expo-av I believe still needs to save this file to the file system in the background prior to playing it so I might be able to use that path here in the uri option. And I was guessing might be able to detect volume levels that way? But since you're suggesting the expo-av undocumented feature route I'll start with that first and see how it goes 🤞
Gotcha, makes sense. yea it's not a deal breaker or anything, I can live with the 3 seconds time, just a nice to have if it can be done on ur end without a hacky patch for the android side. And thanks for showing me the hard coded location, In the meantime I will just use patch package or a expo config plugin to change that value for now 👍 |
@TowhidKashem Also a FYI, at one point when |
hey @jamsch sorry just seeing your mention now, but this is great news thanks for letting me know! I'll give this a shot once SDK 52 comes out of beta in a week or two. I did try to use the undocumented apis from expo-av you mentioned before but it didn't work out because it seems they only work if you are recording the audio. In my case I don't want to record, just visualize the sound as it happens in the environment. I couldn't find the documentation page for expo-audio like there is for expo-video, I guess they haven't created it yet do you know if this |
@TowhidKashem Yep, looks like Once you use Which has the following implementations: |
@TowhidKashem By the way, it does seem like you can sample playback audio on |
Hmm I just tried it but it gives this error:
I am on SDK But I'll def give it a shot with expo-audio and sdk 52 soon, will update here how it goes, thanks again for the heads up! |
@TowhidKashem It looks like you also need to call |
With some chat GPT'ing I got it to finally work! Still not sure what the original error was caused by but first I got it to work on an audio file and then from the mic in recording mode. The horizontal bar is moving in response to the sound. The only issue is that the sound is saved afterward. But that's not a huge deal, I can just delete each audio clip afterward. And the recording light next to the camera is also on the whole time but I don't think that's possible to disable anyway since the audio technically is coming form the mic. Anyways glad it's finally working on both ends, thanks for the help! |
This PR adds a
volumechange
event that can be used to indicate whether the user is speakingAddresses issue #35
Closes issue #39
Preview in example app: