npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

au-audio-recorder

v1.6.0

Published

A very easy to use audio recorder written in JavaScript that allows the user to record audio in a browser or desktop application.

Downloads

11

Readme

AudioRecorder

An audio recorder written in Javascript and HTML. The main audio recorder is in the file 'AUAudioRecorder.js' which contains the AUAudioRecorder object. To see a very simple example of the audio recorder at work, navigate to the 'RecorderTester.html' file in the Example folder.

Methods

  • startRecording(): Starts the recording process. The method "requestPermission()" must be called first so that the program has permission to access the computer's microphone.
audioRec.startRecording(callback);
  • stopRecording(): Stops recording and saves the recorded audio into a variable with a file type that can be specified by another method.
audioRec.stopRecording(callback);
  • play(): Plays the recorded audio in the browser.
audioRec.play(callback);
  • pause(): Pauses the audio that is playing. when the play button is clicked again the audio will resume from where it was.
audioRec.pause(callback);
  • stop(): Stops the audio from playing and sends it back to the beginning.
audioRec.stop(callback);
  • loop(bool): Sets whether or not the audio should loop once it is played. Set the parameter "bool" to true or false for your desired option.
audioRec.loop(true,callback);
  • stepBackward(): Starts the audio from the beginning but does not pause it.
audioRec.stepBackward(callback);
  • stepForward(): Sends the audio to the end. Basically just stops it from playing by doing this.
audioRec.stepForward(callback);
  • clear(): Deletes the currently recorded audio. This is the only callback that does not return an error message.
audioRec.clear(callback);
  • isFinished(): Returns whether or not the audio is finished playing.
audioRec.isFinished();
  • requestPermission(): Asks the user for permission to access the computer’s microphone.
audioRec.requestPermission();
  • hasPermission(): Returns true/false if the user has given permission to use the computer's microphone.
audioRec.hasPermission();
  • getRecording(): Returns an audio object that contains the recorded audio.
audioRec.getRecording();
  • getRecordingFile(): Returns a Blob object that contains the recorded audio. This can be used for operations where a file is needed.
audioRec.getRecordingFile();
  • setOutputFileType(fileType): Sets the type of file that the audio will be formatted to. The "fileType" parameter is the file extension that you would like to use (i.e. mp3, wav, ogg). The default file type is mp3.
audioRec.setOutputFileType("mp3");
  • getStream(): Returns the stream used by the Web Audio API that handles the recording. This method would be useful if one would like to do other things with the Web Audio API such as drawing it on a canvas or adding sound effects.
audioRec.getStream();

How To

  • Step 1: Add the AUAudioRecorder to your web application. This can be done by using the script tag like so:
<script type="text/javascript" src="https://adeolauthman.squarespace.com/s/AUAudioRecorder.js"></script>

or by installing it with npm, as shown here:

$npm install au-audio-recorder

then, in your JavaScript file typing:

var audioRec = require('au-audio-recorder');
// Or
import audioRec from 'au-audio-recorder';
  • Step 2: Assuming you have already created buttons in your HTML file and already have your own Javascript file for your webpage, you can create a new AUAudioRecorder object and call methods from it when buttons are clicked.
var audioRec = new AUAudioRecorder();

audioRec.hasPermission( (err) => { console.log(err); } );
audioRec.requestPermission();
audioRec.startRecording( (err) => { console.log(err); } );
audioRec.stopRecording( (err) => { console.log(err); } );
audioRec.loop(true, (err) => { console.log(err); } );
audioRec.play( (err) => { console.log(err); } );
audioRec.pause( (err) => { console.log(err); } );
audioRec.stop( (err) => { console.log(err); } );
audioRec.stepBackward( (err) => { console.log(err); } );
audioRec.stepForward( (err) => { console.log(err); } );
audioRec.clear( () => { /* callback */ } );
audioRec.isFinished();
audioRec.getRecording();
audioRec.getRecordingFile();
audioRec.setOutputFileType("mp3");
audioRec.getStream();

Author

  • Year: 2016
  • Languages: HTML, Javascript
  • Programmer: Adeola Uthman