Comments (9)
l stop the bluealsa-aplay service, capture is OK!
But when l replay the recorded audio file, it sounds like...fast forward?
(Music on the phone has played almost 20 seconds, recorded file is just 2 seconds)
from bluez-alsa.
l didn't setup my local .asoundrc file and it is empty in my asound.conf
Those files are not necessary, and it is usually easier to debug without them, so that is OK.
But when l replay the recorded audio file, it sounds like...fast forward?
If you have the ffmpeg package installed, please post the output of
ffprobe -hide_banner test.wav
or if not, then the output of
file test.wav
ls -l test.wav
where test.wav
is the file created by
arecord -D bluealsa:DEV=A4:CC:B3:7C:24:27 -f S16_le -c 2 -r 44100 test.wav
from bluez-alsa.
It's very nice of you to reply so fast.
that is the result of the command:
root@raspberrypi:/home/pi# file test.wav
test.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz
root@raspberrypi:/home/pi# ls -l test.wav
-rw-r--r-- 1 root root 5644332 Jun 18 09:39 test.wav
root@raspberrypi:/home/pi# ffprobe -hide_banner test.wav
[wav @ 0x55a7f5beb0] Estimating duration from bitrate, this may be inaccurate
Input #0, wav, from 'test.wav':
Duration: 00:00:32.00, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
and that is the process:
root@raspberrypi:/home/pi# arecord -D bluealsa:DEV=A4:CC:B3:7C:24:27 -f S16_le -c 2 -r 44100 test.wav
[2381] D: ../../../src/asound/bluealsa-pcm.c:1473: Getting BlueALSA PCM: CAPTURE A4:CC:B3:7C:24:27 a2dp
[2381] D: ../../../src/asound/bluealsa-pcm.c:1222: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Setting constraints
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
[2381] D: ../../../src/asound/bluealsa-pcm.c:561: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Initializing HW
[2381] D: ../../../src/asound/bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: FIFO buffer size: 16384 frames
[2381] D: ../../../src/asound/bluealsa-pcm.c:605: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Selected HW buffer: 4 periods x 22048 bytes <= 88200 bytes
[2381] D: ../../../src/asound/bluealsa-pcm.c:636: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Initializing SW
[2381] D: ../../../src/asound/bluealsa-pcm.c:636: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Initializing SW
[2381] D: ../../../src/asound/bluealsa-pcm.c:677: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Prepared
[2381] D: ../../../src/asound/bluealsa-pcm.c:636: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Initializing SW
[2381] D: ../../../src/asound/bluealsa-pcm.c:388: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Starting
[2383] D: ../../../src/asound/bluealsa-pcm.c:231: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Starting IO loop: 7
^CAborted by signal Interrupt...
arecord: pcm_read:2221: read error: Interrupted system call
[2381] D: ../../../src/asound/bluealsa-pcm.c:424: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Stopping
[2383] D: ../../../src/asound/bluealsa-pcm.c:167: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: IO thread cleanup
[2381] D: ../../../src/asound/bluealsa-pcm.c:615: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Freeing HW
[2381] D: ../../../src/asound/bluealsa-pcm.c:471: /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source: Closing
from bluez-alsa.
arecord
always writes a WAV file header of 44 bytes (i.e. no content metadata), followed by the PCM audio frames. So your file contains (5644332 - 44) bytes of audio frames.
The frame size for 2ch s16_le is 4 bytes, so your file contains ((5644332 - 44) / 4) PCM frames.
So, sampled at 44100 frames per second, your file contains 32 seconds of audio.
I can only assume that your playback application is playing it at the wrong speed if it is only taking 2 seconds to play it!
from bluez-alsa.
l'm sorry for that l had a new record today. The playback application also displays almost 32 seconds, but actually l have played maybe 1m10s on my phone. l have played the 32 seconds audio file, and the speed looks like fast->normal->fast...
l cannot say the exact playtime now because l have broken the environment...
Today l tried to install bluez-alsa from Github, so l remove the 'bluez-alsa-utils' from Debian.
After l installed FDK-AAC from Github, l tried the following steps:
download the current code
git clone https://github.com/Arkq/bluez-alsa.git
cd bluez-alsa
configure build environment only after all dependencies are done
autoreconf --install --force
mkdir build
cd build
based on existing Moode build scripts with aac enabled
../configure --disable-hcitop --with-alsaplugindir=/usr/lib/arm-linux-gnueabihf/alsa-lib --enable-aac
compile and install
make
sudo make install
reboot and test
sudo reboot
Problem
root@raspberrypi:/home/pi# sudo systemctl enable bluealsa.service
Failed to enable unit: Unit file bluealsa.service does not exist.
root@raspberrypi:/home/pi# sudo systemctl enable bluealsa-aplay.service
Failed to enable unit: Unit file bluealsa-aplay.service does not exist.
root@raspberrypi:/home/pi# sudo systemctl start bluealsa.service
Failed to start bluealsa.service: Unit bluealsa.service not found.
l cannot start the bluealsa.service and bluealsa-aplay.service :(
Additional context
First command l tried:
root@raspberrypi:/home/pi# ls /usr/lib/arm-linux-gnueabihf/alsa-lib
libasound_module_ctl_bluealsa.a libasound_module_pcm_bluealsa.a
libasound_module_ctl_bluealsa.la libasound_module_pcm_bluealsa.la
libasound_module_ctl_bluealsa.so libasound_module_pcm_bluealsa.so
Second command l tried:
root@raspberrypi:/home/pi# sudo bluealsa -i hci0 -p a2dp-source -p a2dp-sink
bluealsa: W: UUID already registered in BlueZ [hci0]: 0000110A-0000-1000-8000-00805F9B34FB
bluealsa: W: UUID already registered in BlueZ [hci0]: 0000110B-0000-1000-8000-00805F9B34FB
Third command l tried:
root@raspberrypi:/home/pi# sudo systemctl daemon-reload
Forth command l tried:
root@raspberrypi:/home/pi# ls /usr/lib/systemd/system/bluealsa.service
ls: cannot access '/usr/lib/systemd/system/bluealsa.service': No such file or directory
root@raspberrypi:/home/pi# ls /etc/systemd/system/bluealsa.service
ls: cannot access '/etc/systemd/system/bluealsa.service': No such file or directory
Fifth command l tried:
root@raspberrypi:/home/pi# service --status-all
[ - ] alsa-utils
[ - ] apparmor
[ + ] bluetooth
[ - ] console-setup.sh
[ + ] cron
[ + ] cups
[ + ] cups-browsed
[ + ] dbus
[ + ] dphys-swapfile
[ + ] fake-hwclock
[ - ] fio
[ - ] hwclock.sh
[ - ] keyboard-setup.sh
[ + ] kmod
[ + ] lightdm
[ + ] networking
[ - ] nfs-common
[ - ] plymouth
[ + ] plymouth-log
[ + ] procps
[ + ] raspi-config
[ - ] rpcbind
[ - ] rsync
[ - ] saned
[ + ] ssh
[ - ] sudo
[ + ] triggerhappy
[ + ] udev
[ - ] x11-common
Setup
the version of BlueALSA (bluealsa --version): v4.2.0-16-gdd85a7b
the version of BlueZ (bluetoothd --version): 5.66
the version of ALSA (aplay --version): version 1.2.8
from bluez-alsa.
based on existing Moode build scripts
You have not said what OS you are using, but if you are using Moode then please seek help from the Moode maintainers - from what you have said above it appears that Moode does not use the BlueALSA systemd unit files; I guess they must use their own, so you will have to make sure you have them installed.
If you are not using Moode, then its probably best not to use their build scripts because they are clearly specialized for the Moode environment. Instead, follow the guidance on the wiki - the configure options for using systemd are explained there. If you need AAC support I suggest you try
../configure --enable-systemd --enable-aac
... and also, please make sure you do not have pulseaudio or pipewire running.
from bluez-alsa.
The OS l am using is Raspberry Pi 4 64bit under Debian. l was not aware that l had used another environment (till today l get to know what Moode is).
Fortunately, l follow the right way, bluealsa starts again, and has AAC, aptX, LDAC installed!
(../configure --enable-systemd --enable-aac --enable-aptx --with-libopenaptx --enable-aptx-hd --enable-ldac)
Available BT audio codecs:
a2dp-source: SBC, AAC, aptX, aptX-HD, LDAC
a2dp-sink: SBC, AAC, aptX, aptX-HD
hfp-*: CVSD
Unfortunately, the same problem happens again, AAC is much better than SBC, fast foward just sometimes happened.
(root@raspberrypi:/home/pi# arecord -D bluealsa:DEV=A4:CC:B3:7C:24:27 -f S16_le -c 2 -r 44100 test.wav)
SBC: phone played likely 1min, record file is 8 seconds, and the file size is 1455212
AAC: phone played likely 1min, record file is 38 seconds, and the file size is 6879020
Maybe the better codec, the better record? l have no ideas...
Although l have setup aptX, apX-HD, it doesn't work when l choose Qualcomm aptX or aptX-HD on my phone. (No capture device)
l will keep trying...
from bluez-alsa.
root@raspberrypi:/home/pi# ../configure --enable-systemd --enable-aac --enable-aptx --with-libopenaptx --enable-aptx-hd --enable-ldac --enable-cli --with-systemdbluealsaargs="-S -p a2dp-source -p a2dp-sink -c ldac -c aptx -c aptx-hd"
l try to configure like that, but aptx or ldac is still not effective
root@raspberrypi:/home/pi# bluealsa-cli info /org/bluealsa/hci0/dev_A4_CC_B3_7C_24_27/a2dpsnk/source
Device: /org/bluez/hci0/dev_A4_CC_B3_7C_24_27
Sequence: 2
Transport: A2DP-sink
Mode: source
Running: false
Format: S16_LE
Channels: 2
Sampling: 44100 Hz
Available codecs: SBC AAC
Selected codec: SBC
Delay: 15.0 ms
DelayAdjustment: 0.0 ms
SoftVolume: true
Volume: L: 127 R: 127
Muted: L: false R: false
It seems like my phone doesn't have the ability of aptx and ldac, so l need to find other ways to solve the input stream.
from bluez-alsa.
l try to set my RPI 4's WIFI from 2.4GHz to 5GHz, and then everything becomes OK. l have no ideas about the relationship between the RPI 4's WIFI and the Bluetooth capture.
from bluez-alsa.
Related Issues (20)
- HSP HS profile: "arecord -d" duration is ignored HOT 1
- Routing audio to bluealsa from hw:0,1 HOT 31
- Test all deps with pkgconfig HOT 10
- arecord Unable to install hw params, record from bluetooth failed HOT 3
- Error compiling with aptx HOT 1
- Audio cut off in the beginning of the file HOT 3
- how can an SCO link be reestablished after it has been disconnected by the HF device? HOT 2
- How to pipe bluealsa PCM to fifo? HOT 18
- aplay Unable to install hw params HOT 1
- Can't get the A2DP profile to use LDAC codec HOT 11
- LDAC shows only 96KHz as sample rate | support for other sampling rates HOT 14
- Configuring asoundrc for default bluetooth ignored for Internet Browsers? HOT 2
- LE Audio support in bluez-alsa HOT 1
- Audio volume does not go to 100% on Raspberry Pi HOT 19
- Can't detect libsystemd-dev on debian trixie HOT 2
- test-alsa-ctl fails with bluealsa-mock: W: Couldn't get HCI device info: Address family not supported by protocol HOT 2
- test-alsa-midi fails due to permission errors HOT 2
- Build failure: undeclared variables HOT 9
- Distorted recording with certain mic (but not in pulseaudio) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bluez-alsa.