Capture/Record Audio Input in RaspberryPi - raspberry-pi

I bought a USB Audio Controller for RaspberryPi, in order to capture Audio input. I already done below steps on Rasbian but still unsure about Audio Capturing.
Can you please guide me on how do I get it?
Type the following commands to install the Audio device
pi#raspberrypi ~ $ sudo apt-get install alsa-utils
Detection Successfully by
pi#raspberrypi ~ $ lsusb
pi#raspberrypi ~ $ amixer
pi#raspberrypi ~ $ alsamixer
Also configure USB Audio device to make it default
/etc/modprobe.d/alsa-base.conf
by adding pound/hash symbol with
options snd-usb-audio index=2
#options snd-usb-audio index=2

simply write this command of Command Terminal, in order to record Audio
arecord -f cd -D plughw:0 -d 10 a.wav
Let me know if you get further any issue in recording sound

Related

How do I rebuild Coral mendel with a devicetree modification?

I'm trying to modify the devicetree on my Coral SoM to support a different DSI display, and could use some pointers.
I edited arch/arm64/boot/dts/freescale/fsl-imx8mq-phanbell.dts
then used 'm' to make all
Question:
What is the correct way to modify the devicetree, build and load it to the board!?
Thanks!
can you give a little more details on the changes?
You can definitely do it that way, and I believe you don't need to rebuilt the entire OS, just the kernel is fine:
$ m docker-linux-imx
$ cd ./out/product/packages/bsp
$ scp ./linux-image-4.14.98-imx_11–4_arm64.deb mendel#board-ip
$ ssh mendel#board-ip
$ sudo dpkg -i ./linux-image-4.14.98-imx_11–4_arm64.deb
Another way is to create a device tree overlays. For instance here is a dts for disabling the hdmi: https://gist.github.com/Namburger/f700eb6b18bd1e3697638088d5995c8b
You can then compile it and move it to /boot:
$ dtc -# -I dts -O dtb -o disable-hdmi.dtbo disable_hdmi.dts
$ sudo mv disable-hdmi.dtbo /boot
Then add the file to /boot/overlays.txt to apply it:
$ cat /boot/overlays.txt
# List of device tree overlays to load. Format: overlay=<dtbo name, no extenstion> <dtbo2> ...
overlay= disable-hdmi
Thank you very much Nam.
The first option I think was already working, but I was not sure how to check. It appears that the devicetree can be examined by looking in /proc/device-tree/ for example cat hdmi#32c00000/status gives 'disabled' after doing the modification above, and the HDMI can be verified not working.

Image dump fails during operation

I use the openocd script below to dump the flash memory of a STM32 microcontroller.
mkdir -p dump
openocd -f board/stm3241g_eval_stlink.cfg \
\
-c "init" \
-c "reset halt" \
-c "dump_image dump/image.bin 0x08000000 0x100000" \
-c "shutdown" \
FILENAME=dump/image.bin
FILESIZE=$(stat -c%s "$FILENAME")
echo "Size of $FILENAME = $FILESIZE bytes."
The script is supposed to read the whole memory which is 1MB in my case but it does it very rarely. Generally it stops reading the memory before the end.
Why can't I obtain 1MB each time I execute this script? What is the problem here to cause openocd stop dumping the rest of the memory?
You can use dfu-utils to reflash your STM32 micros.
In Ubuntu/Debian distros you can install dfu-utils with apt:
$ sudo apt-get install dfu-util
$ sudo apt-get install fwupd
Boot your board in DFU mode (check datasheet). Once in DFU mode, you should see something similar to this:
$ lsusb | grep DFU
Bus 003 Device 076: ID 0483:df11 STMicroelectronics STM Device in DFU Mode
Once booted in DFU mode, reflash your binary:
$ sudo dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/$(PROJECT).bin
With -d option you choose product:vendorid such as listed by lsusb in DFU mode.
With the -a 0 option you select alternate mode 0, check the options available as in the following example:
$ sudo dfu-util -l
Found DFU: [0483:df11] ver=2200, devnum=101, cfg=1, intf=0, alt=1, name="#Option Bytes /0x1FFFF800/01*016 e", serial="FFFFFFFEFFFF"
Found DFU: [0483:df11] ver=2200, devnum=101, cfg=1, intf=0, alt=0, name="#Internal Flash /0x08000000/064*0002Kg", serial="FFFFFFFEFFFF"
As you can see, alt=0 is for internal flash memory.
With the -s option you specify the flash memory address where you save your binary. Check your memory map in datasheet.
Hope this helps! :-)

