Diffusion audio d'un téléphone mobile vers le Raspberry Pi en bluetooth.

Distribution : 2013-02-09-wheezy-raspbian.zip 1) Configuration de la connexion bluetooth : Configuration et connexion bluetooth par interface graphique : https://miniordi.hacktech.dev/2013/04/05/238/ Connexion bluetooth par ligne de commande : https://miniordi.hacktech.dev/2013/04/07/interface-python-de-controle-pour-le-iracer/ 2) Installation des paquetage bluetooth pour Pulseaudio :

pi@raspberrypi ~ $ sudo apt-get install bluez pulseaudio-module-bluetooth python-gobject python-gobject-2

3) Configuration de l'utilisateur "pi" pour l'accés au daemon bluetooth :

pi@raspberrypi ~ $ sudo usermod -a -G lp pi

4) Configuration d'ADP pour le bluetooth : Ouvrir :

/etc/bluetooth/audio.conf

Chercher :

[General]

Ajouter après :

Enable=Source,Sink,Media,Socket

5) Modification du rééchantillonnage : Ouvrir :

/etc/pulse/daemon.conf

Chercher :

; resample-method = speex-float-3

Ajouter après :

resample-method = trivial

6) Redémarrer le Raspberry Pi. 7) Lancer le panneau de configuration du bluetooth :

  • [Démarrer][Préférences][Gestionnaire Bluetooth]
  • Sélectionner le périphérique bluetooth, ici le téléphone mobile, puis [Setup...]
  • [A2DP Source (Receive Audio)]
  • [Suivant]
  • [Fermé] 8) Afficher les sources bluetooth :
pi@raspberrypi ~ $ pactl list sources short
0       alsa_output.platform-bcm2835_AUD0.0.analog-stereo.monitor       module-alsa-card.c      s16le 2ch 44100Hz       SUSPENDED
1       bluez_source.38_16_D1_33_A8_5E  module-bluetooth-device.c       s16le 2ch 44100Hz       SUSPENDED

9) Lister les éviers :

pi@raspberrypi ~ $ pactl list sinks short
0       alsa_output.platform-bcm2835_AUD0.0.analog-stereo       module-alsa-card.c      s16le 2ch 44100Hz       SUSPENDED

10) Connexion de la source vers l'évier :

pi@raspberrypi ~ $  pactl load-module module-loopback source=bluez_source.38_16_D1_33_A8_5E
24

11) Sortie son vers la prise jack :

pi@raspberrypi ~ $ amixer cset numid=3 1
numid=3,iface=MIXER,name='Master Playback Volume'
  ; type=INTEGER,access=rw------,values=2,min=0,max=65536,step=1
  : values=1,1

12) Monter le son au maximum :

pi@raspberrypi ~ $ amixer set Master 100%
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined penum
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 65536 [100%] [on]
  Front Right: Playback 65536 [100%] [on]

13) Modifier le volume sonore de PulseAudio :

pi@raspberrypi ~ $ pacmd set-sink-volume 0 65537
Welcome to PulseAudio! Use "help" for usage information.
>>> >>>

14) Brancher des haut-parleurs sur la prise jack du Raspberry Pi. 15) Lire un fichier .mp3 sur le téléphone portable, le son est diffusé par le Rapberry Pi !!! :D 16) Liens : http://kmonkey711.blogspot.fr/2012/12/a2dp-audio-on-raspberry-pi.html#!/ http://www.sarawuth.com/2013/01/raspberry-pi-as-a2dp-bluetooth-speaker/