BeagleBoard/GSoC/2023 Proposal/Improving Bela Workbench

From eLinux.org
< BeagleBoard‎ | GSoC
Revision as of 07:19, 31 March 2023 by Prjbond007 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Proposal-Improving Bela Workbench

About Student: Pranjal Jain
Mentors: Giulio Moro
Code: https://github.com/BelaPlatform/Bela/
Wiki: https://elinux.org/BeagleBoard/GSoC/2023_Proposal/Improving_Bela_Workbench
GSoC: GSoC entry

Status

This proposal is currently in the development stage and will be submitted in GSOC 2023.

Proposal

  • Completed all the general requirements listed on the eLinux ideas page [1].
  • The PR for the Cross Compilation task: #171 and the code for the cross compilation task can be found here

About you

IRC: Pranjal_PJ
Github: Prjbond007
School: Technical University of Denmark
Country: Denmark
Primary language: English, Hindi
Typical work hours: 9AM-5PM CET Central European Time
Previous GSoC participation: This is my first time participating in GSOC 2023.

About your project

Project name: Improving Bela Workbench
Project Outcomes:
The project outcome is to extend the existing Bela oscilloscope, which is used for visualizing audio and sensor signals, into a more full-featured laboratory workbench. The main objective of the project includes:

  1. Developing a waveform generator and integrating it with the existing workbench.
  2. Adding the logic analyzer from the beagle logic project into the existing workbench.
  3. Improving the existing visualization features of the workbench.

Description

In 10-20 sentences, what are you making, for whom, why and with what technologies (programming languages, etc.)? (We are looking for open source SOFTWARE submissions.)

Project Abstract:
Bela is an open-source platform for creating high-performance audio and sensor processing projects. It consists of a hardware board, software libraries, and an integrated development environment (IDE) that allows developers to create and deploy real-time interactive audio and sensor processing projects. This project seeks to improve the Bela platform's browser-based oscilloscope, which is used to visualize audio and sensor signals, by expanding it into a more comprehensive laboratory workbench. The primary objectives are to integrate a waveform analyzer with the current Bela scope, include a logic analyzer from the beaglelogic project, and enhance the workbench's existing visualization features. The aim is to develop a more advanced and versatile workbench that can handle a broader range of signals and provide more accurate analysis and measurements.

Overview of Bela Workbench:
The Bela workbench is a browser-based integrated development environment (IDE) for creating, editing and deploying real-time interactive audio and sensor processing projects using the Bela platform. It provides a comprehensive set of tools and features that allow developers to create, test, and deploy projects quickly and easily. It consists of the Bela oscilloscope which is a powerful tool for analyzing audio signals in real time. The oscilloscope provides real-time visualization and monitoring of audio and sensor signals. It allows developers to visualize the waveforms of their signals and make adjustments to their projects in real time based on the feedback they receive. However, with some improvements in the oscilloscope, it can be turned into a full-fledged workbench for audio-rate signals.

Proposed method for implementation

Initial Setup: Flashing Bela Image
The process of flashing the Bela image involves three steps. Firstly, need to install the Bela software on an SD card using Balena Etcher. Secondly, insert the SD card into the Bela board and power it on. Lastly, access the Bela IDE by opening a web browser (preferably Chrome) and typing in either bela.local or the IP of the OS.

Creating buttons in the frontend
Create a new button for the waveform generator and logic analyzer in the Bela workbench. To create a button in the Bela oscilloscope, will need to modify the source code of the Bela project. Here are the steps to do that:

  • Clone the Bela project repository by running the following command in the terminal:
 git clone https://github.com/BelaPlatform/Bela.git
  • Navigate to the ide directory and open the index.html file in a text editor:

Find the div element with the id of "oscilloscope-controls" and add a new <button> element inside it. Give the button an id and a class attribute. For example:

 <button id="beaglelogic-button" class="control-button">BeagleLogic</button>
  • Add an event listener to the button in the init function of the oscilloscope.js file. For example:
 document.getElementById("my-button").addEventListener("click", function() {
 console.log("Button clicked!");});
  • Save the changes to the files and build the Bela project. Build the project by running the following command in the terminal:
 ./build_project.sh

