On the desktop

Using my desktop Macbook I can successfully "remote-play" notes on my piano through the USB-Midi to Bluetooth adapter (Yamaha UD-BT01).

First I pair the device through the Audio Midi Setup application:

connect piano

Then I run the following python script:

#!/usr/bin/env python

import pygame.midi # pip install pygame
import time


output_id = pygame.midi.get_default_output_id()
print pygame.midi.get_device_info(output_id)
# Output: 
# ('CoreMIDI', 'UD-BT01 Bluetooth', 0, 1, 0)

player = pygame.midi.Output(output_id)
player.note_on(90, 64)
player.note_off(90, 64)
del player

And instantly I hear the note being played on my piano.

On the Raspberry PI

On the PI I did install bluez-5.49 from source using adafruits tutorial.

So now using the bluetoothctl I see the bluetooth device and I can pair and connect to it.

[UD-BT01]# info
Device E3:43:29:85:A3:F0 (random)
    Name: UD-BT01
    Alias: UD-BT01
    Paired: yes
    Trusted: yes
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
    UUID: Vendor specific           (03b80e5a-ede8-4b33-a751-6ce34ec4c700)

Also the lsusb command shows the connected bluetooth adapter:

Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

Now if I run the same script in the python console I do not get an error but I can't hear a sound. Also the output does not show the device name but it prints the following:

('ALSA', 'Midi Through Port-0', 0, 1, 0)

While with the working setup on my mac I get:

('CoreMIDI', 'UD-BT01 Bluetooth', 0, 1, 0)

So now I am wondering how to get this working on my Raspberry PI.

Update: Similar results with RtMidi

I tried another lbirary pyrtmidi and this would allow me to detect piano keys being pressed on my mac but again not on the raspberry pi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.