Forums

Is Raspberry PI 2 B suitable for a real-time audio effects application?

Started by Mauritz Jameson January 4, 2016
I am about to start working on a project which involves
real-time audio processing for an audio effects application.
The application is supposed to acquire and process audio from 8 individual audio 
input channels at a sample rate of 48kHz. The audio
processing algorithm generates audio for 8 individual audio output
channels. The audio sample format is 16-bit signed LPCM. Since it's
for a real-time audio effects application, latency is also important.
If audio is looped from input to output without any processing, the
round-trip latency should not exceed 12ms. 

The application should receive 256*8 input samples every 5.33ms (via an audio callback), process those samples and transmit 256*8 output samples (also via callback). The 256*8 samples are received/sent in some kind of "interleaved" format. 

I am currently researching different hardware platforms and I was wondering
if the Raspberry PI 2 B could be a suitable choice. The board itself seems
to have a lot of horse power (900MHz Quad Core ARM CPU), but it only has 
audio input. So my questions are:

1. Is the Raspberry PI 2 B suitable for real-time audio processing?
2. If the answer to [1] is yes, then I would like to know if there are 
any add-on audio boards for the Raspberry PI 2 B on the market with 8 input channels
and 8 output channels? The board must support 48kHz sample rate.
3. If the answer to [1] or [2] is no, which HW platform would you recommend?

The reason why I'm looking at the Raspberry PI 2 B is the attractive price, but there might be other types of boards on the market which are more suitable for this kind of application.


Block Diagram:
http://postimg.org/image/f9hfj6kf5/
Mauritz Jameson  <mjames2393@gmail.com> wrote:

>I am about to start working on a project which involves >real-time audio processing for an audio effects application. >The application is supposed to acquire and process audio from 8 >individual audio >input channels at a sample rate of 48kHz. The audio >processing algorithm generates audio for 8 individual audio output >channels. The audio sample format is 16-bit signed LPCM. Since it's >for a real-time audio effects application, latency is also important. >If audio is looped from input to output without any processing, the >round-trip latency should not exceed 12ms. > >The application should receive 256*8 input samples every 5.33ms (via an >audio callback), process those samples and transmit 256*8 output samples >(also via callback). The 256*8 samples are received/sent in some kind of >"interleaved" format. > >I am currently researching different hardware platforms and I was wondering >if the Raspberry PI 2 B could be a suitable choice. The board itself seems >to have a lot of horse power (900MHz Quad Core ARM CPU), but it only has >audio input. So my questions are: > >1. Is the Raspberry PI 2 B suitable for real-time audio processing? >2. If the answer to [1] is yes, then I would like to know if there are >any add-on audio boards for the Raspberry PI 2 B on the market with 8 >input channels >and 8 output channels? The board must support 48kHz sample rate. >3. If the answer to [1] or [2] is no, which HW platform would you recommend? > >The reason why I'm looking at the Raspberry PI 2 B is the attractive >price, but there might be other types of boards on the market which are >more suitable for this kind of application.
Just to clarify, are you trying to do this running Raspbian, or something else more suitable to real-time operation (DietPI might be a possibility)? Steve
> > Just to clarify, are you trying to do this running Raspbian, or > something else more suitable to real-time operation (DietPI might > be a possibility)? >
I haven't made up my mind about that. I haven't heard about DietPI, so I'll look into that. Have you developed algorithms for real-time data processing for Raspberry PI? I am very interested in hearing about other people's experience with this board (in the context of how well it performs when it comes to processing acquired data in real time).
Mauritz Jameson  <mjames2393@gmail.com> replies to my post,

