Page 5 of 8 FirstFirst ... 34567 ... LastLast
Results 41 to 50 of 76

Thread: Stream audio from iPod touch/iPhone over bluetooth to computer

  1. #41
    Join Date
    Jun 2009
    Location
    USA
    Beans
    47
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    Quick question, is it the bluetooth adapter my script cannot find, or is it the A2DP device?

  2. #42
    Join Date
    Apr 2005
    Beans
    11

    Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    Quote Originally Posted by megamanexent View Post
    Quick question, is it the bluetooth adapter my script cannot find, or is it the A2DP device?
    Bluez won't allow qdbus to just scan and return everything it sees. This is called introspection. Let me post my fix tomorrow before you spend any time on it.

  3. #43
    Join Date
    Apr 2005
    Beans
    11

    Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    The issue:

    $ qdbus --system --literal org.bluez
    /
    Cannot introspect object / at org.bluez:
    org.freedesktop.DBus.Error.UnknownInterface (Interface 'org.freedesktop.DBus.Introspectable' was not found)

    The fix:

    qdbus --system --literal org.bluez / org.bluez.Manager.ListAdapters

    for each adapter until we find our phone/device:

    qdbus --system --literal org.bluez ADAPTERPATH org.bluez.Adapter.ListDevices

    However, your script currently just assumes that the user only has one bluetooth adapter (hci0) in the system so:

    qdbus --system --literal org.bluez / org.bluez.Manager.DefaultAdapter
    qdbus --system --literal org.bluez <DEFAULTADAPTER> org.bluez.Adapter.ListDevices

    Right now your script uses:

    device=`qdbus --system org.bluez | grep /hci0/$your_device`

    and instead could use:

    adapter_device=`qdbus --system --literal org.bluez / org.bluez.Manager.DefaultAdapter | sed -n 's:^[^/]*\([^]]*\)]:\1:p'`
    device=`qdbus --system --literal org.bluez $adapter_device org.bluez.Adapter.ListDevices | sed -n 's/^.*Path: \([^]]*\)]}]/\1/p' | grep $your_device`

    This will work in all versions of ubuntu regardless of how old their bluez version is as long as they have qdbus.

    Anything you can do with qdbus you can do with dbus-send if you want to remove the depency on qdbus. The only issue is that dbus-send returns xml instead of python data structures. The parameters are nearly identical:

    qdbus --system --literal org.bluez <everything else is identical>

    is the same as:

    dbus-send --system --print-reply --dest=org.bluez <everything else is identical>
    Last edited by hohlraum; December 6th, 2010 at 05:10 PM.

  4. #44
    Join Date
    Jun 2009
    Location
    USA
    Beans
    47
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    hohlraum - Thank you for your help. I rewritten the script to use dbus-send and included your fix. Hopefully by doing so, other distros besides Ubuntu can use it too.

    Right now I don't have access to Karmic, do you mind if you could test the script out to see if the changes work?
    Last edited by megamanexent; December 7th, 2010 at 05:47 PM.

  5. #45
    Join Date
    Dec 2010
    Beans
    2

    Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    Quote Originally Posted by Ric123 View Post
    It works! Thanks everyone! jackflap's link worked perfectly! http://jprvita.wordpress.com/2009/12...4-a2dp-stream/
    I've upgraded to Ubuntu 10.04 by now; I have bluez 4.60 and pulseaudio 0.9.21.
    Here's how I did it for my iPod touch (3.1.3) on my Dell Inspiron 1720:
    1. I skipped step one, it was already loaded.
    2. Add "Enable=Source" right under "#Disable=Control,Source" in the "[General]" section.
    3. Restart the computer (to restart all the bluetooth 'stuff')
    4. Pair the iPod touch and the computer by clicking the bluetooth icon -> Set up new device -> Forward. Click PIN options and select '1234', Close. Enable bluetooth on the iPod; on the computer select it in the list, Forward. Type the PIN (1234) on the iPod, Connect.
    5. Install d-feet (from Synaptic) and run it (Applications -> Programming -> D-Feet). Then File -> Connect to System Bus. Under Bus Name select org.bluez and a tree will appear on the right. Under Object Paths, expand the /org/bluez/1464/hci0/dev's until you find the one with Interfaces that have org.bluez.AudioSource. Expand the AudioSource and double-click on Methods -> Connect(). A dialog will appear; just click Execute. It should say 'This method did not return anything' (I had to do it twice the first time.)
    6. Open a terminal (Accessories -> Terminal) and type pacmd and press enter.
    6a. Then type list-sources and press enter. Find the one with device.description = "Name of your iPod" then scroll up to where it says 'name: ' (under 'index: ') and copy the name somewhere without the < and >(mine was bluez_source.00_...)
    6b. Then type list-sinks and press enter. I only had one (ALSA) and copy the name just as before (mine was alsa.output.pci-000_00...)
    6c. Type exit and press enter.
    7. Now type 'pactl load-module module-loopback source=YOURSOURCE sink=YOURSINK' (for me, it was pactl load-module module-loopback source=bluez_source.00_... sink=alsa.output.pci-000_00...) and press enter! Viola! Now the iPod should play through the computer as if it were a headset!

    Note: Save the number that returns after pactl. When you disconnect your iPod, type pactl unload-module YOURNUMBER and press enter (it changes everytime; for example: pactl unload-module 25)

    megamanexent, you have to connect AudioSource, not Audio.

    Tell me if it works with the iPhone 4

    I am trying it with the iphone 4, with a new AZIO bluetooth adapter, and I have been able to get output. However it is essentially unusable because there is an outrageous amount of static, it even slows down the playback speed. Anyone run into this?

  6. #46
    Join Date
    Nov 2006
    Location
    Raleigh/DC
    Beans
    4
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    Thanks for posting this! I have been wanting to set something like this up since I got my Droid, but just now got around to it.

    I have it working with Ubuntu 10.04 and Motorola Droid. The biggest problem was just needing to restart instead of 'bluetoothd restart', to get the Audiosource interface... which wasn't much of a problem.

    My plan now is to set this up in my car with something running embedded linux, such as a beagleboard. I only have an aux in on my head unit, but want to go wireless (which will also eliminate the ground-loop problem I have when charging the phone and have the phone plugged into the aux in... no more static when charging!)

  7. #47
    Join Date
    Feb 2011
    Beans
    1

    Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    Quote Originally Posted by petekalo View Post
    I am trying it with the iphone 4, with a new AZIO bluetooth adapter, and I have been able to get output. However it is essentially unusable because there is an outrageous amount of static, it even slows down the playback speed. Anyone run into this?
    I am having the exact same issue with 10.10 and my iPhone 4. Haven't yet solved it.

  8. #48
    Join Date
    Oct 2006
    Beans
    9

    Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    Quote Originally Posted by brianallred View Post
    I am having the exact same issue with 10.10 and my iPhone 4. Haven't yet solved it.
    Same here with an iPad, albeit there isn't any problems when streaming from my Nexus one through A2DP.. Hope someone find a reason for this bad behaviour

  9. #49
    Join Date
    Sep 2008
    Beans
    8

    Lightbulb Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    I figured since this thread got revived, I would share this script I wrote. The script is attached. It wouldn't let me attach the config file, but I'm sure you can do:
    Code:
    sudo gedit /etc/bluetooth/audio.conf
    I have not tested this on any other system and I cannot guarantee that it will even work for you, but I figured someone may find it useful. At the worst, it will just error out on you. At the best, it will work. Enjoy.

    My sources were two users on these forums and they gave me just enough to get this script done. Thanks goes out to the OP of this thread Ric123, especially this post:
    http://ubuntuforums.org/showpost.php...3&postcount=10

    And megamanextent at this thread:
    http://ubuntuforums.org/showpost.php...2&postcount=25

    I had to edit my /etc/bluetooth/audio.conf to look like this:
    Code:
    # Configuration file for the audio service
    
    # This section contains options which are not specific to any
    # particular interface
    [General]
    
    # Switch to master role for incoming connections (defaults to true)
    Master=true
    
    # If we want to disable support for specific services
    # Defaults to supporting all implemented services
    #Disable=Control,Source
    Enable=Source
    
    # SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
    # Defaults to HCI
    #SCORouting=PCM
    
    # Automatically connect both A2DP and HFP/HSP profiles for incoming
    # connections. Some headsets that support both profiles will only connect the
    # other one automatically so the default setting of true is usually a good
    # idea.
    AutoConnect=true
    
    # Headset interface specific options (i.e. options which affect how the audio
    # service interacts with remote headset devices)
    [Headset]
    
    # Set to true to support HFP, false means only HSP is supported
    # Defaults to true
    HFP=true
    
    # Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
    MaxConnected=1
    
    # Just an example of potential config options for the other interfaces
    #[A2DP]
    #SBCSources=1
    #MPEG12Sources=0
    connectBTAudio.sh
    Code:
    #!/bin/bash
    # Credit to Ric123 and megamanextent for the primer material
    # found at UbuntuForums.Org
    #---------------------------------------------------------------
    # Written by Alex Zaballa on 02/24/2011
    # Distributed under GPL v.2.
    # Use at your own risk. There is no guarantee this will work
    # but shouldn't hurt anything.
    #---------------------------------------------------------------
    # This script is designed to work in Ubuntu Maverick 10.10
    # so I can pair my Android to Ubuntu. I have not tested this
    # with IPhone in any flavor. Your mileage may vary.
    # It requires qdbus and Pulse Audio.
    # This also assumes that your audio.conf file in
    # /etc/bluetooth is configured properly.
    
    clear
    
    echo "Please pair and connect your device."
    read -p "Press any key to initialize audio..." -n 1 garbageVar
    
    # Return Example: /org/bluez/29159/hci0/dev_01_23_45_AB_CD_EF
    qPath="$(qdbus --system org.bluez | grep -m 1 "/dev_")"
    
    # Even though the phone says it's connected, it doesn't work
    # unless I hard-reset the connection. Also, AudioSource.Disconnect
    # won't work reliably in this situation, so I tried the Device.Disconnect
    # method which seems to work well for my Gingerbread Hero (Android 2.3).
    qdbus --system org.bluez "${qPath}" org.bluez.Device.Disconnect 1> /dev/null
    sleep 5
    echo "Attempting connection..."
    qdbus --system org.bluez "${qPath}" org.bluez.AudioSource.Connect 1> /dev/null
    
    
    # Return Example: bluez_source.01_23_45_AB_CD_EF
    bluezSource="$(pactl list | grep -m 1 "Name: bluez_source" | cut -c 8-)"
    echo "Bluez Source: ${bluezSource}"
    
    # Return Example: alsa_output.pci-0000_00_10.1.analog-stereo
    alsaSink="$(pactl list | grep -m 1 "Name: alsa_output" | cut -c 8-)"
    echo "Alsa Sink: ${alsaSink}"
    
    # Return Example: 25
    paID="$(pactl load-module module-loopback source="${bluezSource}" sink="${alsaSink}")"
    echo "pactl ID number: ${paID}"
    
    read -p "Press any key to disconnect..." -n 1 garbageVar
    
    pactl unload-module "${paID}"
    qdbus --system org.bluez "${qPath}" org.bluez.AudioSource.Disconnect
    Attached Files Attached Files

  10. #50
    Join Date
    Mar 2011
    Beans
    2

    Re: Stream audio from iPod touch/iPhone over bluetooth to computer

    first timer here but i have managed to follow all the instructions to the best of my ability, everything went as instructed without issues until the last part. pactl load-module module-loopback source=bluez_source.11_22_33_44_55_66 sink=alsa_output.pci-0000_01_00.1.hdmi-stereo the source being my evo 4g and my computer a hp dv8. long story short it says Connection failure: Connection refused. i dont know what i did wrong. i need help. my computer can play music from my phone. i had windows 7 at one point and it worked fin then but i now have ubuntu 10.10 and i dont know my way around this problem. thank you who ever reads this.

Page 5 of 8 FirstFirst ... 34567 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •