BPI-R1 MIC
thank chaos.dennis do this test:
i write about this, because i found very few sources and had to tumble a lot around to get it working. This is a quick walk through to give you a hint where to start. I asume for simplicity that you stay always in /root directory as root user. If something fails, look if the files are written and paths are right. It is adressed for more advanced users who know what they are basically doing.
This is done with bananian 15.08 on Kernel 3.4. Other kernels < 4.4 do not work. It is a headless server with no HDMI pluged in.
A. Basic Setup
Install alsa (renove pulseaudio if present):
# apt-get install alsa-base alsa-utils
Configure asound.conf
# nano /etc/asound.conf
Should look like:
Shutdown, make a cold boot
Call the alsamixer
# alsamixer
Press F5. Your channels should be setup like the attached file at the bottom of this post, or compare it to amixer output:
This step is critical. One false muted channel and you are out of the game.
Test recording.
# arecord -L
Should show a device.
# arecord -f S16_LE -r 44100 -t wav test.wav
Should make kind of Sound. Stop it with ctr-c and check the file.
B. SoX Recording / Streaming
Install SoX
# apt-get install sox libsox-fmt-all
Sox gives you tools like: sox, rec and play. I would suggest you install it on the client pc too.Record striaght to mp3
-c 2 two channels
-C 64 tell the encoder to produce a 64kbit/s mp3
Stop it with ctr-c, check the output.
Listen to it live over LAN
Banana:
# rec -c 2 -C 64 -t mp3 - | netcat -l -p 9000
-t mp3 - produce mp3 stream to stdout
Client:
# netcat <banana ip> 9000 | vlc
Works? Great! Live listening is important to play around and test the mic.
Listen and record at same time
# rec -c 2 -C 64 -t mp3 - | tee test.mp3 | netcat -l -p 9000
Poor man's streaming server
Edit config file:
Insert this at the end:
Restart service
Start recording on banana:
Connect via client:
C. Advanced Recording
Devide recording and postprocessing in two parts
Recording:
-t raw - forward raw input to pipe
remix - Mix the two channels to one
Encoding:
-t raw -r 48000 -c 1 -b 16 -e signed-integer - tell sox what kind of strean comes from stdin
-t mp3 -c 1 -C 32 test.mp3 and what goes out
Note that it is switched to mono from here with -c 1 and the mp3 bitrate is cut in half. Live listening to the strean does not work anymore, i asume it is because of the non regulare output from pipeing and processing in a second step.
Reduce noise
The mic input is pretty bad, lot of white noise. Sox can deal with it.
Make a sample "silent" file:
trim 0 10 record 10 seconds
Test it at client pc:
Create profile file:
Record with noise canceld
Play with the factor of 0.2 to regulate the intensity of cancellation.
D. Record 24/7
My goal of this....
Create a script:
Insert the following:
Recording:
-q less output
Encoding: -v 2.0 Make the input stream louder
-r 22050 encode to a lower sample rate
-C -9.2 Create a low quality VBR mp3
Fileszie ~100mb per day. If you want smaller files, a 8000 sanple rate gives you a gsm grade quality.
Make it executable
Edit crontab:
Insert at the end the following:
A new recording should start every day at midnight.
Last updated
Was this helpful?