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

Is it possible to record from and play on a bluetooth device? #244

Closed
crocket opened this issue Sep 7, 2019 · 8 comments
Closed

Is it possible to record from and play on a bluetooth device? #244

crocket opened this issue Sep 7, 2019 · 8 comments

Comments

@crocket
Copy link

crocket commented Sep 7, 2019

I want to record from a bluetooth device(e.g., smartphone) and play on another bluetooth device(e.g., bluetooth speaker) simultaneously.

Is that possible?

iPad or iPhone --(record)--> bluez-alsa --(play)--> wired speakers or bluetooth speaker
Local ALSA application --> bluez-alsa --(play)--> bluetooth speaker

@arkq
Copy link
Owner

arkq commented Sep 14, 2019

Yes, it should be possible (if you're talking about A2DP). Just connect both devices and use e.g. bluealsa-aplay to play audio from iPhone. However, it is not possible right now to stream more than one stream into bluetooth speaker (there is no mixer), incoming audio has to be played on wired speaker.

@arkq arkq closed this as completed Sep 14, 2019
@crocket
Copy link
Author

crocket commented Sep 14, 2019

Is it possible to use ALSA dmix or ALSA dsnoop to combine two streams into one and send it to bluetooth speaker?

@arkq
Copy link
Owner

arkq commented Sep 15, 2019

No, unfortunately it is not possible. These plug-ins require hardware sound dard with timer which is used for synchronization. See #48.

@crocket
Copy link
Author

crocket commented Sep 15, 2019

What if ALSA dmix outputs to SPDIF output which is connected to SPDIF input which then is read from bluealsa? I'm not sure if this is what bluealsa does. I haven't used bluealsa properly, yet.

@arkq
Copy link
Owner

arkq commented Sep 15, 2019

The problem right now is that bluealsa can handle only one PCM stream (input and output) and the usage of dmix is not possible. So everything, which allows to externally mix PCM streams and forward them to bluealsa might do the trick. You have to try it and see the results, though.

@crocket
Copy link
Author

crocket commented Sep 15, 2019

I already use SPDIF trick to route ALSA dmix to JACK although I am going to remove JACK and use ALSA only. I guess it can also work for bluealsa as long as bluealsa can read from SPDIF input.

I imagine something like this

pcm.!default {
  type plug
  slave {
    type dmix
    slave {
      pcm "spdif_out"
    }
  }
}
arecord -D spdif_input | aplay -D bluealsa

@arkq
Copy link
Owner

arkq commented Sep 15, 2019

I guess it can also work for bluealsa as long as bluealsa can read from SPDIF input.

If it's standard ALSA interface (PCM), then you can use arecord|aplay, otherwise you will have to create some forwarding (or modify bluealsa to support reading from SPDIF). You might use bluealsa D-Bus API (omit ALSA library which might add additional overhead and delay). See bluealsa-aplay for reference implementation.

@crocket
Copy link
Author

crocket commented Sep 15, 2019

You can also use ALSA loopback device, but when I used ALSA loopback, it caused a lot of pops.

https://alsa.opensrc.org/Jack_and_Loopback_device_as_Alsa-to-Jack_bridge

You might want to try ALSA loopback and recommend it to others if it works without pops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants