Author Topic: Raspberry Pi  (Read 9865 times)

Ruptor

Raspberry Pi
« on: February 03, 2017, 10:22:10 AM »
Is anybody using a Raspberry Pi as a Stomp box? It is very fast at 800 or 1000 MHz with lots of peripherals and memory built in to the chip and there are different versions available. I was thinking that the normal RPi could be used to develop the code and then a Pi Zero that only costs a couple of Pounds could be used in the final box.

Digital Larry

Re: Raspberry Pi
« Reply #1 on: February 03, 2017, 10:37:09 AM »
Having devoted a few years to learning the Spin FV-1 I'm a bit more oriented towards that but I am also a Pi enthusiast.  While not geared towards stomp boxes, you might be interested in this online course.  I'm taking it and you could probably sign up as it just got started.  Uses Java.

https://www.kadenze.com/courses/creative-audio-programming-on-the-raspberry-pi/info
Digital Larry
DSP tinkerer and former transistor twister

Firesledge

Re: Raspberry Pi
« Reply #2 on: February 03, 2017, 12:30:14 PM »
The main drawback of the Pi is the lack of integrated codec, but it’s a good platform. I use a Pi 3 for my current project.
Pédale Vite, multi-FX pedalboard

Ruptor

Re: Raspberry Pi
« Reply #3 on: February 03, 2017, 01:20:14 PM »
Why is a codec required? I was just thinking the RPi could easily shape a wave or act like a filter and clipper in software that would always give the same results instead of the analogue stuff that is based on variable component characteristics in the old circuit designs. All the manufacturers have gone digital for the reliability, repeatability, simple hardware and versatility for upgrades. I asked the question because I search the forum for Raspberry Pi and it gave no hits.
I am assuming real time software not involving an operating system on the RPi.
« Last Edit: February 03, 2017, 01:22:50 PM by Ruptor »

Firesledge

Re: Raspberry Pi
« Reply #4 on: February 04, 2017, 04:14:59 AM »
I meant that you probably need an ADC and a DAC to interface with the analogue audio world, unless you want to build a stompbox chain with digital connections only.
Pédale Vite, multi-FX pedalboard

Ruptor

Re: Raspberry Pi
« Reply #5 on: February 04, 2017, 09:35:29 AM »
Ah! the lack of A/D is probably the reason. As you probably have guessed I haven't used the RPi for audio I/O yet. I remembered seeing an audio interface on the RPi but I have had a more detailed look and it is an audio PCM interface for talking to conversion chips so extra hardware is required to get the analogue data in to digital form. :icon_rolleyes: It would be better to pick a DSP that has onboard A/D to make things simple and cheap. Perhaps the PIC DSP32 is a good option. I can't see any posts about that either.

Blackaddr

Re: Raspberry Pi
« Reply #6 on: February 04, 2017, 12:09:37 PM »
My recommendation would be to get a separate inexpensive ADC/DAC board then use that with the PI to leverage the huge support base from the PI community.

PI3 will be capable of far better audio processing performance versus, say an Arduino.  It's harder to get audio in and out over the GPIO in a Linux OS.  You'll likely need an I2S driver.  Arduino will be easier to get audio in and out due to no OS, but is a much weaker processor.

Using a separate ADC/DAC let's you buy something cheap to get started, and get usable audio quality.  Then later, you can invest in a better ADC/DAC/CODEC or build your own if you want pro level quality. This also gives you the flexiblity to move to another processing platform (like a DSP based one or even FPGA) later on.

Most audio based ADC/DACs use I2S as the serial protocol for transfering audio so it's each to change the codec  or processing platform later. My first audio project used a small FPGA board with a couple very inexpensive boards from Digilent.

Here's what I used.
http://store.digilentinc.com/pmod-ad1-two-12-bit-a-d-inputs/
http://store.digilentinc.com/pmod-i2s-stereo-audio-output/
« Last Edit: February 04, 2017, 12:13:14 PM by Blackaddr »
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

markseel

Re: Raspberry Pi
« Reply #7 on: February 04, 2017, 12:37:26 PM »
It depends on what you mean by 'stomp box'.  A PI isn't meant for high performance audio applications - no audio quality delta-sigma ADC/DAC, Linux doesn't (easily) support low latency audio flow - low latency with respect to guitar effects which is ideally less than 5msec.  Sure it's got MIP's but it's designed to run Linux, Bluetooth and Wireless stacks, perhaps a GUI, etc.  PWM output will have low dynamic range compared to an audio DAC.  PI could make a nice multi-effects controller and interface though.  But if 'stomp box' means bit-crushing, not-so-low latency, reverb/looping, and experimenting then it might be just fine!  Although seems that Teensy would be better for simple effects experimentation.

Ruptor

Re: Raspberry Pi
« Reply #8 on: February 04, 2017, 01:21:22 PM »
The RPi has the I2S interface for its audio input but for a cheap unit it gets expensive. The RPi is not limited to Linux Free Pascal can be embedded or applied to other ARM units and some other processors see here for starters.
http://wiki.freepascal.org/Embedded
I like the PIC idea because I have all the gear to program them, they have on board A/D and are cheaper than just one I2S peripheral. There is a simulator that could be rigged to take in a wave and give the output of your software before programming even programming a chip.
I wonder how good the A/D needs to be for a Stomp Box since we are only going to distort the original signal anyway so would 10 or even 8 bits be good enough?

Blackaddr

Re: Raspberry Pi
« Reply #9 on: February 04, 2017, 02:30:46 PM »
I wonder how good the A/D needs to be for a Stomp Box since we are only going to distort the original signal anyway so would 10 or even 8 bits be good enough?

What you're doing with the signal unfortunately doesn't reduce the needed bits.  Reducing bits results in quantization error, which is often called 'digital distortion' but is nothing like the 'distortion' we are talking about intentionally creating in an analog circuit. Unless you're trying to create a low-fi 'bit crusher' sound you can't use resolutions as low as 10 or 8 bits.

Everyone's ears are different and what sounds like junk to one person may be fine to another.  Here's a rough guide:

24-bits - this is used internally in digital processing to prevent roundoff error (quantization error) from accumulating.  There is really no need for 24-bits in to our out of a stomp box, just for intermediate calculations.
16-bits - this is the standard for a reason.  It guarantees that a perfectly sampled signal at this precision has qu antization error beyond the human ear's capability to perceive.
14-bits - this is the threshold where a good set of trained ears can start hear the quantization error (digital distortion) from a perfectly sampled signal.  Most of us cannot hear this difference.
12 bits - this is where most people listening intently to the right recording can definitely perceive a drop in fidelity in a blind A/B test.  This is still very usable though for experimentation.
10 -bits - this is might still be useful for very basic experimentation but the audio quality would not be good enough for use in a pedal.
8 bits - pretty awful and un-useable at this point.

The 12-bit I linked above ADC above is very 'useable' for audio experimentation purpuoses but you would want to upgrade to a proper 16-bit or better system for something intended to for use playing in a band, or recording music, etc.
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

Ruptor

Re: Raspberry Pi
« Reply #10 on: February 04, 2017, 04:48:49 PM »
OK that blows the PIC out the tail pipe along with any other micro with on board A/D I Guess. It is a shame the add on A/D boards are so expensive compared to the RPi zero for a couple of pounds. :icon_rolleyes: 

Blackaddr

Re: Raspberry Pi
« Reply #11 on: February 04, 2017, 05:01:46 PM »
Yes, Pis are very cheap.  As always, life has tradeoffs.

As I said above, I like to keep the processor separate from the audio codec and use I2S to get audio in and out.

FPGA - ideal for audio applications, top performance, expensive and very difficult to program
DSP processors - ideal for audio applications, moderate performance, moderate price, difficult but not as hard as FPGAs.
multi-core embedded cpus (like Rpi) - very cheap, great processing power, easy to program, but complicated to get audio in and out with low latency.  Usually Linux with RTOS patches required, but you could also skip the OS and go bare-metal if you can handle the low-level I/O yourself to get very low latency.
microcontrollers - like Arduino are easy to program, easy to get audio in and out of, fairly cheap but very very poor processing capability.
« Last Edit: February 04, 2017, 05:05:03 PM by Blackaddr »
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

Ruptor

Re: Raspberry Pi
« Reply #12 on: February 04, 2017, 06:25:39 PM »
I had a look on Ebay and found 16 bit ADC on I2S for under £2. There are 12 bit DACs for the same money but curiously the 16 bit DACs are expensive at £6 but there are 16 dual DAC TDA1543 chips for less than 50p so the RPi zero with these would come it at less than £10 with 16 bit capability so it is viable. :) Going bare metal as they call it these days is the norm for me since I have been designing microprocessor based controllers for medical equipment for years. It looks like I will have to get in to real time embedded Free Pascal Compiler, FPC, which I know nothing about yet but it would be useful for other ARM based projects.

