Darknand
Posts: 4
Joined: Tue May 05, 2015 5:49 pm

Raspberry Pi as a synth

Tue May 05, 2015 6:11 pm

This has been discussed before, however with the advances made with the RPi 2 I think it's worth bringing up again.

Like some users before me, I've attempted to make the pi into a portable synthesizer. simply logging on into an openbox enviroment(because it's faster than lxde), attaching a midi / audio interface and running jack correctly, got me pretty low latency audio running pretty smoothly. (from 5-10 ms latency)
I've seen quite a few ports of daw's, synth's samplers, etc. In the raspbian repository and the autostatic repository.

see, the problem isn't running the synth's, the problem is when the synth becomes too much for the system.
I mean, sure. you can play soundfonts at full polyphony, which is nice. Seeing as you can create your own instruments and such. but soundfonts simply DON'T sound good enough for the average musician. it's great for education, but simply isn't good enough to perform with.

I think the best linux synth out there is Zynaddsubfx. it's fantastic. when running it on the pi, it does work. I admit. it even works if you load some heavy presets. but once you really start to play complex chords or even a fast solo the audio starts to "crackle" this absolutely puzzles me. I mean, I can run zyn on a Core2Dual machine easily without even connecting an audio adapter besides a built in realtek and it performs great.
Why is it failing on the pi?
When I first attempted it on an RPi 1, the processor shot up to 100% and the audio starting getting cut off. but the pi2 doesn't suffer from low processing power and when I run the synth I can see the processor doesn't break a sweat. So why does the audio get cut when I play complex chords or fast solos? it's worth mentioning that the audio midi interface I was using was an Edirol PCR-1 (which works out of the box with the pi btw)
I've had similar success with other synth's out there. like synthv1 or amsynth. whenever polyphony gets too much or I play too fast the same problem persists.

I've seen other people run their own made synth's on a pi at full speed with great polyphony. but those didn't run on raspbian. they ran on a very minimal operating system. that begs the question, if I start removing unneeded parts out of raspbian will the synth's perform better? Will cutting raspbian down to the bare minimum needed to run jack and the synth's and the window manager will improve the situation?

Overall I've had mixed sucess with the pi as a synthesizer. it has limitations, but I think it could really change the rules of the game for musicians like me.
Besides the questions I asked regarding the reason behind these synth's failing under pressure,
Does anyone have any advice on how to make a pi into a synth? I feel like it's close yet out of reach.

Best regards.

User avatar
liz
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 5212
Joined: Thu Jul 28, 2011 7:22 pm
Contact: Website

Re: Raspberry Pi as a synth

Tue May 05, 2015 6:19 pm

Phil Atkin's work is worth checking out: http://raspberrypisynthesizer.blogspot.co.uk/
Director of Communications, Raspberry Pi

Darknand
Posts: 4
Joined: Tue May 05, 2015 5:49 pm

Re: Raspberry Pi as a synth

Tue May 05, 2015 6:50 pm

liz wrote:Phil Atkin's work is worth checking out: http://raspberrypisynthesizer.blogspot.co.uk/
The guy's definitely brilliant. But it doesn't seem like he's going to share his source code any time soon. is he?
I mean, even if he sells it it'll be an achievement, but it's not quite what I'm talking about. there's a few open source software synthesizers out there who almost work flawlessly on a pi.
So what's stopping us from utilizing their potential? do they need major code alterations to work well on a pi? or maybe their dependencies make it impossible to run them on a stripped down raspbian os?
I'm merely a technician and an amateur python programmer. not nearly smart enough to understand what's stopping us here.

Sleep Mode zZ
Posts: 319
Joined: Sun Aug 19, 2012 5:56 am
Location: Finland

Re: Raspberry Pi as a synth

Tue May 05, 2015 6:56 pm

I have had similar issues with my desktop computer. The crackling probably is just buffer underruns. I suffered sometimes from it when the CPU usage was not even close to 100%.

