Comments (18)
Hi Guys, I faced with the same issue and now it is working property, however only with P2 audio out. I'm case, I realized a issue with PulseAudio and I need to run pulseaudio --start, prior to start TJBot tests
from tjbot.
@sshankarn and @jawetzel
I would recommend you try using the [bluealsa](https://github.com/Arkq/bluez-alsa)
library for playing audio over bluetooth instead of pulseaudio
. It already comes with the latest version of raspberry OS (Stretch) but can also be installed using sudo apt-get install bluealsa
(note you will have to remove pulseaudio).
With bluealsa installed and your bluetooth device connnected, you do have a device id of the form
bluealsa:HCI=hci0,DEV=XX:XX:XX:XX:XX:XX,PROFILE=a2dp
, where xx:xx ..
is your bluetooth device mac address.
I wrote a short blog on how I got this running here. I tested this on a Raspberry Pi 3 running Stretch.
To get TJBot using this, you would update the device id as follows
var tjConfig = {
log: {
level: 'verbose'
},
speak: {
speakerDeviceId: "bluealsa:HCI=hci0,DEV=XX:XX:XX:XX:XX:XX,PROFILE=a2dp" // add your bluetooth device mac address
}
};
Hope this helps.
from tjbot.
Hi @MacLEGO
One thing to confirm is if you are able to use aplay
to play audio.
aplay -D plughw:0,0 /usr/share/sounds/alsa/Front_Center.wav
Another issue may be that you need to specify your audio device (the plughw:0,0
parameter) when playing audio ... See more about device id here
You can do this when initializing the tjbot library by specifying the speakerDeviceId
parameter. For example in test.led.js
you can update your tjbot line to
var tj = new TJBot(['led'], {log: {level: 'debug', speakerDeviceId: "plughw:0,0"}}, {});
It is also a known issue that bluetooth can be unstable on the Pi, I'd suggetst you try out using the 3.5mm to microusb audio cable that comes with the anker speaker.
-V.
from tjbot.
THanks for sharing!
from tjbot.
hi i'm new to Raspberry pi,I'm working on TJBOT the error which i always get odule.js:471
throw err;
^
Error: Cannot find module '/home/pi/Desktop/tjbot/bootstrap/test.speaker.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:502:3
i has clone tjbot folder to my Desktop even the bluetooth speakers are not working plus RGB led gives me the above error.
from tjbot.
I am using a bluetooth speaker - Followed Instructables link for configuring bluetooth and as a result Speaker is working fine / plays music/sound from browser / youtube and other media. Also the, speaker test works fine, and aplay works on my bluetooth speaker as well using commands like speaker-test -t wav -c 6
aplay ~/sample.wav
aplay /usr/share/sounds/alsa/Front_Center.wav)
but not tjbot - is there a specific setting in TJBot library that needs to be tweaked for TTS and STT / conversation.js app
from tjbot.
The right way to specify the speaker device used for playing audio is to set the speakerDeviceId
parameter. Do you have your bluetooth speaker listed when you run aplay -l
? You can use its device id as the speakerDeviceId
parameter.
var tjConfig = {
log: {
level: 'verbose'
},
speak: {
speakerDeviceId: "plughw:1,0" // if your bluetooth speaker is listed as card 1, device 0;
}
};
// instantiate our TJBot!
var tj = new TJBot(hardware, tjConfig, credentials);
from tjbot.
Thanks @victordibia for the input .
aplay -l does not list any blue tooth speakers in my raspberry pi.
And for bluetooth devices (following these steps for bluetooth speaker for tjbot : https://www.raspberrypi.org/magpi/bluetooth-audio-raspberry-pi-3/) the instructions also lead you to install pulse audio. That implies the PCM becomes pulseaudio.
So I tried the aplay -L and it lists pulse as the name. Here goes the output from aplay -L
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
default
Playback/recording through the PulseAudio sound server
sysdefault:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
dmix:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct sample mixing device
dmix:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct sample mixing device
So I wasnt sure what to put in the place of speakerDeviceID : placeholder in the Tjbot code.
I tried "pulse" and 'pulse' and both did not work.
But fiddling around with aplay (which works / plays in my bluetooth speaker without any --device) - if I tried any other device id, it does not play but if I used
pi@raspberrypi:~ $ aplay --device=pulse ./sample.wav
Playing WAVE './sample.wav' : Unsigned 8 bit, Rate 11025 Hz, Mono
it played in my bluetooth speaker. So it seems like 'pulse' is the device id for aplay but it still does not work with tjbot code. Seem like bluetooth speaker does not follow the norms compared to direct or USB especially with this TJBot code. Any thoughts?
from tjbot.
I seccond sshankarn's issue.
Same exact issue here as well, I believe it is a permissions issue, the app is not allowed to access bluetooth
from tjbot.
install.log Rear_Left.wav test.led.js
pi@rose:/Desktop/tjbot/bootstrap/tests $ aplay-D plughw:0,0 Front_Center.wav
bash: aplay-D: command not found
pi@rose:/Desktop/tjbot/bootstrap/tests $ aplay -D plughw:0,0 Front_Center.wav
ALSA lib pcm_hw.c:1713:(_snd_pcm_hw_open) Invalid value for card
aplay: main:788: audio open error: No such file or directory
pi@rose:/Desktop/tjbot/bootstrap/tests $ aplay -l
**** List of PLAYBACK Hardware Devices ****
pi@rose:/Desktop/tjbot/bootstrap/tests $
pi@rose:/Desktop/tjbot/bootstrap/tests $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default
from tjbot.
aplay file.wav worked. it seems this checking script is missing something
from tjbot.
worked here #69
from tjbot.
Hello Team,
I am using a Bluetooth speaker, using that I am able to successfully test the following code:
usr/share/sounds/alsa $ aplay Front_Center.wav
Playing WAVE 'Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
But the error while testing test.speaker.js
`sudo node test.speaker.js
module.js:472
throw err;
^
Error: Cannot find module 'readline-sync'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/pi/Desktop/tjbot/bootstrap/tests/test.speaker.js:19:12)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
`
Please help to resolve the issue.
from tjbot.
Hi,
The error suggests there is a library that has not been installed - readline-sync
.
To install libraries, usually you should run npm install
in the current directory (test directory in this case).
-V.
from tjbot.
Hi @victordibia ,
Thank you for your prompt response.
I installed readline-sync and after that I didn't received any error, but no sound.
Then I tried usr/share/sounds/alsa $ aplay Front_Center.wav and no sound.
After few research I found that readline-sync install pulseaudio in the background, which cause the problem I believe. Then I uninstall the pulse audio.
Now usr/share/sounds/alsa $ aplay Front_Center.wav is generating sound and the readline-sync still persist. Please let me know if you have any other alternative solution.
from tjbot.
I can also do "aplay frontCeter.wav" and I hear the sound from my bluetooth speaker.
However, I can't get test.speaker.js to work.
additionally, "aplay -l " returns an empty list, so don't know how to check device id if that is needed.
from tjbot.
also tried the following command in config (for mac address using hciconfig) - still did not work :-( :
var tjConfig = {
log: {
level: 'verbose'
},
speak: {
speakerDeviceId: "bluealsa:HCI=hci0,DEV=XX:XX:XX:XX:XX:XX,PROFILE=a2dp" // add your bluetooth device mac address
}
};
from tjbot.
I had to connect speaker with a USB adaptor, can't get Bluetooth speaker to work. Apparently Bluetooth support of pi is not very robust.
Additionally, Bluetooth connected speaker will not show up in aplay list. But once connected to USB adaptor - it show up just fine.
from tjbot.
Related Issues (20)
- Investigate using the Pi Zero 2W for TJBot HOT 3
- Create hardware compatibility guide HOT 1
- TJBot body design updates for Pi Zero 2 HOT 3
- Accept (or reject) all these dependabot PRs HOT 2
- Update laser cuts for Pi 4
- error creating session for assistant service / Resource not found / 404 HOT 5
- Make sure conversation_assistant works with the new Watson Assistant dialog and actions
- Maybe train a small GPT model on Shakespere and include it as a new recipe? HOT 1
- Verify that hardware tests and recipes work with RP4 HOT 1
- Find a new replacement for the Anker Mini Bluetooth Speaker, which has been discontinued HOT 2
- Write down the instructions for how to push out a new TJBot release
- Migrate instructions content to the GitHub wiki HOT 11
- Get started with Discussions
- Design new recipe that uses watsonx.ai to have TJBot tell a story
- Rename `conversation` recipe to `conversation-assistant` HOT 4
- Add new recipe for `conversation-watsonx` HOT 1
- Tag recipes based on which RPi hardware they support
- Update bootstrap with latest instructions for installing node.js on RPi
- Update `conversation_assistant` recipe to import ibm-cloud and use the assistant API directly HOT 2
- Figure out how to make `conversation_watsonx` work in javascript HOT 1
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 tjbot.