How to control Volume on Apple Watch Bluetooth Audio - audio

I recently developed an app that runs on the Apple Watch. It plays audio clips that you can hear on your BlueTooth headphones or speakers connected to your watch. I tested the app with a set of speakers and headphones, both of which had their own volume control. Everything was fine, so I submitted and was accepted into the Apple App Store.
When Apple AirPods came out, I tried using them with my app. The volume in the AirPods is very low and there does not seem to be any way to control their volume when they are connected to the Apple Watch. I tried using Siri to control the volume, but that works only when the AirPods are connected to the phone, not the watch.
When they are connected to the phone, you can also use phone's own volume controls.
I use WKAudioFilePlayer class to play the clips. There does not seem to be any way to control the volume from the software side either.
Any ideas?

Move to AVAudio​Player, there you have volume API.

Related

Why does Samsung camera app not work without Bluetooth permission?

Since the latest update (I think some time in December 2022), the built-in camera app on my Samsung Galaxy S21 asks for "Nearby devices" permission, and refuses to run if I don't grant it. By "Nearby devices" it means "Bluetooth". I don't know why it calls the permission
"Nearby devices": all other references to Bluetooth call it "Bluetooth",
and you can also access a nearby device using Wi-Fi or even NFC if the device
is close enough.
It doesn't actually need Bluetooth to take photographs, or even to record movies,
but you might have a Bluetooth microphone (I don't) and you might want to use
it to get better sound quality when recording a movie.
Of course the Android best practice advice at
https://developer.android.com/guide/topics/permissions/overview
is not to ask for runtime permissions unless and until you need them,
but Samsung aren't doing that.
I don't want the camera app to announce my presence by probing the Bluetooth headset of
anyone who happens to be near me, and they might regard such an action as intrusive.
So I don't want to give the camera app its nearby devices permission, but it won't
run at all without it.
So how do I get the camera app to run without accessing Bluetooth?
I found some workarounds for this. If your device supports it, you can download Expert Raw from the Galaxy Store. This will take still photos without requiring "Nearby devices" permission. However it doesn't seem to be able to do selfies because there seems to be no way to switch cameras, and it can't do movies or many of the extra tricks that the full camera app can do.
Another option is to run the camera app with Bluetooth disabled. Then it can have its "Nearby devices" permission, but it can't use it. The problem with this is that if you use Bluetooth at other times you have to remember to disable it and enable it.
So I wrote a tiny app which disables Bluetooth, runs the camera app, and restores the previous enabled or disabled state of Bluetooth when the camera app exits. I put this on my home screen instead of the camera app: it has the same icon. You have to remember to exit properly from the camera app using the Back button: the Home or Recents buttons leave my app and the camera app sitting on the task's back stack, so my app doesn't get to run and restore the Bluetooth state.
The app is available on github here in case anyone else wants to use this solution.

Pulseeffects unable to see audio source

I am having issues with Pulseeffects on Pi OS Debian Buster. I am using custom distribution called "Volumio" which is special kind of buster that focus on music and listening to music from more sources (bluetooth, airplay, network drives, local music etc.) I also have GPIO sound card connected in there "HiFiBerry DAC2 Pro"
This Volumio OS has its custom alsa configuration which looks like this:
pcm.!default {
type copy
slave.pcm "volumio"
}
pcm.volumio {
type copy
slave.pcm "volumioOutput"
}
# There is always a plug before the hardware to be safe
pcm.volumioOutput {
type plug
slave.pcm "volumioHw"
}
pcm.volumioHw {
type hw
card "sndrpihifiberry"
}
And here my issue starts. When i launch pulseeffects and i play any music from any source, equalization is not working. In pulseeffects there is something called "apps.monitor" which should monitor which apps are playing something and then automatically start sourcing music from there but it doesnt work. In pulseeffects there are also monitors of outputs like jack or HDMI but those are IDLE, not muted, they just dont "see" the music iam playing. Iam so frustrated from this its been several weeks and iam still trying to solve it or get some help but unsuccessfully.
There is one scenario in which music is being equalized and played how it should be, actually two, but its more like bypassing actual problem. In Shairport-sync (package to have airplay playback from apple devices) you can set in its config file that it should send all audio to PA backed (pulseaudio) and if i do that, then its properly sent to pulseeffects, equalized and played.
Another scenario in which iam able to equalize and play music is when i play locally saved files and i edit MPD.conf to send audio locally (127.0.0.1) over RTP stream and i enable RTP listening in pulseeffects, then it gets there, gets equalized and played.
But these two ways are not how it should work normally. It should either recognize any app (shairport, MPD or others) as an APP which plays music and then source that music from it. And if not then at least monitor of standard 3.5 mm jack should work, i could then set Volumio to play everything through 3.5 Jack, in pulseeffects set input to 3.5 Jack monitor and output to my Hifiberry and it would work but both app.monitor and 3.5 jack monitor are acting like iam not playing anything even though i am playing music.
So what am i doing wrong?

Connect Multiple Bluetooth Speakers with Raspberry Pi

I'm trying to connect several bluetooth devices with Raspberry PI to use them as speakers.
I'm using RetroPie as a distribution, because of the tests I've done it's the only one that matches and allows continuous synchronization with several bluetooth devices at the same time.
However, the system only detects the first device that connects as a sound card, the rest keep the bluetooth synchronization active, but it does not interpret them as audio cards even though it is indicated by blueman-manager.
Is there anything I can do to keep all devices synchronized and supported as audio cards?
Palm,
even so this a old post, it is not yet closed.
As I just got the same issue, here my answer.
What you try to do is to connect mutliple audio sreaming services (Speakers) to 1 audio bluetooth source, that is not possible like this. Therefore your PC only connects to the first box.
You could try multiple bluetooth dongles, but then you run into the timing issue with audio stream syncronization between the boxes.
The only solution is to use Bluetooth 4.1 upwards master-slave services.
Therefore the Speakers need to be connected to each other and seen as 1 device from the PC. In that mode the stream is skewed to ensure syncronous playing.
Many new Bluetooth speakers support this mode.
Hope that helped.

How to make A2DP and HSP work simultaneously

I have a bluetooth headset. When connecting it to Windows 10, it installs two profiles in Playback devices list:
Hands-Free. (HSP profile)
Stereo. (A2DP profile)
The Second one (Stereo) is set to be the "Default Device" and the "Default Communication Device" on the system.
When I start any program that uses the mic (recorder, chat, VoIP Calls, gaming, etc.) The sound suddenly stops working And I can only use the mic until I stop the recorder or the call.
To enable the sound again I need to make the Hands-Free (HSP) profile handle both input and output (sound and mic). Unfortunately, HSP gives really poor sound quality.
I want to know If there is a way, using code, I can change Bluetooth behavior so the two profiles work simultaneously. One handles the sound and one handles the mic so I can have high quality sound and use the mic at the same time.
You will probably never find a solution. I had the same problem (I was trying to create a walkie talkie with 2 headsets connected to the same smartphone).
On Windows (but also on Android) you can't access directly to a BT-microphone or BT-speaker because it is automatically detected as BT headset and the OS take the control of the device.
Your app can then access the OS-device and not directly the hardware device. The only OS able to do that was Symbian I think which had the most BT-protocols. On Windows you will probably never be able to do that and on Android you have to write your own A2DP-protocol if you want to access the device directly without OS interference.
So sad...
Luckily, under windows you can define different devices for communications and sound.
So, you have two choices:
Choosing Hands-free for both mic/speaker only for communication (which will switch back to A2DP after the call/teams).
Choosing another mic for communication which allow you to still use the speaker profile even in communication.
That is a bluetooth restriction : A2DP (high quality audio) cannot be use simultaneously with HFP (hands-free profile)

Change flash player audio output device

Is there a way to change flash players audio output device? if not, is there a swf player who has this possibility? Thanks!
I had an issue until a few minutes ago regarding this.
Two audio devices are available to my XP box: an iMic USB audio I/O device, in which I have permanently plugged my desktop speakers; and a pair of USB headphones with microphone that I plug in occasionally.
The USB headset would take precedence over the USB iMic for applications because apps appear to access the last device plugged in to a USB port. With this in mind, here was my issue:
I would be listening to some Internettings on my USB headset.
Later, I would want to use my desktop speakers for the Internettings.
This entailed unplugging my headset, shutting down Firefox and opening it up again. Because the desktop speakers are considered the most recently plugged in device, they would be default for plugins.
This is damned annoying, I said to myself, and decided a little hacker mode was in order.
Keeping Firefox open, I used Task Manager to kill the "plugin-container.exe" process. This showed a crash screen on any Flash Player applet in Firefox. Then I unplug the headset, and reload the Web page with the applet. Without restarting Firefox, Flash will then play through my desktop speakers.
If I wish to listen on the headset again, I plug the headset in, kill plugin-container.exe, and reload the page. Wham.
For as rare as I intend to switch audio devices, this will cover up part of the mess Adobe left.
I am 99% sure that setting the audio device used by the flash player is something you would need to do on an OS level. You can change the device that flash uses for microphone and video input from the player's settings, but I don't think you can change audio output.
I have found a solution, at least for the Firefox browser, to direct HTML5 audio to a specific audio device:
https://addons.mozilla.org/en-US/firefox/addon/chaudev/
Note: this is a new Firefox addon waiting to be reviewed developed by a friend of mine.
I have been waiting for this for years.
I wanted to use this when my wife is seeing YouTube on her Chrome browser and me seeing anything like Coursera online MOOC lectures (FF) on the TV which is connected to the pc. I wanted to hear my classes on the headset and my wife on the speakers for YouTube.
I have 2 mouses (one for me, wireless) and have installed a neat program called TeamPlayer which gives multiple cursors (each cursor for each mouse).
So I have now literally the capability of 2 persons working on 1 pc.
And on top of that it works seamlessly with "Enounce Myspeed" for speeding up the video lectures' playback.

Resources