Go Down

Topic: New Library: RF24Audio - Realtime Audio Streaming, Multicasting and More (Read 68349 times) previous topic - next topic


Which is the one last question?

Ok, the last questions :(
If you could answer them i would be grateful.
Thanks for your time


Well the answer is yes and no because again, it depends on what exactly you are doing.

I use two separate ISRs along with 'nested interrupts' to due to timing issues.

The TX_0 sketch found here https://github.com/TMRh20/Sketches may be easier to look at than the library code, and shows how this is done. This is the sketch I used to develop the libary initially.

All my library documentation can be found here: http://tmrh20.github.io/
My blog is here: http://TMRh20.blogspot.com
The datasheet is here: http://www.atmel.com/dyn/resources/prod_documents/doc8161.pdf
Arduino Reference: http://arduino.cc/en/Reference/HomePage

All the information you need is there. Not trying to be rude, but you really need to understand what is going on if you ever hope to write this type of code yourself, and the only way to do that is to put in the effort, and read the documentation and examples provided.


Ok thank you, i'll do my best to understand and do it by myself.
Have a great day and thanks for your time once again.

Best of luck with your projects



I'd like to know if it is possible to send information during the audio streaming. For example, pressing a button on the transmitter card that turns on an LED on the receiver board.

Thanks for this project and for the help.


Well, not really. It may be possible to do so, but would probably be a bit difficult at high bitrates.


Hi all

i am strugling with this project. At beggining i have a problem with imput signal. I used mp3 player and i wasnt able to recognized music on output :-) I used new circuit of preamplifier (attached) and now its better but not so good as i want to.  :|

Q: i read at  http://wiki.openmusiclabs.com/wiki/PWMDAC following :

Dual PWMs just mix an upper and lower value together, to make one analog value. This mixing occurs through 2 resistors, one of which is 2^n times the other, where n is the bit depth. For 2 - 8 bit PWMs (16b), use 1:256, or 3.9k and 1M (as shown below). For 2 - 7 bit PWMs (14b), use 1:128, or 3.9k and 499k, etc. The 3.9k is used so that the output resistance of the microcontroller is much less than the total resistance, reducing errors. And be sure to use 1% resistors for 14b and higher PWMs.

i am only beginner in this area, so I would like to ask you how many bits of PWM is used in this solution to adjust output resistors ?




This lib and the TMRpcm library handle PWM a bit differently than the PWMDAC example. If using dual outputs in standard modes, it is a simple push-pull configuration, so you don't want to mix the signal, but just feed it into a speaker or appropriate amplifier. Technically the bit-depth is adjusted with the digital volume, and a full sample is output to each output pin.  It's probably a good idea to make sure the digital volume is high enough too, using  the rfAudio.volume or rfAudio.setVolume functions.


thnx TMRh20

I only will use headphones, so I will try to adjust mentioned values (rfAudio.volume or rfAudio.setVolume).
:D, but i am not sure where in code to adjust it and what values to use :(  ? I use code [Minimal.ino] .How are these values related to settings via buttons (volume up/down ).
All the time i can hear a high level of noise and interference in output.

and additional question, i was curios and wanted to have better quality and set
#define SAMPLE_RATE 44000                    
#define RF_SPEED RF24_2MBPS  
but output sound was worst than with default setting  24k/1MBPS. why ?


See the documentation ( http://tmrh20.github.io/RF24Audio/classRF24Audio.html ) and examples for info about volume control. For external volume control, just connect button(s) as per the documentation.

The library works best currently at about 16-24khz sample rate due to how it works. The TX_0 development sketch (https://github.com/TMRh20/Sketches) supports faster rates, but is more complicated to use.


hello TMRh20

i spent all day with my small project. :-(  as source i used microphone /Breakout Board for Electret Microphone (Sparkfun BOB-09964) /. I made a small step but, i can here my voice (i can say clearly) in headphones BUT there is additional TERRIBLE interference with something. I attached some record from it and some freq. analyse.

Do u have a clue what is it ?



I'm not sure, the audio sample you provide is only 1K, so not really listenable, but woudl assume it has to do with your audio levels etc. It can be a bit tricky to find the best combination of pre-amplification and volume of the initial audio signal, but it can have a bit impact on sound quality.


Hi TMRh20

today, I used a new preamplifier with LM 386, its better  / XD / now but i think for music I would need sample rate more than 24 kHz. I tried to increase sample rate and adjust volume parameters (i spent all day with it :-( ), but it didnt help to improve it.

I would like to use this audio modul http://www.pjrc.com/store/teensy3_audio.html with Teensy 3.1.
Do you think that your libraries are re-usable for this solution and nRF24L01 ?




Hmm, well below I linked some examples of what it sounds like for me.

Unfortunately there is only support for AVR boards regarding the audio library. This is something I would definitely like to update, since the RF24 modules can support some very fast transfer rates, and higher quality audio with ARM-based boards, like Arduino Due and Teensy.

The library is more geared towards providing a simple interface so beginner to intermediate users can create more advanced things without much money or hardware, but I may add some options for advanced users to get higher quality audio sometime...

Right now the library quality is only good for voice or low-quality sound effects:

Audio Quality Comparisons:
Library: https://www.youtube.com/watch?v=eTFsQIXMXA0
Development Sketch: https://www.youtube.com/watch?v=2ZK6dcBTeT0


ok, that u for info.

I have ordered Teensy and audio modul so i will see.

good luck in your project.

Go Up