[sdiy] Raspberry Pi 2 Synthesizer Project
Eric Brombaugh
ebrombaugh1 at cox.net
Sun Feb 7 15:47:01 CET 2016
On Feb 7, 2016, at 6:49 AM, Scott Gravenhorst wrote:
> Richie Burnett <rburnett at richieburnett.co.uk> wrote:
> >Sounds good. What did you write the code in? Assembly, C, python?
>
> The code is written entirely in C. It's pretty much raw unoptimized code, so performance could increase with more attention to that. Once I learn ARM assembly language (a bit more complex than PIC/dsPIC) I may include some of that for tightness. The synth currently has no GUI, so it can run headless if needed. I'm thinking about adding another different synth to make it bi-timbral, and eventually I'll add effects.
I'd be interested to find out if you have any success with optimizing via hand-written assembly language. Like you, I started my DSP work in dsPIC assembly and felt pretty competent at wringing the most from that architecture. Lately though I've been doing a fair amount of ARM-based synth coding using GCC and have made several stabs at assembly without being able to improve on the performance of optimized C. Digging into the disassembled C code it becomes obvious that the compiler is doing a fair amount of loop unrolling and interleaving to make maximum use of pipeline latencies. Keeping track of pipeline requirements while hand-coding assembly seems like it would be pretty difficult, especially given that the exact nature of the pipeline changes from one ARM architecture to another, and I find myself using a variety of CPUs in different projects.
In the end I've concluded that for the sake of productivity it's better to write my C code carefully and try a couple optimization settings in the compiler, using the one that performs best (the results seem to vary from project to project and between compiler versions) rather than worry too much about the minutiae of the assembly. I suspect that even it I were able to improve on the compiler's results the gains would be fairly minor.
Eric
More information about the Synth-diy
mailing list