ElectricDruid

Re: Raspberry Pi
« Reply #13 on: February 04, 2017, 07:58:44 PM »
You might think about the Axoloti instead. I don't know exactly how it compares processor-specs-wise with the RPi3, but it's not an underpowered chip by any stretch. The large community around it and the GUI make the way in pretty easy.
I suspect the RPi world is focussed mostly on other stuff, whereas the Axoloti world is focused primarily on sound processing and synthesis.

HTH,
Tom

mhelin

Re: Raspberry Pi
« Reply #14 on: February 05, 2017, 06:24:05 AM »
There are no PI Audio Codec HAT's available with guitar/instrument I/O with 1/4" jacks and proper input impedance and sensitivity for Raspberry Pi. Anyway, RPi is fine as Guitar FX unit but kind of overkill (in processing power and power consumption). You could though use the existing software like ecasound with LADSPA plugins to create a command line environment for processing the sound from the ALSA input to output (https://ecasound.seul.org/ecasound/Documentation/examples.html).

You need though program some kind of UI wrapper like a small Python program with simply Curses or more graphical WXPython or Kivy (https://kivy.org/#home) UI for configuring the ecasound commands and reading controls either pure MIDI or using external potentiometers and switches connected to GPIO, I2C or SPI ports.


Blackaddr

Re: Raspberry Pi
« Reply #15 on: February 05, 2017, 08:02:23 AM »
There are no PI Audio Codec HAT's available with guitar/instrument I/O with 1/4" jacks and proper input impedance and sensitivity for Raspberry Pi

Sounds like a a great opportunity for a little DIY! I'm assuming the OP has some basic soldering skills.

This guy does the hard part for you, soldering down the small surface mount components and letting you interface to it with each 0.1" headers, but it still needs an instrument preamp.  Note that sufrface mount ADC stuff is on the other side.


On a solderless breadboard, add a 1/4" jack and a basic high-impedance preamp with variable gain. This will let you buffer the guitar signal, and set the preamp gain so the ADC sees a good signal without clipping.


Once you've got everything working on the solderless breadboard, you can use a soldered breadboard and PCB mount jacks instead.

This guy gives you a buffered line-out at 1/8".  A 1/8" to 1/4" cable will let you plug it into a line-in source (like your computer's line-in, or the FX Loop return on your guitar amp.

Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

mhelin

Re: Raspberry Pi
« Reply #16 on: February 05, 2017, 08:16:36 AM »
The guy who designed the Digilent I2S pmod has also built a codec version of it:

http://ebrombaugh.studionebula.com/synth/codec_pmod/index.html

Maybe someone should hint Digilent to start building and selling these as well, and replace the 3.5mm connectors with proper 1/4" ones with the hi-z input buffer.

Blackaddr

Re: Raspberry Pi
« Reply #17 on: February 05, 2017, 10:14:42 AM »
Maybe someone should hint Digilent to start building and selling these as well, and replace the 3.5mm connectors with proper 1/4" ones with the hi-z input buffer.

If there is interest in this kind of board, I could easily design a board with that codec and include a high impedance preamp and appropriate circuits to have instrument level in and instrument level out, just like a real pedal.  It would have have proper 1/4" jacks installed.  Probably optionally have MIDI IN / OUT circuits.  What's the fun of a digital pedal if you can't control it with your MIDI Foot Controller?

Could probably get a batch of 10 done in about 8 weeks time frame. Once again, if there is interest.

Anybody have thoughts on that?
Blackaddr Audio
Digital Modelling Enthusiast
www.blackaddr.com

Ruptor

Re: Raspberry Pi
« Reply #18 on: February 05, 2017, 11:06:03 AM »
Been taking another look at the stuff available on Ebay. The best route for me is an STFM32 CPU board for £2 that has two 12 bit ADCs and a TDA1543 on the output for 50p with a couple of resistor and pots on the input and output.  If 12 bit input is not good enough I can get a 16 bit board for another £2 so it would all come in under £5 with incredible versatility to do just about any effect in home made pedal. It suits my pocket and gives me something to play with off the shelf. :) 

mhelin

Re: Raspberry Pi
« Reply #19 on: February 06, 2017, 12:33:19 PM »
« Last Edit: February 06, 2017, 12:43:52 PM by mhelin »