Reliable metronome with expo - react-native

I'm having trouble building a reliable metronome with expo. For web I used the currentTime property of the audio context to schedule the next click (something like this: https://grantjam.es/creating-a-simple-metronome-using-javascript-and-the-web-audio-api/).
Is there something similar for expo-av or how should I go about this? Also, is there a way to create a sound like with the oscillator in the web audio API or do I have to use audio files?
Tried something like https://github.com/onury/tasktimer which makes it better but not reliable.

Related

Play a sound frequently in React Native App

I'm working on a React Native App. I need to play a beep every 500ms. I already have a mp3 file to play and can it play on click. But after clicking the button a few times, it breaks. I used the example code from expo av. I used the snack from playing audio sounds.
I also could use another mp3 file which is longer, but has to start replaying immediately after ending.
What's the best way to play the beep every 500ms? Using a longer file and replay after ending? Or frequently use the single beep? How can I achieve that?
If you are using react-native-sound library, have a look at the link below: link

how to generate sound in the expo or any way to access web audio API in expo?

how to generate sound in the expo or any way to access web audio API in the expo? i want to create a morse code sound producing app (beep sound)
For Expo SDK 44;
Use the Audio component from expo-av.
See the sample usage from Expo docs for an example:
https://docs.expo.dev/versions/latest/sdk/audio/
Simply export all Morse code character sounds in a directory under assets (ideally) and assign them as you would like in your code.
Here's a wiki folder full of all Morse code sounds in case you need those.
https://commons.wikimedia.org/wiki/Category:Audio_files_of_Morse_code

How to make simple Audio Player in React Native

I am working on React-Native application. I have to play Audio using URL(podcast) source.
The UI should be like following.
I have tried react-native-video library, But, The UI is different.
https://www.npmjs.com/package/react-native-video
Is there any other library available to achieve this?
I have to show Progressbar(Slider), Play/Pause/Stop, Title. And I have to play audio in background state too.
Any suggestions?
You can use this library,
it has everything like Play audio files, stream audio from URL
https://www.npmjs.com/package/react-native-sound-player
react-native-track-player provides almost all features a audio player, you can also use it to play audio in background, used it for this app

Mac API to get current media playing

On the mac you can use their native 'f-keys' to do things like change volume, brightness, and even pause or play music or video.
I was wondering if there was someway to access to 'now playing' media (music or video) through an API or something?
I know it's possible to get currently playing tracks from iTunes using things like ITLibMediaItem or even from other apps by using Applescript to ask the application what it's header is. But how would you figure out which application is the 'currently playing' one and then get the play pause functionality?
Does Apple have an API for this?

Loop wav file seamleassly in the background on windows 8

I have managed to get seamsless looping of wav files using the SharpDX library.
But this does not seem to work while the app is minimised (in the background).
Using the metro players I do not get a seamless loop this is why I use XAudio2 in the SharpDX library.
Hope someone can help with this.
When your app is in the background it no longer has access to the CPU so your audio will stop playing.
The only way around this is with background agents running the audio component. The issue here is that the certification process will be hard on you if you are just playing looping audio. Playing audio in the background is intended for audio player apps (like the inbuilt "Music" app).
If I were a user of your app I would likely be unhappy that it clogs up the audio system when it isn't in the foreground (if, for example, I went to answer a Lync call). If the only way to stop your app playing audio is to go and turn it off manually or exit the app then my opinion is that the user experience isn't great.
Of course, you may have a different opinion, or your app might be doing something I haven't considered.