Skip to content

Commit a78b119

Browse files
Create CONTRIBUTING.md for contribution guidelines
Added a comprehensive contribution guide to help new contributors understand the workflow and requirements for contributing to the project.
1 parent 7784081 commit a78b119

1 file changed

Lines changed: 129 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Welcome to the decibri Contribution Guide
2+
3+
Thank you for investing your time in contributing to our project! We welcome all sorts of different contributions.
4+
5+
Before making any type of contribution, please read our [Code of Conduct](https://github.com/analyticsinmotion/decibri/blob/main/CODE_OF_CONDUCT.md) to keep our community approachable and respectable.
6+
7+
In this guide you will get an overview of the contribution workflow from opening an issue and creating a Pull Request (PR).
8+
9+
10+
## New contributor resources
11+
12+
To get a good overview of the project, please first read the [README](https://github.com/analyticsinmotion/decibri/blob/main/README.md) document. In addition, here are some great general resources to help you get started with open-source contributions:
13+
14+
- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
15+
- [Collaborating with pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests)
16+
17+
18+
## Ways to contribute
19+
20+
There are multiple ways in which you can contribute to this project including:
21+
22+
- Reporting a bug
23+
- Submitting a fix
24+
- Suggesting new features or improvements
25+
- Adding or updating documentation
26+
- Adding or improving integration guides
27+
- Improving test coverage
28+
- Anything else we may have forgotten
29+
30+
31+
## Getting started
32+
33+
### Prerequisites
34+
35+
decibri is a native Node.js addon that wraps PortAudio. To build from source you will need:
36+
37+
- Node.js 18 or later
38+
- Python 3.x (required by node-gyp)
39+
- A C/C++ compiler:
40+
- **Windows**: Visual Studio Build Tools (installed automatically with most Node.js installers)
41+
- **macOS**: Xcode Command Line Tools (`xcode-select --install`)
42+
- **Linux**: `build-essential` and `libasound2-dev` (`sudo apt-get install build-essential libasound2-dev`)
43+
44+
### Setting up the development environment
45+
46+
1. Fork this repository to your own account and clone it to your local machine:
47+
```bash
48+
git clone --recurse-submodules https://github.com/YOUR_USERNAME/decibri.git
49+
cd decibri
50+
```
51+
The `--recurse-submodules` flag is important. PortAudio is included as a git submodule under `deps/portaudio` and is required for the build.
52+
53+
2. Install dependencies and build the native addon:
54+
```bash
55+
npm install
56+
```
57+
This will compile PortAudio and the C++ addon from source via node-gyp.
58+
59+
3. Run the tests:
60+
```bash
61+
npm test
62+
node test/float32.js
63+
```
64+
These are static tests that verify the module loads and the API surface is correct. They do not require a microphone.
65+
66+
4. (Optional) Run the live capture and VAD tests if you have a microphone connected:
67+
```bash
68+
node test/basic.js --live
69+
node test/vad.js
70+
```
71+
72+
### Architecture overview
73+
74+
The project has three layers:
75+
76+
- **C++ native addon** (`src/decibri.cc`): Wraps PortAudio via N-API. Handles audio capture in a separate thread and marshals data to JavaScript via ThreadSafeFunction.
77+
- **JavaScript wrapper** (`index.js`): Extends Node.js Readable stream. Adds device selection, VAD, and format handling.
78+
- **Type definitions** (`types/index.d.ts`): TypeScript declarations with full event overloads and JSDoc annotations.
79+
80+
The `binding.gyp` file configures platform-specific build settings (WASAPI on Windows, CoreAudio on macOS, ALSA on Linux).
81+
82+
### Reporting a bug
83+
84+
We use GitHub Issues to raise, track, and manage bugs. All open, pending, and closed cases can be found at [decibri Issue Tracking](https://github.com/analyticsinmotion/decibri/issues).
85+
86+
Should you identify a bug, please search if the issue already exists in [GitHub Issues](https://github.com/analyticsinmotion/decibri/issues). You may be able to add more information or your own experience to an existing issue.
87+
88+
If a related issue doesn't exist, you can open a new issue using the [issues form](https://github.com/analyticsinmotion/decibri/issues/new).
89+
90+
To assist in fixing any issues raised more rapidly, please ensure that bug reports include the following (where applicable):
91+
92+
- A quick summary and/or background
93+
- Your operating system and architecture (e.g. Windows 11 x64, macOS arm64, Ubuntu 22.04 x64)
94+
- Node.js version (`node --version`)
95+
- Any steps helpful to reproduce the bug
96+
- Code or sample codes that were used
97+
- What you expected to happen vs. what happened
98+
- Exact error messages received (you can upload de-identified screenshots as well)
99+
100+
### Proposing codebase changes
101+
102+
We welcome contributions to the codebase from everyone who is interested in making the project better. If you want to propose a change, please follow these steps:
103+
104+
1. Fork this repository to your own account and clone it to your local machine with `--recurse-submodules`.
105+
2. Create a new branch from the `main` branch for your changes. Give the branch a descriptive name that reflects the changes you plan to make.
106+
3. Make your changes to the codebase in your local repository.
107+
4. Test your changes thoroughly. At a minimum, run `npm test` and `node test/float32.js`.
108+
5. Commit your changes to your local branch with a clear and descriptive commit message.
109+
6. Push your branch to your forked repository.
110+
7. Open a pull request (PR) against the original repository's `main` branch. Include a description of your changes, highlighting the reasons for the changes and the benefits they provide.
111+
112+
Our team will review your PR and provide feedback as soon as possible. We may ask you to make additional changes, so please be prepared to iterate on your changes until they are ready to be merged.
113+
114+
### Important notes for native code changes
115+
116+
- Changes to `src/decibri.cc`, `binding.gyp`, or `deps/` require recompilation. Run `npm install` after making changes to rebuild the addon.
117+
- Prebuilt binaries are generated by the CI pipeline on release tags. You do not need to produce prebuilt binaries for a PR.
118+
- If your change affects the public API surface, please update `types/index.d.ts` to match.
119+
120+
We appreciate your contributions to the project and thank you for your time in submitting a pull request.
121+
122+
123+
## License
124+
125+
By contributing to this repository, you agree to license your contributions under the [Apache License 2.0](https://github.com/analyticsinmotion/decibri/blob/main/LICENSE).
126+
127+
Any contributed code or content must be your original work, and you warrant that you have the right to license it under the terms of the Apache License 2.0.
128+
129+
By contributing, you also acknowledge that your contribution will be included in the project under the same license as the rest of the repository.

0 commit comments

Comments
 (0)