monocasual / giada

Your Hardcore Loop Machine.
https://www.giadamusic.com
GNU General Public License v3.0
1.73k stars 99 forks source link

Official Linux build for ARM architectures #419

Open tomek-szczesny opened 4 years ago

tomek-szczesny commented 4 years ago

Since some people reported that Giada builds even on ARM machines such as Raspberry Pi, it seems like a quite low-effort improvement. The selection of music production software is limited for this platform (unless you know how to compile stuff), and it might be a good idea to provide an ARM-compatible AppImage for those who wish to try out Giada on their tiny machines. I believe there is not a lot of "competition" on this "market".

Personally I switched to Odroid ARM computer as my daily desktop, due to negligible power consumption and decent performance for light tasks. I will continue my programming efforts on it unless I find something that prevents me from doing so.

I wanted to spark a discussion around the demand for such a feature - do people actually want it, can we deliver it etc. I can test it, that's for sure :D The question remains however, does AppImage actually support ARM? Hmm..

monocasual commented 4 years ago

Very cool indeed. Travis CI supports arm64, so it's really a matter of whether AppImage does it or not. We are currently using linuxdeploy for the actual packaging process and as far as I can tell there's no trace of ARM builds in there...

tomek-szczesny commented 4 years ago

Travis CI supports arm64, so it's really a matter of whether AppImage does it or not.

Well, musescore has an ARM AppImage, so it's doable. :) LEt's dig into the details when I confirm Giada is actually working fine on my Odroid.

tomek-szczesny commented 4 years ago

I just built it on Odroid! Yass!

Didn't test it thoroughly yet, I've got to drag along my sample library first. But it runs and I didn't see anything suspicious yet.

I ran tests and I don't know what to make out of it, no experience with those. I'm guessing it won't work with actual samples and sounds, huh?

mctom@Tomusiomat-ARM:~/git/giada/build$ ./giada --run-tests

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--run-tests is a Catch v1.12.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
u::fs
-------------------------------------------------------------------------------
/home/mctom/git/giada/tests/utils.cpp:7
...............................................................................

/home/mctom/git/giada/tests/utils.cpp:11: FAILED:
  REQUIRE( fs::fileExists("build/giada") == true )
with expansion:
  false == true

[wfx::silence] silencing from 20 to 57
[wfx::cut] cutting from 47 to 210
[wfx::trim] trimming from 47 to 210 (area = 163)
[wfx::fade] fade from 47 to 500 (range = 453)
[wfx::fade] fade from 47 to 500 (range = 453)
[wfx::fade] fade from 11 to 43 (range = 32)
[wfx::fade] fade from 47 to 79 (range = 32)
[waveManager::create] unable to read tests/resources/test.wav. System error : No such file or directory.
-------------------------------------------------------------------------------
waveManager
  test creation
-------------------------------------------------------------------------------
/home/mctom/git/giada/tests/waveManager.cpp:23
...............................................................................

/home/mctom/git/giada/tests/waveManager.cpp:28: FAILED:
  REQUIRE( res.status == G_RES_OK )
with expansion:
  -2 == 1

[waveManager::createEmpty] new empty Wave created, 4096 frames
[waveManager::create] unable to read tests/resources/test.wav. System error : No such file or directory.
-------------------------------------------------------------------------------
waveManager
  test resampling
-------------------------------------------------------------------------------
/home/mctom/git/giada/tests/waveManager.cpp:47
...............................................................................

/home/mctom/git/giada/tests/waveManager.cpp:47: FAILED:
due to a fatal error condition:
  SIGSEGV - Segmentation violation signal

===============================================================================
test cases:    9 |    7 passed | 2 failed
assertions: 8399 | 8396 passed | 3 failed

Segmentation fault
mctom@Tomusiomat-ARM:~/git/giada/build$ 

EDIT: Today I played with Giada for a bit more and everything seems to work very well... The memory footprint was in order of 30MB, the CPU utilization around 15% on one of six available cores. Actually it took much more processing power to display a stream of debug messages in a terminal window. :) I'm very, very satisfied with these results.

monocasual commented 4 years ago

Nice! Did you also try with Jack as the underlying sound system? Wrt the tests: they must be run outside the build directory in order to pick the right sample path (should add this to the documentation sooner or later).

tomek-szczesny commented 4 years ago

I just tried Jack and yup, it does work just fine. :) I haven't tried MIDI yet, as I sold all my mini/micro controllers recently, and lost an auction of a Launchpad S that I wanted to get instead :crying_cat_face:

The tests also run smoothly when I followed your advice.

mctom@Tomusiomat-ARM:~/git/giada$ ./build/giada --run-tests
[wfx::silence] silencing from 20 to 57
[wfx::cut] cutting from 47 to 210
[wfx::trim] trimming from 47 to 210 (area = 163)
[wfx::fade] fade from 47 to 500 (range = 453)
[wfx::fade] fade from 47 to 500 (range = 453)
[wfx::fade] fade from 11 to 43 (range = 32)
[wfx::fade] fade from 47 to 79 (range = 32)
[waveManager::create] new Wave created, 40636 frames
[waveManager::createEmpty] new empty Wave created, 4096 frames
[waveManager::create] new Wave created, 40636 frames
[waveManager::resample] resampling: new size=81272 frames
===============================================================================
All tests passed (8421 assertions in 9 test cases)

So, yay! All that needs to be done is to figure out how to make an ARM AppImage. Maybe the musescore guys would share their insight? ;)

monocasual commented 4 years ago