I can only speculate about possible reasons as I have not played with jack audio on the Pi. Maybe jack or the synths can't make use of all 4 cores and because of that you have buffer underruns with lower CPU usage than you expect? Your Core 2 Duo machine, although many years old, probably has several times better single thread performance. Maybe the programs are better optimized for x86 architecture?

Audio specialized Linux distributions use a low latency or real time kernel. Using those, it is possible to prioritize audio related threads over everything else running on the machine - and as such minimize the risk of buffer underruns.

Avoiding buffer underruns while having low latency seems like black magic to me, so it is better to just point you to http://wiki.linuxaudio.org/wiki/raspberrypi, in case you have not already read it.

Darknand
Posts: 4
Joined: Tue May 05, 2015 5:49 pm

Re: Raspberry Pi as a synth

Tue May 05, 2015 8:12 pm

Sleep Mode zZ wrote:I have had similar issues with my desktop computer. The crackling probably is just buffer underruns. I suffered sometimes from it when the CPU usage was not even close to 100%.

I can only speculate about possible reasons as I have not played with jack audio on the Pi. Maybe jack or the synths can't make use of all 4 cores and because of that you have buffer underruns with lower CPU usage than you expect? Your Core 2 Duo machine, although many years old, probably has several times better single thread performance. Maybe the programs are better optimized for x86 architecture?

Audio specialized Linux distributions use a low latency or real time kernel. Using those, it is possible to prioritize audio related threads over everything else running on the machine - and as such minimize the risk of buffer underruns.

Avoiding buffer underruns while having low latency seems like black magic to me, so it is better to just point you to http://wiki.linuxaudio.org/wiki/raspberrypi, in case you have not already read it.
Thank you for the reply, I have read that article before, but I haven't tried to compile a real time kernel. Can anyone confirm that raspbian doesn't have a real time kernel by default? Also, has anyone tried to compile a real time kernel and have noticed better performance with Jack?
Question is, is it worth it? because it seems like quite a task.

User avatar
Jednorozec
Posts: 809
Joined: Sun Nov 24, 2013 2:17 pm
Location: Deposit, NY

Re: Raspberry Pi as a synth

Tue May 05, 2015 8:33 pm

I've gotten ChucK running on a Pi2B http://chuck.cs.princeton.edu/
The most important leg of a three legged stool is the one that's missing.
It's called thinking. Why don't you try it sometime?

Sleep Mode zZ
Posts: 319
Joined: Sun Aug 19, 2012 5:56 am
Location: Finland

Re: Raspberry Pi as a synth

Tue May 05, 2015 8:35 pm

I checked with the uname command on my x86 desktop:

Code: Select all

A-System:~$ uname -r
3.19.0-15-lowlatency
That "lowlatency" part indicates that it is a special kernel. If it would be a real-time kernel, it would be stated similarly in its name.

My Pi answers to the same command: 3.18.7v7+. I gather from that it is not a special version because it is not stated in its name. "cat /proc/version" is another command to check what kernel is in use.

I don't know if real-time kernel is worth the effort - I hope that somebody with some real experience chimes in on that.

gkreidl
Posts: 6325
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Raspberry Pi as a synth

Tue May 05, 2015 9:55 pm

Connect with a terminal (SSH or on the RPi itself) and run "top" while the synths are running. Press "1" on the keyboard to view all 4 cores. Is only one core running high? Then the synth software is not using all 4 cores.

Recompiling the synth software with ARMv7 NEON instruction set might also improve things.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: Raspberry Pi as a synth

Mon Oct 05, 2015 9:04 pm

For anyone who is following this thread or accidentally stumbled upon it: http://autostatic.com/tag/synth-module/
I'm currently trying to put together a synth module based on ZynAddSubFX.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

ItsInterior
Posts: 1
Joined: Wed Aug 19, 2015 9:36 am
Contact: Website

Re: Raspberry Pi as a synth

Tue Oct 06, 2015 10:03 am

You’re not taking this far enough.

Go buy random switches, pots, rotary encoders, etc… Wire them up to the Pi, and write a driver to interact with Piana. Boom, instant hardware synth.
Thanks , :(
http://www.thecheesyanimation.com/Interior-Design-&-Rendering.html

Return to “General discussion”