>> Just to clarify, are you trying to do this running Raspbian, or >> something else more suitable to real-time operation (DietPI might >> be a possibility)?
>I haven't made up my mind about that. I haven't heard about DietPI, so >I'll look into that.
It is said that once DietPI boots up, there are "only 11" processes running.
> Have you developed algorithms for real-time data > processing for Raspberry PI?
I have not. Googling on "RTOS for rapsberry PI" gets lots of hits. For example the following looks useful: http://www.stevebate.net/chibios-rpi/GettingStarted.html Steve
On Monday, January 4, 2016 at 9:25:18 PM UTC-5, Mauritz Jameson wrote:
> I am about to start working on a project which involves > real-time audio processing for an audio effects application. > The application is supposed to acquire and process audio from 8 individual audio > input channels at a sample rate of 48kHz. The audio > processing algorithm generates audio for 8 individual audio output > channels. The audio sample format is 16-bit signed LPCM. Since it's > for a real-time audio effects application, latency is also important. > If audio is looped from input to output without any processing, the > round-trip latency should not exceed 12ms. > > The application should receive 256*8 input samples every 5.33ms (via an audio callback), process those samples and transmit 256*8 output samples (also via callback). The 256*8 samples are received/sent in some kind of "interleaved" format. > > I am currently researching different hardware platforms and I was wondering > if the Raspberry PI 2 B could be a suitable choice. The board itself seems > to have a lot of horse power (900MHz Quad Core ARM CPU), but it only has > audio input. So my questions are: > > 1. Is the Raspberry PI 2 B suitable for real-time audio processing? > 2. If the answer to [1] is yes, then I would like to know if there are > any add-on audio boards for the Raspberry PI 2 B on the market with 8 input channels > and 8 output channels? The board must support 48kHz sample rate. > 3. If the answer to [1] or [2] is no, which HW platform would you recommend? > > The reason why I'm looking at the Raspberry PI 2 B is the attractive price, but there might be other types of boards on the market which are more suitable for this kind of application. > > > Block Diagram: > http://postimg.org/image/f9hfj6kf5/
On the second question the answer is definitely no: there are no add-on boards on the market with 8 ins and 8 outs - you'll have to build your own board The most popular Wolfson audio card for Pi has a combination of stereo inputs With that many ins-outs you are looking at professional (PC or Mac) audio interfaces at $1000 or more On the first question, the answer is *possibly* yes (within limits of computational complexity of your algorithms, of course), but with non real-time kernel the latency is a big unknown (esp in view of the fact that you would have to somehow interface to your own custom-built ADC board) If you can do all of it and measure latency on Pi 2 then please let us know :-)
Mauritz Jameson <mjames2393@gmail.com> writes:

