PlayNoise.js is a lightweight JavaScript library that enables music creation directly in the browser using Recorded Speech and YAML-based scores. It allows users to generate stereo audio and export it as WAV files, making it an excellent tool for web-based music and audio projects. Try it at PlayNoise.org
playNoisePreview.mp4
- Voice-to-Instrument Conversion: Convert recorded voice audio into musical instrument tones for unique and creative sound generation.
- YAML-Based Scores: Write music effortlessly with simple YAML syntax.
- Browser-Compatible: Fully functional in modern web browsers.
- Stereo Audio: Supports stereo audio generation.
- WAV File Export: Export audio as downloadable WAV files.
- Customizable Sound Properties: Control tempo, frequency, amplitude, and more.
Add PlayNoise.js to your project via a <script> tag.
-
Download the
dist/pn-library.jsfile from the repository. -
Include it in your HTML:
<script type="module" src="path/to/pn-library.js"></script>
Load from remote storage
<script t src="https://playnoise.org/pn-library.js"></script>
-
Include the library in your project:
<!-- Include the pn-library.js script --> <script src="pn-library.js"></script> <script> // Wrap everything in an async function async function runPNExample() { console.log(PN); // This should print the PN object PN.instrument('Banjo'); // Select the instrument // PN.setVolume(0.5); // Set volume (optional) // Wait for PN.singVoice to complete const song = await PN.singVoice('recording2.wav'); console.log("Song created:", song); console.log(PN.volume); // Logs the current volume setTimeout(() => { PN.save(); // Call save after the delay }, 8000); // Delay in milliseconds (5000ms = 5s) } // Run the function runPNExample(); </script>
Here's the CodePen project: https://codepen.io/isles-forcha/pen/KwPBJZO
- Open the HTML file in your browser, and the WAV file will be generated and available for download.
build: Builds the library for the browser using Webpack.lint: Runs ESLint to ensure code quality.lint-fix: Automatically fixes code style issues.test: Runs unit tests using Jest.docs: Generates documentation using JSDoc.format: Format linters and maintain code style
Run these scripts using npm:
npm run <script-name>Generate the documentation using:
npm run docsThis will output documentation in the docs/ directory.
Contributions are welcome! Here’s how you can contribute:
- Fork this repository.
- Create a feature branch:
git checkout -b feature-name. - Commit your changes:
git commit -m "Add new feature". - Push to your branch:
git push origin feature-name. - Submit a pull request.
##Chats
Join the PlayNoise Discord Community https://discord.gg/g9ERs8jJ
PlayNoise.js relies on modern browser APIs and lightweight libraries to handle core functionality:
- js-yaml: Parse and serialize YAML.
- wav-encoder: Encode WAV files.
- fft-js: Fast Fourier Transform for audio processing.
- yinjs: A pitch detection library.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to open an issue or submit a pull request if you have any questions or suggestions!
Happy Coding! 🎶