Raspberry Pi MJPEG video stream - start application at reboot

I am making a MJPEG video stream using Raspberry Pi with dedicated Pi Camera. For this I am using jpeg libraries and the following web application found on Github. The use is pretty straightforward, you just type cd mjpg-streamer/mjpg-streamer-experimental and then ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so". However, I would like to make it run on every reboot, so that the camera is "maintenance free".
I researched that I need to put the path and the executable file in the /etc/rc.local. Nevertheless, when I put the path (mjpg-streamer/mjpg-streamer-experimental/mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so") to this executable file, it did not work at all. I tried to run the stream as one command in the Terminal, it did not work either. I also tried to set up a variable PATH in .bashrc in order to access it from /etc/rc.local, but it also did not want to work.
I suspect it might have something to do with command ./mjpg_streamerneeding some input for it to work (-o "output_http.so -w ./www" -i "input_raspicam.so")
Do you have any idea how to start it with every reboot?
Thanks for your time and help
i have solved similar issue for my rpi and jpeg streamer as following.
create a shell script in /home/pi
touch /home/pi/mjpg-streamer.sh
edit that shell script and add this content
#!/bin/bash
cd /home/pi/mjpg-streamer/mjpg-streamer-experimental/
LD_LIBRARY_PATH=.
./mjpg_strea‌​mer -o "output_http.so -w ./www" -i "input_raspicam.so"
make sure new shell script has execution rights
add that shell script to your /etc/rc.local

Raspberry Pi / Octopi USB Camera Setup: What does this mean and how do I use it?

I'm very new to Raspberry Pi, and have no prior notable experience with Linux so this is all new to me...
Octoprint is a 3D printer spooler that you can run on your raspberry pi. One of the features on Octoprint is the ability to setup a USB camera to view either still images or a stream of your print.
I am using the Octopi prepackaged Octoprint image.
Octoprint's github contains the following info referring to my USB camera. But I have no idea how to implement this.
Hama PC-Webcam "AC-150" on Raspberry Pi
./mjpg_streamer -o output_http.so -w ./www -i input_uvc.so -y -r 640x480 -f 10
https://github.com/foosel/OctoPrint/wiki/Webcams-known-to-work
I'm guessing this is an easy command that I enter via console, but I've winged few commands with no luck. Can someone shed some light on how I use this? Like I said I'm an absolute beginner with the pi...
Any help is greatly appreciated!
Try this:
camera_usb_options="-r VGA -f 10 -y"
sudo service octoprint stop
fuser /dev/video0
/dev/video0: **1871m**
$ ps axl | grep **1871** *Change this number by yours*
$ kill -9 **1871**
./mjpg_streamer -i "input_uvc.so $camera_usb_options" -o "output_http.so -w ./www"
sudo service octoprint start

VLC won't start automatically at Ubuntu boot

I am trying to configure VLC to start streaming two streams automatically on boot with Upstart.
Here is my upstart script:
description "VLC streams"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]
exec /home/streamer/stream.sh
and stream.sh:
#!/bin/bash
cvlc -v "/home/administrator/Videos/Kastiel/kastiel.xspf" --sout '#std{access=udp{ttl=2},mux=ts,dst=239.220.220.31:9200}' --sout-keep --loop &
cvlc -v "/home/administrator/Videos/Rozpravky/rozpravky.xspf" --sout '#std{access=udp{ttl=2},mux=ts,dst=239.220.220.2:9200}' --sout-keep --random &
exit 0
However, after the computer boots, there is no stream and VLC process is not running. When I run stream.sh manually, it works with no problem.
Does anybody know what mistake am I doing?
I am using Ubuntu 12.10 and VLC 2.0.5.
Thank you in advance for any help.
Milan
Vlc doesn't support to be run as root due to security reasons.
You should use sudo -u user in script to change the user.
try as :
sudo -u username cvlc -v "/home/administrator/Videos/Kastiel/kastiel.xspf" --sout '#std{access=udp{ttl=2},mux=ts,dst=239.220.220.31:9200}' --sout-keep --loop &