Beginner starting on Audio project

General programming chat and advice for beginners

10 posts
by Fruitsamurai88 » Mon Jan 21, 2013 1:11 pm
Hi everyone. I am thinking of using Raspberry Pi to process Audio input and then output them in real time. However, I am a beginner with computing and thus have some basic questions that I would like some clarification.

Firstly, I understand not all processors are suitable for digital signal processing, Is the ARMv6 on Rpi suitable for my purpose?

Secondly, do I need to program in assembly language? I would prefer C++.

Thirdly, I am thinking of using C++ to program Raspberry Pi. So I will need to find a DSP library for my project right? Any recommendation on that?

Lastly, I read online that people want to use the SoC DSP for audio processing. Can this be achieved through C++? Or it need to be done through assembly language?

Thanks in advance!
Posts: 3
Joined: Sun Jan 20, 2013 1:08 pm
by zawilliams » Thu Jan 24, 2013 3:01 am
I'm looking into using Raspberry Pi for an audio project as well. It would involve mixing audio signals (4 to 8 mono inputs) and outputting a stereo signal.

Anyone have any input/thoughts on this?
Posts: 1
Joined: Thu Jan 24, 2013 2:58 am
by ghans » Thu Jan 24, 2013 10:22 am
He might have some insights on Audio APIs
and performance tweaking on the Pi :

http://raspberrypisynthesizer.blogspot.de/

I don't know how much this info is useful to accomplish your
goal though.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Posts: 3900
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany
by goodwinmw » Fri Jan 25, 2013 3:35 pm
Hi,

The ARM1176JZFS on the Raspberry Pi does have DSP instructions.

The ARM CMSIS MCU Software Standard includes an optimized DSP source code library (and examples) that uses native ARM DSP instructions.

The ARM CMSIS MCU Software Standard is available here:
https://silver.arm.com/browse/CMSIS

Once you register (free) on the ARM site you can download it by going to:

Support -> Resources -> Downloads and select the:
ARM and AMBA Architecture
CMSIS MCU Software Standard

On the right will be a download link.
Posts: 1
Joined: Fri Jan 25, 2013 3:07 pm
by stupid_boy » Sun Jan 27, 2013 8:48 am
About assembly language, it is not necessary, well, except for some concrete DSP instructions or some dirty hacks, if you have enough knowledge to do them. Clear understanding of assembly language is really helpful when you need to debug your code at low level, and by knowing/understanding it you probably will be able to write more efficient C/C++ code. For some crazy optimizations you will end up looking at generated assembly and thinking how to change your C/C++ code to provoke compiler to generate better code, but it is extremely rare and unlikely.

Modern C/C++ compilers do really good work, producing better binary code in most cases, than someone will write in assembly. C/C++ is easy to read and maintain in times, compared to assembly.

I have one great example for capabilities of C compiler. Before a time i play just for fun with my C code ( for TI MSP430 processor ), which was really crazy optimized to levels, not easy accessible from everyone from assembler. In it i do not leave room for any further compiler optimizations. Not directly related to your question, but related to C/C++ vs assembler power in it. By using C, i do this in couple of hours. If i used assembler, it will take weeks and the result is not clear. I understand assembler and I am capable of writing on it, but I am not so productive on it. In this project I used generated assembly as helper to understand and identify weak points of TI C compiler and to push it to its limits. You can see it here: http://www.youtube.com/watch?v=reWGWWCPbEo

For DSP instructions, usually there are already ready libraries. Usually they are already optimized, so your only work is to get them and use them. Bets and hopes are that they are better optimized than your own code. If you have enough time and wish to identify some weak points in them, usually you can contact their authors and contribute for improvements, or always you can produce better ones and hopefully publish them.
Posts: 64
Joined: Tue Jan 01, 2013 7:53 pm
by Fruitsamurai88 » Wed Jan 30, 2013 1:37 pm
Thanks for the advices. They are really informative. I am currently waiting for the board (a model B) to arrive. Meanwhile I will try working with an emulator.
Posts: 3
Joined: Sun Jan 20, 2013 1:08 pm
by CreedBratton » Mon Feb 04, 2013 6:46 pm
Hello,
I am looking to do a similar project. I am looking to some simple real time audio processing.
I want to access the data from the USB sound card - line in and sample it do some simple processing

I want to program in C . Therefore do i have to learn to how to process the data from the USB ?
Are there libraries that I can use ? Also once processed i want to send it to the on board line out or on the usb

How do access the on board line out. How is it connected to the processor ? Is there are a serial port connection ? Any help or hints would be greatly appreciated
Posts: 2
Joined: Mon Feb 04, 2013 5:55 am
by ghans » Mon Feb 04, 2013 6:56 pm
I think you should look into ALSA and OpenMAX.


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Posts: 3900
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany
by Fruitsamurai88 » Thu Feb 21, 2013 2:52 am
Hi All. I am now trying to run the processing ( http://processing.org/ ) on Raspberry Pi but I encountered some issues. Firstly, while running processing, the Raspberry Pi slows down a lot, is it because processing is too computational intensive on Pi? Will increasing the memory split for GPU helps?

Secondly, after running a program using processing, the volume of Alsamixer will strangely turn down to a small volume. This puzzles me.

Can anyone advise? Thank you.
Posts: 3
Joined: Sun Jan 20, 2013 1:08 pm
by gringow » Wed Jun 26, 2013 9:15 pm
Hi, have you used ARM CMSIS MCU Software Standard with the Raspberry? If so could you please tell me what do I have to do to use it. In the CMSIS documentation it is stated that the DSP libraries are only for Cortex-M0, Cortex-M3, and Cortex-M4 cores and the Raspberry has an ARM11 core, does this mean it can't be used on the Raspi?

Thank you
Posts: 5
Joined: Wed Jun 26, 2013 9:09 pm