midix Posted August 21, 2018 Posted August 21, 2018 (edited) I've been considering some options for experiments with electronic wind instruments and synthesizers, such as ZynAddSubFx, Fluidsynth. I've seen project Zynthian and they are running it on a Raspberry Pi 3, so that should be a safe choice, right? Although I'm not sure if they are using some mainstream Debian or something heavily adjusted. Also, for a wind instrument I hoped to find something smaller so I can even build it into the instrument itself; although I don't have my hopes high on that - I'm not sure if I'll find an SBC with enough power. I happen to be one of lucky (or not) backers of NextThingCo C.H.I.P. (now mostly out-of-business company) and I have two CHIPs. So, I just tried one with ZynAddSubFx. Well, it jitters like hell, even with 20ms latency, while some RPi3 user claimed to have achieved around 5ms latency with the same setup (compiled from source, using ALSA and not jack). So, clearly CHIP with its R8 (essentially AllWinner A13) is not enough for playing ZynAddSubFx in real time. It seems, for most of Linux audio synths single core performance matters most because I'm not sure if they are optimized to leverage ARM benefits (at least not yet, but maybe they will in the future). Also, 32/64 bits might be not important at all. BUT - in some benchmarks I've seen that Cortex-A53 running at the same clockspeed as A7 shows almost ~30% better performance even for 32 bit programs? So, it might be worth choosing H5 over H3 in any case? Memory usage - not so important; I don't want to load entire soundbank of samples into RAM. So, 512MB might suffice, although 1GB seems more future-proof. Not sure yet. And, of course, I don't care about video decoding (unless it's possible for some software synth to use video chip as an additional CPU, but it seems highly unlikely) and network performance Looking through these forums, I found one person claimed to be using ZynAddSubFx on a Orange Pi (presumably H3?) and being satisfied with the results. Does this mean that 4 x Cortex-A7 CPU-cores of H3 work better than 1 x Cortex-A8 CPU-core of R8? Yes, there are 4 cores, but is the OS distributing the load evenly across all of them thus making sound synthesis more efficient? Does leveraging of multiple cores depend more on the OS (Armbian specifically) or on ZynAddSubFx ? Again not sure. I only know that for now I should stay away from H6 because it's not yet completely supported and I'm not sure if it would give any benefits for my case, unless it could provide more horsepower for the synths even at this early stages of Linux support? I don't need super high audio quality, but seeing that those smaller boards don't have audio out, it seems I'll need an I2S output and an addon board anyway (and Orange Pi sells even sets of SBC + I2S board, so that might be a nice option). Unfortunately, analog IO pins are a rarity and I'll have to add an Arduino anyway to deal with all the sensors (touch buttons and breath sensor), but then having reliable SPI or I2C is mandatory for me! This might exclude many options. Which boards have reliable SPI or I2C support in Armbian? So, CPU wise, my choices (besides obvious RPi3B+) seem to be H2+/H3 (seems to be the same thing) or H5 (if there is any reason to go for 64 bit in my specific case) or RK3328. And finally the price. The cheapest Rpi 3 B+ I can get is 45 USD (with shipping). In comparison, ROCK64 with 1GB RAM is 36 USD (with shipping). But they are too large to consider building into an EWI, so I would have to run wires (which I might have to do anyway, if my idea to build everything into the EWI itself fails for some reason). Only Orange Pi offers small form factor in their Zero models (H2+, H3, H5 based). What do you think? Is it worth trying to find a small factor SBC for ZynAddSubFx among those Orange Pis or should I go for ROCK64? Edited August 21, 2018 by midix
TonyMac32 Posted August 22, 2018 Posted August 22, 2018 6 hours ago, midix said: Memory usage - not so important; I don't want to load entire soundbank of samples into RAM. So, 512MB might suffice, although 1GB seems more future-proof. Not sure yet. Small physical size + huge memory are not compatible. 512 will probably be tops for a tiny device. For size I would look at the nanopi duo. It has audio out as well as 2 USB's on pin headers. And it's an Allwinner H2+ (quad core a7), should be able to handle some processing. Pair it with https://www.adafruit.com/product/2377 by wiring it directly to a UART on the Duo to minimize size, and keeping it to something you'd be comfortable with. Unless: https://make.kosakalab.com/arduino/obaka/project-2/index_en.html If you are adventurous you can also run a http://www.cypress.com/documentation/development-kitsboards/cy8ckit-043-psoc-4-m-series-prototyping-kit I use the older one of these and the PSoC 5lp for work all the time, the software works quite well and the configurations are straight forward. I'd have made a hat with one by now if cypress had a linux development suite. ADC's make the Arduino look like trash. @Larry Bank Any thoughts?
tkaiser Posted August 22, 2018 Posted August 22, 2018 8 hours ago, midix said: Only Orange Pi offers small form factor Nope. FriendlyELEC kinda defined a slightly larger form factor. Currently available with H5 and soon with RK3399: Wrt audio processing have you read @Da Alchemist's posts?
midix Posted August 22, 2018 Author Posted August 22, 2018 Thanks a lot, I somehow missed NanoPi series entirely, shame on me. Those boards seem to be much better documented than Orange Pi products. I see NanoPis being sold also from Chinese companies RealQVol, Million Sunshine Technology and others, and not quite sure if they are just distributors or clones. I'm in Europe, so buying directly from FriendlyElec would ship from China, anyway; but other Aliexpress vendors offer better shipping rates (free), and also I can buy other interesting items from them, which are not available on FriendlyElec store. I just don't want to get caught by some low quality NanoPi "copycat" (in which case the quality and software and GPIO compatibility might be unknown). Yes, the topic where I found ZynAddSubFx mentioned had lots of useful info from @Da Alchemist
tkaiser Posted August 22, 2018 Posted August 22, 2018 1 hour ago, midix said: I'm in Europe So either buy directly from FriendlyELEC (asking for a quote via email if you're not happy with standard shipping costs) or check whether there's an ALLNET reseller near to you (ALLNET is FriendlyELEC's European distributor and at least here in Germany a lot of their products are available through normal retail channels. Of course twice as expensive compared to FE webshop prices)
Larry Bank Posted August 22, 2018 Posted August 22, 2018 8 hours ago, TonyMac32 said: Small physical size + huge memory are not compatible. 512 will probably be tops for a tiny device. For size I would look at the nanopi duo. It has audio out as well as 2 USB's on pin headers. And it's an Allwinner H2+ (quad core a7), should be able to handle some processing. Pair it with https://www.adafruit.com/product/2377 by wiring it directly to a UART on the Duo to minimize size, and keeping it to something you'd be comfortable with. Unless: https://make.kosakalab.com/arduino/obaka/project-2/index_en.html If you are adventurous you can also run a http://www.cypress.com/documentation/development-kitsboards/cy8ckit-043-psoc-4-m-series-prototyping-kit I use the older one of these and the PSoC 5lp for work all the time, the software works quite well and the configurations are straight forward. I'd have made a hat with one by now if cypress had a linux development suite. ADC's make the Arduino look like trash. @Larry Bank Any thoughts? I agree with @TonyMac32. The NanoPi or Orange Pi boards are plenty of CPU power and memory to do what you need. Audio processing normally doesn't require much RAM nor CPU (relative to an ARM board). It's too challenging a task for an AVR or ESP32 although a Cortex-M may be able to do it. There is more audio latency on Linux than a purely embedded solution and it's worse on ARM than on x86 boards. Using the SDL audio system, you'll probably see 100-250ms of latency when generating real time audio and pushing it out of the HDMI or analog out. It's really hard to avoid on Linux. I'm not sure about the jitter. If you don't starve the CPU with your other tasks, the audio driver should be able to reliably output the samples. If you don't need analog inputs, then you can probably avoid adding an Arduino AVR to the project. Touch buttons and a breath sensor can be implemented as digital devices, not analog.
midix Posted August 22, 2018 Author Posted August 22, 2018 I live in a small Eastern European country and shipping from China still is almost always cheaper than from Germany or UK (and local stores are out of question when trying to find anything more exotic that RPi). I guess that's why FriendlyElec website also warns that EU orders are being shipped from China. Still curious about those AliExpress options, but I guess I'll better stay clear and order directly from FriendlyElec unless someone can confirm that there are trustworthy AliExpress stores that sell real NanoPis and not low quality clones (of course, SoC and layout being the same but peripherals might differ). Yep, I definitely can find a pressure sensor with SPI or I2C interface (built-in or a small board with analog pressure sensor). For my current ZynAddSubFx experiments I was using this tutorial: https://lucidbeaming.com/blog/setting-up-a-raspberry-pi-3-to-run-zynaddsubfx-in-a-headless-configuration/ slightly adjusting it to match CHIP and without the web part, just ZynAddSubFx without GUI. The author of the tutorial says that he could achieve under 10ms latency on RPi3: https://linuxmusicians.com/viewtopic.php?p=83076&sid=45be693c0e9857cffc43cb95cbaae206#p83076 No wonder - RPi 3 is much more powerful than my CHIP with its R8. But this makes me wonder if H2 / H3 also might be too weak for the purpose or if I'm doing something terribly wrong. Just for a very rough idea of CHIPs performance I added 7zip benchmark: Spoiler 7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=C,Utf16=off,HugeFiles=on,1 CPU) RAM size: 490 MB, # CPU hardware threads: 1 RAM usage: 419 MB, # Benchmark threads: 1 Dict Compressing | Decompressing Speed Usage R/U Rating | Speed Usage R/U Rating KB/s % MIPS MIPS | KB/s % MIPS MIPS 22: 357 96 363 348 | 7343 98 678 663 23: 363 98 378 370 | 6878 95 665 629 24: 346 97 383 372 | 7104 97 676 659 Killed 7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=C,Utf16=off,HugeFiles=on,1 CPU) RAM size: 490 MB, # CPU hardware threads: 1 RAM usage: 419 MB, # Benchmark threads: 1 Dict Compressing | Decompressing Speed Usage R/U Rating | Speed Usage R/U Rating KB/s % MIPS MIPS | KB/s % MIPS MIPS 22: 358 96 364 348 | 7332 98 678 662 23: 363 98 379 370 | 6925 95 664 634 24: 346 97 383 372 | 7021 97 673 651 Killed No surprise here, considering that R8 (A13) is similar to A10, which is used in Olimex Lime A10, which has the lowest score in almost all the benchmarks: https://github.com/ThomasKaiser/sbc-bench/blob/master/Results.md So, maybe any SBC might be better than that for zynaddsubfx I'm launching Zyn with command: `zynaddsubfx -U -A=0 -o 128 -r 44100 -b 8192 -I alsa -O alsa -P 7777 -L "/usr/local/share/zynaddsubfx/banks/Choir and Voice/0034-Slow Morph_Choir.xiz"` Thus sample rate is 44100, buffer is 8192 (182ms latency, confirmed by Zyn in its output log). `top` shows that Zyn is using about 30% CPU when idle and jumps to 99% when I press MIDI keys on my Arturia MiniLab mkII. Zyn often spams with "underrun occurred" messages. I tried different buffer sizes, and found that 4086 => 92ms works better but still unable to handle fast subsequent notes; anything more or less than 4086 gives even worse results. Also tried to uninstall the manually compiled Zyn and install one from apt-get, but that fails on CHIP with errors like `snd_seq_event_input: Assertion `seq' failed.` and `snd_pcm_open failed` So, obviously Zyn version in the repository is not optimized or not supporting R8 or CHIPs OS (Linux chip 4.4.13-ntc-mlc #1 SMP Tue Dec 6 21:38:00 UTC 2016 armv7l GNU/Linux) and my custom build might be the best option.
Friedolino Posted August 30, 2018 Posted August 30, 2018 Im using zynaddsubfx headless on a RK3288 TV-Box. with jackd the audio latency is about 10ms. Before that I used a odroid U3. Because i play piano it eats a lot of cpu when played with many keys and sustain pedal pressed. For monophonic playing it should work with less cpu power. A good choice could be the Odroid C0. Its small but faster the RPi3 and can be battery powered.
Recommended Posts