Wow I'm very impressed, especially for the CPU utilization around 15%. Did you also try to load multiple channels and fiddle around with them - removing, changing properties, ...? I'm asking this because there are some default/unoptimized atomic instructions in the code that might be very slow on ARM architectures (#348 will help a lot on that point).

tomek-szczesny commented 4 years ago

Well, the test was very basic to be honest, just two samples lopping :D I might stress test it in the future if you worry about that. I'll look around for some tool for logging CPU load of a specific process. Perhaps it's just my Odroid that handles stuff so well - it has four 2.4GHz ARM cores that support unordered execution, and another two cores clocked at 2GHz that have ordered execution, and are low-power otherwise. So called big.LITTLE. Linux kernel is aware of that and assigns lighter tasks to little cores. Since Giada has a few threads running, it is a great CPU for this task. On Raspberry Pis, the modern 64-bit machines (starting with Pi 3 I think) are quad-cored, and mostly got improved in terms of RAM and peripherals in recent years.

tomek-szczesny commented 3 years ago

One more thing worth noting, Raspberry Pi OS is currently available 32-bit only. As RPi holds major share of the SBC market, I'm guessing that armv7 or armv8 build should be available too.

tomek-szczesny commented 3 years ago

Stuff to keep in mind: https://gist.github.com/fm4dd/c663217935dc17f0fc73c9c81b0aa845

hfiguiere commented 3 years ago

One more thing worth noting, Raspberry Pi OS is currently available 32-bit only. As RPi holds major share of the SBC market, I'm guessing that armv7 or armv8 build should be available too.

It's not true. There is a 64-bit version. They just tuck it away. I have been running it for over 6 month.

tomek-szczesny commented 3 years ago

No official release though, and well hidden from general public. My point was that 32-bit release should be available as well.

Xpktro commented 3 years ago

Any news on this? or are there any special build instructions for this architecture? I'd really love to have an official armv8 build. Giada will be a strong competitor in the low spec music making market.

I'm currently running a rpi4 and was looking at begineer friendly music tools. Giada is the best fit so far except for this little detail :(

tomek-szczesny commented 3 years ago

Any news on this? or are there any special build instructions for this architecture? I'd really love to have an official armv8 build. Giada will be a strong competitor in the low spec music making market.

I'm currently running a rpi4 and was looking at begineer friendly music tools. Giada is the best fit so far except for this little detail :(

Just follow the build instructions and all should be well. I dont remember taking any extra steps. I haven't tried building with vst support though.

CarloCattano commented 3 years ago

Im trying to compile it on pi 3 32bit . Just for fun and to see if I can contribute in the future, since there is a Giada version on my apt .

The only strange thing I noticed is a weird error with ssh and github , I had to -> echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config

otherwise , it wont let me update recursively the repo

CarloCattano commented 3 years ago

Alternatively , I changed the url in the git config file and it works normally now . https://github.com/monocasual/giada/blob/4e6bcf5672c7bf45cdd306860541edd3b35028a3/.gitmodules#L15

Instead of git@github.com:monocasual/geompp.git https://github.com/monocasual/geompp.git , etc with the others

tomek-szczesny commented 3 years ago

That's definitely not an ARM-related problem.

CarloCattano commented 3 years ago

That's definitely not an ARM-related problem.

Sorry about that , here I have one . Without VST support it does build , even tho the version through apt seems more stable and efficient for some reason and it has vst support that runs well on my rpi 3.

When trying vst3 support I get the following :

build_output.txt

Any leads would be appreciated, would like to keep up to date

Xpktro commented 3 years ago

Just successfully built in my rpi4b (armv7l) with and without VST3 support (however I couldn't find a suitable arm-compiled vst to test this yet).

For VST3 support, I had to install these additional dependencies:

libxcursor-dev libxft-dev libxinerama-dev libxpm-dev libxrandr-dev

And had to add a line in CMakeLists.txt after L505 (as I faced the same errors as @CarloCattano) :

        set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")
CarloCattano commented 3 years ago

Perfect , thanks @Xpktro !! I did build successfully VST3 and VST2 at the same time . Is true that there arent much vst3 plugins around for arm , but in the future perhaps . Is not a big problem for me since I can use Giada - > Carla( lv2 plugins ) . But is amazing to see this useful vst2 on the pi inside Giada smoothly :-)

image height="100" width="100"

I got most of them from the Zynthian repo https://github.com/zynthian/zynthian-plugins

VST3 works with @Xpktro instructions . Vst2 requires a few extra steps :

I got the vst2sdk from archive.org:

  wget https://archive.org/download/VST2SDK/vst_sdk2_4_rev2.zip
  unzip vst_sdk2_4_rev2.zip
  cp  vstsdk2.4/ -r ~/giada/src/deps/vst3sdk

  cmake -B build/ -S . -DWITH_VST3=ON -DWITH_VST2=ON -DCMAKE_BUILD_TYPE=Release

  cmake --build build/  

still relevant until vst3 greatness manifests on arm widely , or till giada merges lv2 and then wont be needed for linux at last , since many plugins have already their lv2 available

Xpktro commented 3 years ago

Can confirm the full VST2+3 build is working in my setup thanks to the instructions given by @CarloCattano, thanks!

Note: The copy command for the vst2 SDK just need a * after the first cp argument.

CarloCattano commented 3 years ago

Right ,

cp -r vstsdk2.4/pluginterfaces/vst2.x/  giada/src/deps/vst3sdk/pluginterfaces/

exactly , forgot that it asks for the files under vst2.x