Comments (7)
That's a fair approximation, RMS would be more accurate.
from just_waveform.
I would suggest computing the RMS. If you google that you should find some helpful tutorials and explanations.
from just_waveform.
The rms ok ...I was able to get the waveform now onto the rms. thanks
from just_waveform.
Hello @ryanheise , Please help/hear me out, thanks for the great package..i've been looking for solutions for this since 2 days..now with your help i know that i am close .i am not knowledgeable enough in sound engineering and i dont know if it is right to post this here but... i was able to calculate the RMS value of the waveform.data list of ints with this method:
double _rmsValueOfList(List<int> list, int n) {
num square = 0;
double mean = 0.0, root = 0.0;
for (int i = 0; i < n; i++) {
square += pow(list[i], 2);
}
mean = square / n;
root = sqrt(mean);
return root;
}
the value i get in return is 4927.386586958856. Does that mean that if i loop through the waveform.data , values below the rms can be considered silences ? Also how can i know the timestamp of the current value in the waveform.data list so that i can issue commands based on the silence detection ? the audio files are voice reading generated mp3s. I have a character which mimics the voice speech...but since i cant yet detect the pauses ,it keeps on mumbling when there is no sound. the audio is read through the audioplayers plugin which allow me to get the current duration(the timestamp) of the current audio being played. i would like to match these timestamps to the silences(pauses) and issue commands to my character so it can shut or open its mouth ...Please assist me...
from just_waveform.
If you read tutorials about RMS, the more you read the more you will understand. In case you didn't realise, you also don't want to compute the RMS of the whole audio, so you'll want to choose a window size. As for timestamps, just_waveform gives you the sample rate and the samples per pixel, plus you have your own window size. Combining all of those you should be able to figure out timestamps. You can see an example of this sort of calculation in the Waveform.positionToPixel
method.
But I generally don't give that sort of advice here, so please keep reading more about it and you will figure it out.
from just_waveform.
@ryanheise Thanks ... this is more than enogh already to get me going on the right track...thanks again
from just_waveform.
@ryanheise Just wanted to give you a huge shout out for the tips and the time. positionToPixel method did the trick for my use case. I was able to compare the values with a certain threshold to figure out how to detect silences and i didn't have to calculate RMS. Here is the code for future reference
player.onPositionChanged.listen((Duration p) {
final currentMaxPixelAtPosition =
waveform?.getPixelMax(waveform.positionToPixel(p).toInt());
if (_isSilence(currentMaxPixelAtPosition!, -100)) {
leoCurrentState = LeoState.talk;
} else {
leoCurrentState = LeoState.stopTalking;
}
});
bool _isSilence(int currentMaxPixelAtPosition, double silenceThreshold) {
return currentMaxPixelAtPosition < silenceThreshold;
}
from just_waveform.
Related Issues (20)
- [Bug] extracting few audio files in same time HOT 3
- Will there be windows and linux support? HOT 2
- audio/waveform.mp3 must be an existed file? HOT 3
- Is it possible to extract audio from Stream? HOT 1
- Hide logs in console HOT 10
- Is there a way to draw waveform from Uint8List directly from buffer ? HOT 3
- Web support HOT 3
- Question: Cant follow along with example code HOT 1
- add support window HOT 9
- Waveform from a Stream<Uint8List> HOT 1
- PlatformException(ExtAudioOpenURL error, ExtAudioOpenURL error, null, null) HOT 3
- extract from ipod-library HOT 3
- Frozen on 99% while generating. HOT 5
- How to cancel the waveform processing before done? HOT 2
- Example code load asset error HOT 5
- Align waveform bars to center HOT 1
- PlatformException(ExtAudioOpenURL error, ExtAudioOpenURL error, null, null) HOT 3
- just_audio integration HOT 3
- large mp3 file size error HOT 4
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 just_waveform.