How to play MIDI input in Linux - linux

I am sending serial data to my raspberry pi from my arduino then converting the serial data to MIDI using this program: link. Is there any program out there that will take the midi input from the converter program and send it out the pi's audio jack in real time?

I've been using fluidsynth as a softsynth. I haven't run any on the pi, though. There's also a lot of others like amsynth, hexter, xsynth-dssi etc and some of them might be more suitable than others.
You might try running apt-cache search with some suitable keywords and look for programs available on the pi.

TiMidity++ is a software MIDI sequencer and synthesizer that supports multiple audio and patch formats.

Related

Capture audio output from raspberry pi (for LEDs)

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!

How to measure smartphone audio quality?

I'm regularly testing smartphones for my blog and I'd like to measure their audio quality (file playback but also call quality).
I thought of connecting the jack port from the smartphone to the line-in input of my soundcard and play some sounds to measure the quality through a software.
I'd like to measure sound quality based on THD, SNR, Crosstalk, ...
Is there a software I could use to do this? Would you recommend another method to achieve the same?
Thanks
Laurent
I found found something that might do the trick. It's a program called RightMark Audio Analyzer, it can use a test signal on external devices to be re-analyzed through line-in.

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.

How to change sound using distance sensor

I'm trying a project to simulate a brass trombone. The materials I'm using are a Seeed Studio Ultrasonic distance sensor, Raspberry Pi, and an Arduino. I'm going to connect the sensor to the Arduino, and the Arduino to the Raspberry Pi.
I'm looking to have the Raspberry Pi play one steady sound out of the audio jack. As the distance between my hand and the sensor get larger, the pitch of the emitted sound should get lower.
I'm not too familiar with using audio in programming, or too much of programming for that fact. Could someone help me write up some code (preferably in java or C#)? I'm very anxious to do this as I play trombone in school. Any help or suggestions are appreciated.
As not to recreate the brass trombone from scratch, use a Midi Synth on the Pi, such as TiMidity (apt-get install timidity) or alike. With this you can bridge between the Arduino's output and the note(s) sent to TiMidity to play out the Pi's speaker.

Driving the sound card in Linux

On a basic embedded systems speaker with a single line of output, wiggling the output as 0 or 1 in a for given periods produces sound.
I'd like to do something similar on a modern Linux desktop. A brief look-see of Portaudio, OpenAL, and ALSA suggests to me that most people do things at a considerable higher level. That's ok, but not what I'm looking for.
(I've never worked with sounds on Linux before, so if a tutorial exists, I'd love to see it).
Actually, it... kinda is. While you can generate the waveform yourself, you still need to use an API to queue it and send it to the audio hardware; there no longer even exists a sane way to twiddle the audio line directly. Plus you get cross-platform compatibility for free.
[...] embedded systems speaker with a single line of output, wiggling the output as 0 or 1 in a for given periods produces sound.
Sounds a lot like the old PC speaker. You might still find code for it in the Linux kernel.
I'd like to do something similar on a modern Linux desktop.
Then you need AFAIK a driver for ALSA. There you can find infos on how to write an ALSA driver. Use PWM to produce the sound.
Since there are many different sound cards and audio interfaces produced by different companies, there is no uniform way to have a low level access to them. With most sound I/O APIs what you need to do is to generate the PCM data and send that to the driver. That's pretty much the lowest level you can go.
But PCM data is very similar to the 0-1 approach you describe. It's just that you have the in-between options too. 0-1 is 1-bit audio. 8-, 16-, 24-bit audio is what you'll find on a modern sound card. There are also 32- and 64-bit float formats. But they're still similar.

Resources