Waveform Generator
For creating the waveform generator we would use the Javascript based Plotly library. Here is an example to create a waveform generator in the existing bela workbench to generate sine wave:

  • Include the Plotly.js library in the bela project HTML file:
 <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
  • Create a function to generate a waveform, for example, a sine wave:
 function generateSineWave(frequency, amplitude, duration, sampleRate) {
 var waveform = [];
 for (var i = 0; i < duration * sampleRate; i++) {
   waveform.push(amplitude * Math.sin(2 * Math.PI * frequency * i / sampleRate));
 }
 return waveform;}
  • Add a button to trigger the waveform generation:
 <button onclick="generateWaveform()">Generate waveform</button>
  • Implement the generateWaveform() function to update the plot with the generated waveform:
 function generateWaveform() {
 var frequency = 440; // Hz
 var amplitude = 1;
 var duration = 2; // seconds
 var sampleRate = 44000; // samples per second
 var waveform = generateSineWave(frequency, amplitude, duration, sampleRate);
 var plotData = {
   x: Array.apply(null, {length: waveform.length}).map(Number.call, Number).map(function(i) { return i / sampleRate; }),
   y: waveform
 };
 Plotly.update('waveform', plotData);}

This is a simple example, but it can modify it to generate other waveforms, such as square, triangle, or sawtooth waves, or add controls to adjust the waveform parameters, such as frequency, amplitude, and duration.

Logic Analyzer
Install Beagle logic project into the bela OS:
Generate: Beaglelogic project into Bela Image:

 cd /opt
 sudo git clone https://github.com/abhishek-kakkar/BeagleLogic
 sudo chown -R debian:debian /opt/BeagleLogic
 cd BeagleLogic
 sudo ./install.sh

Now, launch Bela workbench and create a new Bela project. In the project settings, select the BeagleBone board as the target platform and specify the IP address of the board. Click on the "Add File" button to add the BeagleLogic project files to the Bela project. This will include the BeagleLogic firmware, the host software, and any other required files. Build and run the Bela project to ensure that it can communicate with the BeagleLogic software on the BeagleBone board. The beagle logic can be linked with a button in the oscilloscope:

 document.getElementById("beaglelogic-button").addEventListener("click", function() {
 // Launch BeagleLogic software
 var spawn = require('child_process').spawn;
 var beaglelogic = spawn('/opt/BeagleLogic/BeagleLogic', []);}


Visualization Features
Some visualization features that can be implemented are:

  • Add adjustable cursors to measure the time or amplitude of a waveform at specific points on the display.
  • Adding more triggering options such as Edge triggering: where the oscilloscope triggers when the signal crosses a user-defined threshold level.
  • Adding Automatic scaling: The oscilloscope can automatically adjust the plot's scaling in each axis based on the signal input. This can help ensure that the signal remains visible every time.

Timeline

Provide a development timeline with a milestone each of the 11 weeks and any pre-work. (A realistic timeline is critical to our selection process.)

Mar 29 Applications open, Students register with GSoC, work on proposal with mentors
Apr 13 Proposal complete, Submitted to https://summerofcode.withgoogle.com
May 17 Proposal accepted or rejected
Jun 07 Pre-work complete, Coding officially begins!
Jun 17 Milestone #1, Introductory YouTube video
June 24 Milestone #2
June 30 Milestone #3
July 12 18:00 UTC Milestone #4, Mentors and students can begin submitting Phase 1 evaluations
July 16 18:00 UTC Phase 1 Evaluation deadline
July 23 Milestone #5
July 30 Milestone #6
Aug 06 Milestone #7
August 10 Milestone #8, Completion YouTube video
August 16 - 26 18:00 UTC Final week: Students submit their final work product and their final mentor evaluation
August 23 - 30 18:00 UTC Mentors submit final student evaluations

Experience and approach

In 5-15 sentences, convince us you will be able to successfully complete your project in the timeline you have described.

Contingency

What will you do if you get stuck on your project and your mentor isn’t around?

Benefit

If successfully completed, what will its impact be on the BeagleBoard.org community? Include quotes from BeagleBoard.org community members who can be found on http://beagleboard.org/discuss and http://bbb.io/gsocchat.

Misc

Please complete the requirements listed on the ideas page. Provide link to pull request.

Suggestions

Is there anything else we should have asked you?