Can I add code and if so how?

Hello. First up I just want to say that I’m forever grateful for the balena team reviving my father’s old stereo to be a bluetooth speaker. Secondly I want to say that this is my first time coding anything at all.

I started using your the balenaSound last summer. Now in school we had to do a larger project, and I thought I fought I could program a music visualizer. I’ve programmed the lights on a arduino and all I have left is getting the different Hz to the arduino from my raspberry if I can use the Balena Sound as a base.

So my question is can I add code to my raspberry pi, and if so, which way is the easiest? If I need to go to the sd card, which only contain the balena sound, directly write the code there or can i externally add code to my raspberry?

Hi from what I understand you would need to add some custom code on the application you are running on your raspberry which in this case is balenaSound. In this case what you have to do is download the balenaSound repository (git clone https://github.com/balenalabs/balena-sound.git) on your computer. Once cloned, open it with a text editor and at this point you have two solutions:

  1. Add a new service to the application (check this masterclass if you have time: Balena Services Masterclass - Balena Documentation)
  2. Directly modify the code of balenaSound.

Just remember that by doing this you will no longer be aligned with balenaSound updates but you will have your own customized application.

Once you have made the changes, using a terminal from your computer you can push your code using the balena CLI (balena CLI Documentation - Balena Documentation). From your project directory (modified balenaSound), you can run the command:

balena push <APP_NAME>

Other useful reference: Get started with Aetina N510 TX2 and Node.js - Balena Documentation

hope this helps you.