Comments (4)
you mean dB ? So ideally when the sound goes below a certain threshold (e.g. audio level) you want to completely silence the signal.
If so, sounds like a gate effect, which is actually under development at the moment, it might work for your use case.
from mwengine.
Hi @igorski
Yes, that's what I meant.
Thanks for your reply,
from mwengine.
Alright, the latest version of the repository now includes Compressor and Gate processors.
For your use case, I would recommend to use the gate. It has the following methods:
gate.setThreshold( float valueInDb );
gate.setAttack( float value );
gate.setRelease( float value );
The threshold defines the level in dB at which the gate should operate. Experiment with values in the 0 - 100 range. When the signal drops below the provided threshold, the gate becomes active (e.g. sound will be muted).
With the attack and release setters you can set a value (in milliseconds) that determines how fast the gate opens and closes (so you make the effect more smoother instead of a hard open- and close).
I suggest you place the Gate as the first processor in the processing chain of the audio channel (e.g. the one that records the mic input). That means all effects coming afterwards (for instance reverb) will operate as normal (and in the case of reverb add a more natural tail when the input closes).
Also, beware that the createOutput
signature of MWEngine has been updated with a new version (as input channel amount is now configurable at runtime). The new way of creating output is:
MWEngineInstance.createOutput( int sampleRate, int bufferSize, int outputChannels, int inputChannels, Drivers.types driver );
So you likely need to provide an argument for inputChannels
(setting this to 1 ensures you can access the device microphone).
from mwengine.
Hi @igorski,
Thanks for reply, I try to add gate processor to input channel processing chain. With dB value from 0.0f-100.0f no matter what ever the value set the sound stay muted always. Seems gate is always stay active.
Below is my code snippet
```
_gate= new Gate();
_gate.setThreshold(100.0f);
_gate.setAttack(100 );
_gate.setRelease(100);
_engine.getInputChannel().getProcessingChain().reset();
_engine.getInputChannel().getProcessingChain().addProcessor(_gate);
_engine.startInputRecording(
Environment.getExternalStorageDirectory().getAbsolutePath() + "/Download/test/outputt2.wav",false);
```
This is the log:
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 0 read frames instead of 96
V/MWENGINE: AAudio_IO::Setting buffer size to 192
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 48 read frames instead of 96
V/MWENGINE: AAudio_IO::Setting buffer size to 288
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 0 read frames instead of 96
V/MWENGINE: AAudio_IO::Setting buffer size to 384
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 0 read frames instead of 96
V/MWENGINE: AAudio_IO::Setting buffer size to 480
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 0 read frames instead of 96
V/MWENGINE: AAudio_IO::Setting buffer size to 576
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 48 read frames instead of 96
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 0 read frames instead of 96
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 48 read frames instead of 96
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 48 read frames instead of 96
I/chatty: uid=10479(nl.igorski.mwengine.example) Thread-2 identical 1 line
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 48 read frames instead of 96
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 48 read frames instead of 96
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 48 read frames instead of 96
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 48 read frames instead of 96
I/chatty: uid=10479(nl.igorski.mwengine.example) Thread-2 identical 1 line
V/MWENGINE: AAudio_IO::AAudioStream_read() returns 48 read frames instead of 96
D/MWENGINE: Recorded snippet 0 saved to storage
V/MWENGINE: WaveReader::About to parse data for WAV file '/storage/emulated/0/Download/test/rec_snippet_0.WAV'
V/MWENGINE: File size : 1440036
V/MWENGINE: Audio format : 1
V/MWENGINE: Channel amount : 1
V/MWENGINE: Sample rate : 48000
V/MWENGINE: Bytes per second : 96000
V/MWENGINE: Block align : 2
V/MWENGINE: Bits per sample : 16
V/MWENGINE: WaveReader::About to parse data for WAV file '/storage/emulated/0/Download/test/rec_snippet_1.WAV'
V/MWENGINE: File size : 291300
V/MWENGINE: Audio format : 1
V/MWENGINE: Channel amount : 1
V/MWENGINE: Sample rate : 48000
V/MWENGINE: Bytes per second : 96000
V/MWENGINE: Block align : 2
V/MWENGINE: Bits per sample : 16
D/MWENGINE: Recording has completed
Thank you,
from mwengine.
Related Issues (20)
- Is it possible to remove effects after recorded the audio? HOT 7
- Bug with processingChain.removeProcessor(fx) HOT 2
- Error with processors HOT 2
- Is there possible to adjust the volume of latency or turn off those live voice feedback? HOT 7
- Issues with event.addToSequencer() while the sequencer is running HOT 5
- Noise While adding effects to input channel HOT 3
- App get crashed added the processor to the input channel during recording HOT 2
- App get crashed on some devices HOT 12
- Crash that seems to be about Events when no has been added/removed HOT 3
- while recording with SampleEvent and inputChannel recorded output get mismatched HOT 14
- Mic sound is very low in few devices HOT 5
- Thread issue maybe? HOT 10
- AudioRenderer.renderEvent Producing Noise HOT 6
- Is it possible to achieve stereo effect Using Single Input(mic)? HOT 2
- Is there any processor for noise reduction?
- Crashing when deleting events with the engine running HOT 1
- volume issue with sample event HOT 2
- Multitrack audio recording HOT 1
- Remove events with sequencer playing HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mwengine.