Capture audio output from raspberry pi (for LEDs) - audio

I have a Raspberry pi 4 and my goal is to connect it to some LEDs that will react to music that is playing through bluetooth (or AirPlay, ...). I've installed rpi audio receiver and so now I can stream music to it.
Now I need to write (or use some) code, that could parse what is being played to the audio output (via built-in 3.5mm jack), so the main question now is:
Is it better (or possible) to intercept the audio somewhere and analyse it with my own code, or does this require some deep modifications to the streaming program? Or do you know of a better solution that could point me to the right direction?
I saw a lot of people using an external mic, but the whole process is too different from mine.
Type of LED strip is not important right now, if I'm able to write my own code for it.
Thanks for any help!

Related

Play audio files in microcontroller (Arduino)

I try to make a Bluetooth speaker with a microcontroller (Arduino, teensy... I don't have a defined model, because I'm considering the frequency)
My question is if I want to put a SD, for reading music stored, the problem is there are library only for ".wav" files, but I want to extend for ".mp3", ".m4a", ".aac" and other.
Exist any library for this? and if is not, How I can do it?
I need to decode an audio files, convert the data in bytes and send it to the DAC.
An example code in C++ will help me a lot, I can created a new library for this.
I don't want use modules, I want to try to do my own circuit.
Edit:
I gonna use a third party microcontroller compatible with Arduino, because I need more capacity for audio.
PDT: I don't know if I had to post this in Arduino o electrict defined, so I put in general.
The Arduino does not have sufficient resources to do this. An MP3 decoder needs plenty of memory and floating point support. The AVR processors used for Arduinos have neither of these.
The only way you are going to do this with a Arduino is if you use a module.
Teensy base on ARM microcontroller (Cortex-M3 & M4) come with FPU, have capacity for play videos. Teensy is a board compatible with arduino. With DAC and SD slot. Adafruit have a library for play .mp3 on this board.
Well .mp3 is enough for me, but in the future I want to learn how to decode other audio file formats.

Is it possible to stream video to raspberry pi from a webcam?

I am building a self driving car model using python(tensorflow). The architecture design of my project looks like the following. The CNN code will be in the raspberry pi, which is connected to a radio controller using wires from it's GPIO pins to send motion signals. The pi then controls the car. To "see" what's around it, the car uses a webcam that is mounted at the front center(this is the puzzle), which I wanted to stream the video to the pi; then the pi will use it's trained model(brain) to decide whether or not to move forward, make a left turn, a right turn and so on. The pi and rc radio controller are not mounted on the car, and I want them to remain that way for a reason. The car has the webcam and that is it. I am considering replacing the webcam with an android phone due to lack of alternatives, but I would hate to do that. If you would like more explanation on the structure of my project, please comment down there.
My question is how can I stream the video to my pi in real time?

Is it possible to extract antenna's radio signal (analog) input samples with RFID FX7500?

