- Contributing
This document contains guidelines and advice for people willing to contribute to AudioStreamSplitting development. Most of what is said in here is common sense, but it's best to have it all present and summarized.
Be nice to others :)
Also, please do not submit pull requests or commit messages that contain excessive swearing, we will not accept them. Try to stay professional.
When contributing to AudioStreamSplitting, please follow this workflow to ensure things go smoothly.
NOTE: Part of this will only take effect once this repository becomes public. Please remove this note once that is the case.
- Find an issue describing what you want to implement, or open an issue yourself.
- Assign the issue to yourself, or ask to have it assigned to you.
- Fork this repository to your own account.
- Implement your contribution and commit it to your forked repository. Be sure to follow the requirements outlined in Requirements. Test your implementation and ensure the program builds on your system.
- If something about the user workflow, the code structure, available commands or other usage details documented in this document and the README.md file is changed, also update the corresponding document(s) accordingly. Ensure the documents don't contain spelling errors.
- Create a pull request on this repository.
- The pull request must be approved by at least two of the main maintainers of AudioStreamSplitting (as of current, that's @chubetho, @ChrisItisdud, @4lex0017 and @JosuaE-FHWS). Reviewers must also attempt to build and run the project locally to verify everything works fine.
- After two approvals, the pull request gets merged. The merge should use squash merge in order to keep commit history reasonable on the main branch.
The following requirements must be met by the system at any time:
- Every function has documentation comments, formatted in the reST doc format. An example comment is shown below. These documentation comments are used to generate the documentation. Ensure the documentation comments build correctly and don't contain spelling errors.
- All python code must comply to the black code style.
- All back-end/python code that can have unit tests (i.e. doesn't rely on files on the file system, external APIs or other outside resources) must have them. When adding a new module, add an according test file in the backend/tests folder. When updating an existing one, add or update tests in the correlating test file. All tests must pass (obviously).
- All business logic must be in the back-end. The front-end should only contain the user interface.
def foo(bar, foobar):
"""My description goes here.
It can even have multiple lines!
:param bar: A parameter.
:param foobar: Another parameter
:returns: bar again.
"""
print(foobar)
return bar
The code is structured into two main parts, the back-end (containing the business logic and written in python) and the front-end (containing the UI and written in TypeScript with Vue.js). It's modular such that you could theoretically stick a new front-end on the current back-end without rewriting business logic.
The back-end is mostly centered around two modules containing the logic for segmentation and song identification. Connection to the front-end is done via Flask. The main relevant files are:
backend/main.py
is the entry point that runs the app.backend/api/app.py
is the main entrypoint for Flask. Error handlers and other API modules are registered here.backend/api/audio.py
contains the API routes for song segmentation, recognition and saving.backend/modules/segmentation.py
implements the segmentation logic. Relevant concepts to understand it are Feature Smoothing, Self-similarity-matrices, Novelty and Peak Selectionbackend/modules/api_service.py
implements the song recognition. Each song identification API used has its own module inbackend/modules/apis/
, whichapi_service
calls to gather data from that API.
Other modules in the backend/modules
and backend/utils
folders are utility classes used in or for one of the above. The other routes in the backend/api
folder are used for user settings.
Tests are situated in backend/tests
. Each module that has unit tests has its own corresponding module in this folder.
-
components: This directory serves as a home for reusable UI components. All components placed here are automatically imported, simplifying their usage. If you're enhancing or creating user interface elements, this is where you'll focus your efforts.
-
composables: The "composables" directory contains functions or logic that can be shared across different parts of our application. Functions within this folder are also automatically imported, promoting code reusability.
-
includes: Files that are included or imported into our project are stored here. This could include configuration files, or utility functions.
-
locales: For applications with multilingual support, the "locales" directory is the repository for language files and localization-related code, ensuring a smooth internationalization process.
-
models: In the "models" directory, you'll find data models and classes that define the structure of our application's data. This is the place to work on data-related functionality.
-
modules: The "modules" directory holds core modules such as pinia, vue-router, and other essential packages that are installed when the application initializes.
-
pages: Our application's main pages reside in the "pages" directory. Each page typically corresponds to a specific route. When enhancing or creating views, this directory is where you'll make your contributions.
-
public: Static assets such as images, fonts, or other files that don't require processing by build tools are stored in the public directory.
-
stores: All pinia stores, responsible for managing application state, are located in the "stores" directory, facilitating structured state management.
-
main.ts
serves as the entry point for the frontend. It initializes all modules located in themodules
folder. Eventually, it mounts theApp.vue
component into the DOM. For more details, refer to the Vue.js documentation. -
App.vue
acts as the wrapper component for the entire application. It defines the layout, including the sidebar, and the content for each page. -
pages/project/[id].vue
houses almost all of the application's features. It's the primary focus of your development efforts. -
Example for adding a new page
- Create a new component in the
pages
folder (e.g.,statistics.vue
). - Add a new
<SideBarRow link="/statistics" />
within the<SideBar />
component for navigation. - At this point your implementation should be inside this
statistics.vue
file.
- Create a new component in the
To generate and show documentation, run npm run docs
. This will generate back-end and front-end documentation and show it on a local server easily accessible on your browser (usually localhost:5173). Alternatively, you can find HTML docs for the back-end in docs/_build/html. The documentation is also available on Github pages.
- Python 3.10 or later: Download here
- pip: Download here
- pyinstaller: Download here
- Node.js 18.17.1 or later: Download here
You can choose between manual setup or using Docker for simplicity.
- Clone the repository to your local machine.
- Install the required Python packages using the command
pip install -r requirements.txt
. - Install Node.js modules using the command
npm install
. - Setup
lint-staged
andsimple-git-hooks
using the commandnpx simple-git-hooks
- Download the latest release of fpcalc for your system from the AcoustID website if you want to use the AcoustID API. Put it in a location of your choosing and add it to your system PATH. You will probably need to restart your system before first using AudioStreamSplitting.
If you are using VSCode as your code editor, it is recommended to set up a container with the appropriate extension.
Build the Docker image using the command
docker build -t ass .
Run the container using the command
docker run -v ${pwd}/workspaces/AudioStreamSplitting ass -it bash
-
Download the VSCode Remote - Containers extension from here.
-
Press
Ctrl + Shift + P
to open the command palette, then selectDev Container: Reopen in container
.
For normal development, use the following commands in 2 different terminals:
npm run dev:be
npm run dev:fe
If npm run dev:be
fails, check if the python executable the command calls is correct. If not, either call the command manually or change it in package.json
(but don't commit the change!)
Command | Description |
---|---|
npm run dev:fe |
Run frontend server |
npm run dev:be |
Run backend server |
npm run test:fe |
Run frontend tests |
npm run test:be |
Run backend tests |
npm run view:app |
Run desktop app |
npm run build:fe |
Build frontend (html, js, css) |
npm run build:app |
Build desktop app |
npm run build:app:nocheck |
Build desktop app without checks |
npm run lint:fe |
Run frontend linter |
npm run lint:be |
Run backend linter |
npm run format:be |
Run backend formatter |
npm run typecheck |
Run frontend typechecker |
npm run orval |
Generate API call functions |
npm run docs:gen:be |
Generate backend documentation |
npm run docs:gen:fe |
Generate backend documentation |
npm run docs:gen |
Generate full documentation |
npm run docs:build |
Generate and build documentation |
npm run docs |
Generate and show documentation |
When adding a contribution to this, feel free to add your name to this list, formatted as either just your real name/github username or "Real Name (github username)".
- chubetho
- Christina Reichel (twynb)
- 4lex0017
- JosuaE-FHWS