I'm working on an embedded client for the Free Radio Network based on the Arduino platform and a W5100 ethernet-shield.
FRN uses GSM 06.10 to encode the audio that is being transferred between the clients.
More information on the FRN protocol can be found on this webpage.
I'm looking for a solution to playback the encoded data stream the Arduino receives (analog audio output) and to encode audio from an analog audio input.
I've asked this question on some other (Dutch) communities, but haven't received any concrete solutions.
Some told me I could use a DSP (but I don't know how and which one) and others told me the algorithm is pretty lightweight and could possibly be implemented on a simple microprocessor.
Since I don't have any experience with audio and the Arduino (or the theory of audio codecs in general), I was wondering if anyone has some suggestions on where to start looking / approaching this problem.
Note that the solution does not have to run on the Arduino it self.
Actually, I would prefer a solution with a separate IC (whether that's a DSP, a "simple" micro controller like an ATmega or something completely different).
I gave it a bit more thought and searched a bit further, but unfortunately with no real results so far.
However, the libgsm code is freely available and that it's written in C++.
I reckon that it should be possible to port the necessary parts to the Arduino platform, but I'm not yet sure how this would be done.
So that's what I'm looking into now.
So, I tried "porting" libgsm to the Arduino platform, simply by copying the necessary code into an Arduino library and adjusting the code when errors came up.
Unfortunately this does not seem to work (I didn't really think it would be that simple, but hey, it was worth a shot),
Whatever WAV49 frame I pass to the decode method, I keep getting the same bytes out of it.
My guess is that I'm hitting some limitation of the AVR somewhere (maximum integer value or something like that).
Anyway, this brings me back to square one.
Hopefully some new users read this thread and someone is willing to contribute some ideas to solve this problem.
It should not be straightforward to port the gsm code directly to AVR processor. AVR 8 bit processor may not be fast enough to do the speech decoding in real time. The linear predictive filter used in GSM codec is the main computation bottleneck. The order 10 lattice synthesis filter requires at least 20 multiplication per sample of speech generated, if you count 8000 sample per second, you will know the difficulty. Mind you that also you must not use floating computation, even though fixed-point arithmetic must be limited to 16x16 bit multiplication or even 16x8 bit multiplication.
I have successfully ported a 4.8kps CELP speech decoder on arduino meag2560 by using very carefully optimized C coding of the LP synthesis filter, and it works by using about 80% processing power of a 16Mhz Mega2560. Still, the output precision is only 8 bit per sample, it's fine because, I use 8 bit PWM as DA converter. The quality of speech sound generated is not perfect but good enough for my speech announcement project purpose.
If you insist on porting the GSM decoder on AVR processor (encoder is definitely not possible), you really need to rewrite the C source code using fixed-arithmetic, it is no easy job particularly if you do not have fixed-point signal processing experience.
What i want to do is connect a IR sensor to a speaker with a 3.5mm jack so that when a music device is connected the song playing will get quieter/louder depending on the position of the users hand.