I need to do some NON-STANDARD signal processing operations with an RFID-reader, so I'd like to know if it is possible to extract antenna's individual analog (actually digital samples right after ADC) input signal samples with Motorola FX7500 (if you know how this works on FX7400 or FX9500, please do tell, could be helpful). Samples would be processed in a JAVA-based host computer program.
What I've already tried:
Investigating Motorola's own RFID3 API's possibilities, it doesn't go deep enough to actually get in touch with input analog signal samples.
Using LLRP to its full extent, it doesn't allow analog signal sample access either. RFsurvey-functionality would have been helpful to some extent, but FX7500 doesn't support it either.
Accessing RFID-reader's linux terminal, trying to find the driver function(s), that could listen the input sample stream. If current input sample(s) could be extracted from the input stream, I could (in theory) make a script, that would save a few of those sample values in a txt-file in the host computer during a tag inventory round. My linux skills are kinda bad, hence I ask this question.
The only realistic way to solution seems to be via linux terminal, so if you folks have any ideas about that (where to look and what to do), please advise!
Contents of reader:
rfidadm#FX7500abcdef:/$ ls -1
apps
bin
dev
etc
home
include
lib
linuxrc
media
mnt
platform
proc
readerconfig
run
sbin
sys
tmp
usr
var
I cannot completely rule that out, but it's highly unlikely you can get the raw signal digitized; the devices you're looking at aren't really software defined radio devices, typically.
"speaking" RFID physically is a bit different from "usual" wireless communication: The reader doesn't only observe the energy transmitted from the tag, but more importantly the fluctuations of energy extracted from the near field of the reader's antenna coil. Hence, you don't actually have a baseband of RF bandpass signal, but hardware-specific modulations of transmitted (and inversely, antenna-reflected) energy. Demodulation is hence usually done in specialized hardware.
However, do not fret: It's totally possible to build a software defined RFID reader. There have been several approaches to that, but personally, I trust these based on Ettus USRPs and/or GNU Radio best. Look through the results IEEExplore gives you, eg. this search.
Most probably this is not possible with the Motorola readers. What you can do, is use one of the RFID chipsets available on the market: either the AMS RFID IC's, or the Impinj RFID IC's. As far as I know, both IC's support retrieving the digital samples that are received. They also have a development kit to test-drive the IC's.

Recording the Stereo Mix and Parasites

I'm trying to make a video tutorial, so i decided to record the speeches using a TTS online service.
I use Audacity to capture the sound, and the sound was clear !
After dinning, i wanted to finish the last speeches, but the sound wasn't the same anymore, there is a background noise(parasite) which is disturbing, i removed it with Audacity, but despite this, the voice isn't the same ...
You can see here the difference between the soundtrack of the same speech before and after the occurrence of the problem.
The codec used by the stereo mix peripheral is "IDT High Definition Codec".
Thank you.
Perhaps some cable or plug got loose? Do check for this!
If you are using really cheap gear (built-in soundcard and the likes) it might very well also be a problem of electrical interference, anything from ...
Switching on some device emitting a electro magnetic field (e.g. another monitor close by)
Repositioning electrical devices on your desk
Changes in CPU load on your computer (yes i'm serious!)
... could very well cause some kinds of noises with low-fi sound hardware.
Generally, if you need help on audio sounding wrong make sure that you provide a way to LISTEN to the files, not just a visual representation.
Also in your posted waveform graphics i can see that the latter signal is more compressed, which may point to some kind of automated levelling going on somewhere in the audio chain.

Arduino Piezo Knock Sensor Play Tones

I would like to hook up several piezos to an arduino so that, when they are activated each piezo plays/triggers a separate tone. For instance, I'll have five piezos connected to the arduino - when I apply pressure to each one they play a separate note, either through a software interface on a computer or from the piezos themselves. Basically an Arduino synth using piezos as keys.
I'm just not quite sure how to go about doing this. I'm sure its possible but just need a push in the right direction. Any ideas? Thanks!
The practical difficulty of using one device as both an input sensor and output device, is that once activated to output (a sound) you would have to disable using it as input for some fixed time. Something more responsive would be to use separate sensors for the keys, and just one speaker for all sounds. The good folks who came up the Arduino tutorials have a 3 key sensor player example here:
http://arduino.cc/en/Tutorial/Tone3
and another example of using a piezo as a sound sensor here:
http://www.arduino.cc/en/Tutorial/KnockSensor
I can Help you with the Software interface , You can use your smart phone to play sounds for each Piezo Sensor.
See this app : https://play.google.com/store/apps/details?id=ram.mere.DoDuino
You can connect arduino using Serial ( Android 3.1 and higher ) or Bluetooth to this app.
And to use the Sound Action follow this tutorial :
https://www.youtube.com/watch?v=RQhx6qBElVk
. So you specify what sound to be played on your android phone , and when you detect which piezo you send data to the android and then the Sound Specified will be played .
So for example if android App Received : #p1; then it will played the sound related to Piezo one
and when you send #s1; then it will stop playing that sound ..etc.
Hope this help someone :D .

Resources