AudioRecorder | Simple live audio file recorder , based on RecorderJS | Canvas library
kandi X-RAY | AudioRecorder Summary
kandi X-RAY | AudioRecorder Summary
Simple live audio file recorder, based on RecorderJS
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- function to draw samples
- Encode WAV data
- Init audio file
- new audio stream
- Draw a filled buffer .
- toggle recording
- Interleave two arrays .
- Toggle audio input .
- callback for retrieved buffers
- merge an array of buffers into a new buffer .
AudioRecorder Key Features
AudioRecorder Examples and Code Snippets
Community Discussions
Trending Discussions on AudioRecorder
QUESTION
I am working on audio recording. when application running on foreground i have to start audio recording and going to background at that time audio recording working fine.
But my question is that how to start audio recording when i am already in background, My audio recording function fired like this:
I have a Bluetooth LE device with buttons and an iOS app. Those two are paired (Bluetooth LE device and the iPhone which runs the iOS app) and the iOS app is listening for events on the Bluetooth LE device, events like a hit of a button.
Now, when the user hits a button on the Bluetooth LE device, the iOS app captures the event and I am able to run code even if the app is in background, but I am not able to start a voice recording.
I have already enable Background Modes
:
Here is my Code for Audio Recording:
...ANSWER
Answered 2022-Jan-12 at 22:36This is not possible to do without an explicit UI interaction for security reasons, or else it would be possible to "spy" on a person (once paired, a person outside of a room could start recording and listen to what happens inside the room).
Workarounds could be:
- send a local notification e.g. "The device is ready to record, want to start?". Once you tap this, the app opens in foreground, and should be able to start the recording.
- use CallKit (suitable for phone-like use cases). When the user presses "Accept" in the CallKit system UI, it is possible to start recording audio even in background.
QUESTION
I'm working on an audio recording class that either runs for an allotted period of time (such as 5 seconds) or can be stopped early by the user.
I'm using setTimeout to define the recording length, which works. However, I'm having trouble getting setTimeout working with a "stop" button. The error is as follows:
Cannot read properties of null (reading 'stop')
When the startRecording function executes, the handleStopRecording function is called which sets a timer with the "stopRecording" function. If the "stopRecording" function is called before the time elapses (by pressing the "stop" button), the function call that was initially in setTimeout will still execute when the timer expires, causing an error.
I tried fixing this by using clearTimeout, but then the "context" of the original function call is lost and we get the same error:
Cannot read properties of null (reading 'stop')
Unless I'm mistaken, I think this is an issue with closure of the setTimeout function - however I'm not sure how to clear the function early with a stop button and limit recording time.
Thank you in advance!
App.js (React.js)
...ANSWER
Answered 2022-Mar-14 at 00:00You can try using a boolean value to check if the process is stopped. You can store it in state and change its value when starting or stopping
QUESTION
So I've read various posts and blogs on how to get the amplitude from the microphone on Android. Multiple posts suggested using this implementation:
...ANSWER
Answered 2021-Oct-08 at 09:09The easiest way to get the max amplitude on Android is a lot less code. Just call MediaRecorder.getMaxAmplitude(). It returns the max amplitude since the previous call. I'm not sure where you got the suggestion to use the call you did, that seems like the hard way.
The units aren't specified. It should correspond to the amount of pressure picked up by the mic, but as every model will have different mics, amps, DACs, etc it isn't going to be the same on all devices. All you can be promised is it will be between 0 and (2^x)-1 where x is the number of bits per sample you picked. I'm not sure why you'd think it would be in millivolts, this isn't an electrical measurement. Sound is typically measured in dB or pascals.
For comparing iOS to Android and trying to do matching- what are you trying to do? The code you have is just finding the max value. That's kind of uninteresting, unless all you're doing is an applause meter. If you're actually looking to compare soundwaves wouldn't you be better off taking the fourier transform and doing so in the frequency domain? The time domain is really messy for that.
QUESTION
I'm trying to create an app that records from mic and saves file into WAV format. I found this java class that helped me record and save my recording in WAV format.
...ANSWER
Answered 2021-Sep-08 at 08:59Turns out that I found a solution to my problem, if anyone else ever faces the same issue. I actually modified the ExtAudioRecorder class and now everything seems to be working right.
Especially after changing this line:
audioRecorder = new AudioRecord(aSource, sRate, nChannels + 1, aFormat, bufferSize);
into this:
audioRecorder = new AudioRecord(aSource, sRate, nChannels, aFormat, bufferSize);
I think the problem was lying somewhere there.
Here's the modified code for ExtAudioRecorder.java file:
QUESTION
I have an iOS app using SwiftUI. It handles a few sound files and performs some audio recording. This is the function doing the recording work:
...ANSWER
Answered 2021-May-05 at 02:32The audio session will be a decreased volume during playback after recording in .playAndRecord
mode. After recording, explicitly set to something like .playback
to get the volume you're expecting.
QUESTION
Please help me! I want to record small size voice files in Android using Titanium.
I am using Titanium.Media.AudioRecorder() to record voice files, but the size of the generated files are too large.
I would like to generate small size voice files. It doesn't matter to have low quality.
What format and what compression type should I use to get better results (small size files)? Thank you
I am using the code below:
...ANSWER
Answered 2021-Mar-21 at 10:37If you look at the documentation you'll see that the compression
and format
parameters are iOS only. Android will always record default audio settings.
You either have to
- create a MediaRecorder module
- try one of those: http://gitt.io/search?q=audio (some are very old and need to be recompiled for Ti SDK 9)
- use Hyperloop to create a recorder. As a starting point you can have a look at Hyperloop MediaPlayer example
You might be able to convert this navitve MediaRecorder example to Hyperloop.
QUESTION
Okay, so I've been trying to do this for a long time but I just can't find a solution. I'm building a personal Voice Assistant that only records when a hotword is detected, and everything until here works fine. To record the audio, I'm using the npm package node-record-lcpm16. I can't seem to find a solution to pause or stop(and start again) the recording. On the npm website of the audiorecorder there is a function specified that says recording.stop() but it doesn't work for me. My code right now is:
...ANSWER
Answered 2021-Feb-25 at 16:09I've played about with your code.. it's definitely a fun project to play with!
I would suggest maybe just modifying the code to record to a buffer, then send that to the google speech recognition engine.
The reason recording.stop() was probably not working for you is that you were calling it on the stream. If we separate the recording and recordingStream variables we can control the flow better.
I've updated the code so when we get the hotword, we stop recording, recognize the speech, then start recording again.
QUESTION
I'm acquiring PCM raw bytes with new AudioContext({ sampleRate: 16000 })
(note, I'm using Chrome, which supports the sampleRate
option), and I'd like to convert the resulting array into a DataView
object.
My current code is the following, in the stop
method I read the left channel and store it as an array of Float32Array
s.
ANSWER
Answered 2021-Feb-23 at 17:24From your comment I will assume you know how to handle s16le raw audio.
Also notice that you are creating your ArrayBuffer with length equals the number of samples in the PCM32fSamples
, should be the size in bytes, also the call to setInt16
should pass the offset in bytes.
An alternative to set an array buffer is to construct an Int16Array. The motivation for using a DataView is to be able to write mixed type data. This will make your code more readable.
QUESTION
For the web app I'm building in React, I need to record audio and be able to somehow put that recorded audio in the app's global state so I can use and manipulate that recorded audio in different components of the app.
My global state is setup using React Hooks (made and managed with useReducer, createContext, useContext) and I believe Hooks only work for functional components, not class components.
So the issue I'm running up against is that every tutorial I've followed to get my browser microphone to work uses class components (like the code below), not functional components. And I'm assuming that this is for good reason because when I've tried to translate these class components into functional components, I get the error: "cannot read property 'finish' of 'undefined'"
Are there ways to take this audio data (blobURL) and pass it to my global state?
Alternatively (and ideally), is there a way to use the microphone to record audio in a functional component instead of a class component?
...ANSWER
Answered 2021-Feb-22 at 23:24Your class-based components can still "consume" the context but the syntax is a little more involved than simply using a useContext
React hook.
For your case you would import your global state context Context
and render the component that needs to access the context via a function child. The child component would then need consume these context values via props.
Some classed-based component:
QUESTION
I am trying to return the current decibel level from the iPhone's microphone. I have pieced together this code below and cannot figure out why it won't work. My expectation is that for now it will print the current peak power continuously to the console.
So my questions/issues are:
- Will "peakPowerForchannel" return the current level or the max for the entire audio session?
- It appears my button never turns to the stop recording mode and just prints "recording started" every time it is pressed.
- I can't figure out why the decibel level won't print at all.
Thanks for the help!
...ANSWER
Answered 2021-Feb-21 at 19:43Regarding peak power, here's what the docs say:
The audio channel’s current peak power.
(basically, the current window)
You need to actually call startRecording()
in your Button's action (right now, all you're doing is printing):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AudioRecorder
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page