> I am about to start working on a project which involves > real-time audio processing for an audio effects application. > The application is supposed to acquire and process audio from 8 individual audio > input channels at a sample rate of 48kHz. The audio > processing algorithm generates audio for 8 individual audio output > channels. The audio sample format is 16-bit signed LPCM. Since it's > for a real-time audio effects application, latency is also important. > If audio is looped from input to output without any processing, the > round-trip latency should not exceed 12ms. > > The application should receive 256*8 input samples every 5.33ms (via > an audio callback), process those samples and transmit 256*8 output > samples (also via callback). The 256*8 samples are received/sent in > some kind of "interleaved" format. > > I am currently researching different hardware platforms and I was wondering > if the Raspberry PI 2 B could be a suitable choice. The board itself seems > to have a lot of horse power (900MHz Quad Core ARM CPU), but it only has > audio input. So my questions are: > > 1. Is the Raspberry PI 2 B suitable for real-time audio processing?
Of course this depends on WHAT processing you want to do. I haven't crunched any numbers, but it certainly should be able to handle some simple FIR filtering for 8 channels. If you utilize the NEON instructions, you could do more. The operating system overhead and latencies are going to be a big factor, though.
> 2. If the answer to [1] is yes, then I would like to know if there are > any add-on audio boards for the Raspberry PI 2 B on the market with 8 input channels > and 8 output channels? The board must support 48kHz sample rate.
I don't know.
> 3. If the answer to [1] or [2] is no, which HW platform would you recommend? > > The reason why I'm looking at the Raspberry PI 2 B is the attractive > price, but there might be other types of boards on the market which > are more suitable for this kind of application.
As others have intimated, I would stay away from linux for a real-time audio application. A possible alternative is the Beaglebone Black, which is based on the TI AM335x ARM Cortex A8. It's a single core running at 960 MHz with 512MB RAM. The thing that may be most relevent for your application is that TI's SYSBIOS real-time OS is available for that processor: http://www.ti.com/tool/sysbiossdk-ind-sitara -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
angrydude wrote:
> On Monday, January 4, 2016 at 9:25:18 PM UTC-5, Mauritz Jameson > wrote: >> I am about to start working on a project which involves real-time >> audio processing for an audio effects application. The application >> is supposed to acquire and process audio from 8 individual audio >> input channels at a sample rate of 48kHz. The audio processing >> algorithm generates audio for 8 individual audio output channels. >> The audio sample format is 16-bit signed LPCM. Since it's for a >> real-time audio effects application, latency is also important. If >> audio is looped from input to output without any processing, the >> round-trip latency should not exceed 12ms. >> >> The application should receive 256*8 input samples every 5.33ms >> (via an audio callback), process those samples and transmit 256*8 >> output samples (also via callback). The 256*8 samples are >> received/sent in some kind of "interleaved" format. >> >> I am currently researching different hardware platforms and I was >> wondering if the Raspberry PI 2 B could be a suitable choice. The >> board itself seems to have a lot of horse power (900MHz Quad Core >> ARM CPU), but it only has audio input. So my questions are: >> >> 1. Is the Raspberry PI 2 B suitable for real-time audio >> processing? 2. If the answer to [1] is yes, then I would like to >> know if there are any add-on audio boards for the Raspberry PI 2 B >> on the market with 8 input channels and 8 output channels? The >> board must support 48kHz sample rate. 3. If the answer to [1] or >> [2] is no, which HW platform would you recommend? >> >> The reason why I'm looking at the Raspberry PI 2 B is the >> attractive price, but there might be other types of boards on the >> market which are more suitable for this kind of application. >> >> >> Block Diagram: http://postimg.org/image/f9hfj6kf5/ > > On the second question the answer is definitely no: there are no > add-on boards on the market with 8 ins and 8 outs - you'll have to > build your own board > > The most popular Wolfson audio card for Pi has a combination of > stereo inputs > > With that many ins-outs you are looking at professional (PC or Mac) > audio interfaces at $1000 or more >
Half that for 7ish msec latency on a modest dual-core i5: http://us.focusrite.com/usb-audio-interfaces/scarlett-18i20 I doubt you'll use that as-is on a Pi.
> On the first question, the answer is *possibly* yes (within limits of > computational complexity of your algorithms, of course), but with non > real-time kernel the latency is a big unknown (esp in view of the > fact that you would have to somehow interface to your own > custom-built ADC board) > > If you can do all of it and measure latency on Pi 2 then please let > us know :-) >
-- Les Cargill
On Tuesday, January 5, 2016 at 3:25:18 PM UTC+13, Mauritz Jameson wrote:
> I am about to start working on a project which involves > real-time audio processing for an audio effects application. > The application is supposed to acquire and process audio from 8 individual audio > input channels at a sample rate of 48kHz. The audio > processing algorithm generates audio for 8 individual audio output > channels. The audio sample format is 16-bit signed LPCM. Since it's > for a real-time audio effects application, latency is also important. > If audio is looped from input to output without any processing, the > round-trip latency should not exceed 12ms. > > The application should receive 256*8 input samples every 5.33ms (via an audio callback), process those samples and transmit 256*8 output samples (also via callback). The 256*8 samples are received/sent in some kind of "interleaved" format. > > I am currently researching different hardware platforms and I was wondering > if the Raspberry PI 2 B could be a suitable choice. The board itself seems > to have a lot of horse power (900MHz Quad Core ARM CPU), but it only has > audio input. So my questions are: > > 1. Is the Raspberry PI 2 B suitable for real-time audio processing? > 2. If the answer to [1] is yes, then I would like to know if there are > any add-on audio boards for the Raspberry PI 2 B on the market with 8 input channels > and 8 output channels? The board must support 48kHz sample rate. > 3. If the answer to [1] or [2] is no, which HW platform would you recommend? > > The reason why I'm looking at the Raspberry PI 2 B is the attractive price, but there might be other types of boards on the market which are more suitable for this kind of application. > > > Block Diagram: > http://postimg.org/image/f9hfj6kf5/
Forget that and buy an ARM micro (unless yo uwant to use high level libraries that is)
Mauritz Jameson wrote:
> I am about to start working on a project which involves > real-time audio processing for an audio effects application. > The application is supposed to acquire and process audio from 8 individual audio > input channels at a sample rate of 48kHz. The audio > processing algorithm generates audio for 8 individual audio output > channels. The audio sample format is 16-bit signed LPCM. Since it's > for a real-time audio effects application, latency is also important. > If audio is looped from input to output without any processing, the > round-trip latency should not exceed 12ms. > > The application should receive 256*8 input samples every 5.33ms (via an audio callback), process those samples and transmit 256*8 output samples (also via callback). The 256*8 samples are received/sent in some kind of "interleaved" format. > > I am currently researching different hardware platforms and I was wondering > if the Raspberry PI 2 B could be a suitable choice. The board itself seems > to have a lot of horse power (900MHz Quad Core ARM CPU), but it only has > audio input. So my questions are: > > 1. Is the Raspberry PI 2 B suitable for real-time audio processing? > 2. If the answer to [1] is yes, then I would like to know if there are > any add-on audio boards for the Raspberry PI 2 B on the market with 8 input channels > and 8 output channels? The board must support 48kHz sample rate. > 3. If the answer to [1] or [2] is no, which HW platform would you recommend? > > The reason why I'm looking at the Raspberry PI 2 B is the attractive price, but there might be other types of boards on the market which are more suitable for this kind of application. > > > Block Diagram: > http://postimg.org/image/f9hfj6kf5/ >
Here is a video of someone's student project that's similar. It uses a Beaglebone Black. https://www.youtube.com/watch?v=0Ebnue1a4vc -- Les Cargill
On 05/01/16 02:25, Mauritz Jameson wrote:
> I am about to start working on a project which involves > real-time audio processing for an audio effects application.
I strongly suggest you look at the XMOS processors and boards. They have key features that make them /extremely/ well suited to audio processing, especially many cores and zero timing jitter. The compiler state the /exact/ number of cycles each block /will/ take to execute. http://www.xmos.com/ Processors and boards are available from distributors such as Digikey, and are remarkably inexpensive.