lincollincol / amplituda Goto Github PK
View Code? Open in Web Editor NEWAudio processing library, which provides waveform data
License: Apache License 2.0
Audio processing library, which provides waveform data
License: Apache License 2.0
Issue: This release is not compliant with the Google Play 64-bit requirement.
The following APKs or app bundles are available to 64-bit devices, but they only have 32-bit native code: [19]
Include 64-bit and 32-bit native code in your app. Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code that it needs. This avoids increasing the overall size of your app.
The issue is coming because the native library does not support 64-bit.
Amplituda should process audio files from raw directory
I'm trying to apply waveformSeekBar + Amplituda to my project. Your description is very cool. But i can't run it with mp3 raw folder.
Added:
implementation 'com.github.massoudss:waveformSeekBar:4.1.0'
implementation 'com.github.lincollincol:amplituda:2.1.0' // or newer version
maven { url 'https://jitpack.io' }
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.INTERNET" />
android:extractNativeLibs="false"
<com.masoudss.lib.WaveformSeekBar
android:id="@+id/waveformSeekBar"
android:layout_width="match_parent"
android:layout_height="@dimen/_50sdp"
android:layout_marginStart="@dimen/_12sdp"
android:layout_marginTop="@dimen/_4sdp"
android:layout_marginEnd="@dimen/_12sdp"
android:layout_marginBottom="@dimen/_4sdp"
app:wave_background_color="@color/colorAccent"
app:wave_corner_radius="2dp"
app:wave_gap="2dp"
app:wave_gravity="center"
app:wave_max_progress="100"
app:wave_min_height="5dp"
app:wave_progress="33"
app:wave_progress_color="@color/colorPrimary"
app:wave_width="5dp" />
waveformSeekBar.setSampleFrom(R.raw.test_audio)
And i got this error:
java_vm_ext.cc:577] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception java.lang.NoSuchFieldError: no "Ljava/lang/String;" field "amplitudes" in class "Llinc/com/amplituda/AmplitudaResultJNI;" or its superclasses
java_vm_ext.cc:577] at linc.com.amplituda.AmplitudaResultJNI linc.com.amplituda.Amplituda.amplitudesFromAudioJNI(java.lang.String) (Amplituda.java:-2)
java_vm_ext.cc:577] at linc.com.amplituda.AmplitudaResultJNI linc.com.amplituda.Amplituda.c(java.io.File, linc.com.amplituda.e) (Amplituda.java:51)
java_vm_ext.cc:577] at linc.com.amplituda.b linc.com.amplituda.Amplituda.a(int) (Amplituda.java:146)
java_vm_ext.cc:577] at void com.masoudss.lib.d.c.a(android.content.Context, int, f.b0.c.l) (WaveformOptions.kt:17)
java_vm_ext.cc:577] at void com.masoudss.lib.WaveformSeekBar.setSampleFrom(int) (WaveformSeekBar.kt:144)
Are there any changes i need to do more? Or i missed any guideline?
Thank you.
/lib/arm64/libamplituda-native-lib.so (Java_linc_com_amplituda_Amplituda_amplitudesFromAudioJNI+868) (BuildId: 72a4899b05ffbd6f588f1c352f33364c6ef73a9d)
When attempting to load an amplitude of corrupted file AFTER successful processing another non-corrupted one I get uncatchable crash
Describe the bug
A clear and concise description of what the bug is.
Crash by diving to zero
native-lib.cpp at line 340:
nb_frames = (audio_dec_ctx->sample_rate * (int) duration) / audio_dec_ctx->frame_size;
To Reproduce
Steps to reproduce the behavior:
open some .flac, .ogg, .wav file on some devices
Desktop (please complete the following information):
OS: Windows 10
Processor Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz 2.90 GHz
RAM 16.0 GB
Smartphone (please complete the following information):
Describe the bug
Output samples per second is 10 irrespective of the preferredSamplesPerSecond
given
To Reproduce
Steps to reproduce the behavior:
object AudioManager {
private lateinit var amplituda: Amplituda
fun getAmplitudes(context: Context, audioFilePath: String): Pair<List<Int>, Long> {
if (!::amplituda.isInitialized) {
amplituda = Amplituda(context)
}
var amplitudes = listOf<Int>()
var duration = 0L
amplituda.processAudio(audioFilePath, Compress.withParams(Compress.AVERAGE, 50))
.get({
amplitudes = it.amplitudesAsList()
Log.d("TAG", "getAmplitudes: ${it.amplitudesForSecond(1).size}")
duration = it.getAudioDuration(AmplitudaResult.DurationUnit.MILLIS)
}, { e ->
Log.e("AudioManager::", "getAmplitudes: ", e)
})
return Pair(amplitudes, duration)
}
}
Expected behavior
Expected Log: getAmplitudes: 50
Screenshots
If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Hi there.
Would it be possible to have the sampling rate as a parameter we can set?
We might not need that many values. We can then do a sampling of the result but that's extra work twice: Extra sampling calculation of the audio, then the averaging of slices of the results.
Thanks.
Crash after processing +-200 000 audio frames. Out Of Memory from ndk side: allocations more than frees.
Reproduce:
Log:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: '----------------<device info>--------------------'
Revision: '0'
ABI: 'arm64'
Timestamp: 2021-06-03 11:15:50+0300
pid: 4419, tid: 7587, name: Jit thread pool >>> com.package :) <<<
uid: 10644
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'Checked call failed for Cache -W: Out of memory'
x0 0000000000000000 x1 0000000000001da3 x2 0000000000000006 x3 0000006d01e49840
x4 fefefefefefefeff x5 fefefefefefefeff x6 fefefefefefefeff x7 7f7f7f7f7f7f7f7f
x8 00000000000000f0 x9 ae606bf175777b97 x10 0000000000000000 x11 ffffffc0fffffbdf
x12 0000000000000001 x13 0000000060b88fb5 x14 001d24993afd8885 x15 0000a1cf56fef6e4
x16 0000007057814c80 x17 00000070577f6b70 x18 0000006d019fe000 x19 0000000000001143
x20 0000000000001da3 x21 00000000ffffffff x22 0000007057817f28 x23 0000006d01e499b0
x24 0000006d01e49970 x25 0000000000010000 x26 0000006d01e49c58 x27 0000000000020800
x28 00000070525fe000 x29 0000006d01e498c0
lr 00000070577aa3e0 sp 0000006d01e49820 pc 00000070577aa40c pst 0000000000000000
backtrace:
#00 pc 000000000004e40c /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 07fbaeed7b7a19203975f06be6f1d5ef)
#01 pc 000000000004b10c /system/lib64/libc++.so (abort_message+248) (BuildId: da087bc6aeeb87276326ccdef0342b02)
#02 pc 000000000004b2d0 /system/lib64/libc++.so (demangling_terminate_handler()+212) (BuildId: da087bc6aeeb87276326ccdef0342b02)
#03 pc 000000000004bdc4 /system/lib64/libc++.so (std::__terminate(void (*)())+12) (BuildId: da087bc6aeeb87276326ccdef0342b02)
#04 pc 000000000004b4e0 /system/lib64/libc++.so (__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)+28) (BuildId: da087bc6aeeb87276326ccdef0342b02)
#05 pc 000000000004b448 /system/lib64/libc++.so (__cxa_throw+112) (BuildId: da087bc6aeeb87276326ccdef0342b02)
#06 pc 000000000004ebb4 /system/lib64/libc++.so (operator new(unsigned long)+96) (BuildId: da087bc6aeeb87276326ccdef0342b02)
#07 pc 0000000000098244 /system/lib64/libc++.so (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__grow_by_and_replace(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, char const*)+156) (BuildId: da087bc6aeeb87276326ccdef0342b02)
#08 pc 0000000000098148 /system/lib64/libc++.so (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)+100) (BuildId: da087bc6aeeb87276326ccdef0342b02)
#09 pc 00000000000105ec /system/lib64/libbase.so (android::base::ReadFdToString(android::base::borrowed_fd, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+192) (BuildId: c232dee8f1f12bb33a7ae92577018c6b)
#10 pc 00000000000106ec /system/lib64/libbase.so (android::base::ReadFileToString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool)+192) (BuildId: c232dee8f1f12bb33a7ae92577018c6b)
#11 pc 0000000000046e9c /system/lib64/libunwindstack.so (unwindstack::Maps::Parse()+112) (BuildId: 9b25b9636f7d10afdb7a7db8403c58b7)
#12 pc 000000000000e5f4 /system/lib64/libbacktrace.so (UnwindStackMap::Build()+532) (BuildId: 278b315fedbefacf5bd5b5bbce725e7e)
#13 pc 000000000000ea8c /system/lib64/libbacktrace.so (BacktraceMap::Create(int, bool)+128) (BuildId: 278b315fedbefacf5bd5b5bbce725e7e)
#14 pc 00000000005c2140 /apex/com.android.art/lib64/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool)+236) (BuildId: b47cec4ad6c3c9e2d6d62285761cf063)
#15 pc 000000000055d440 /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+1864) (BuildId: b47cec4ad6c3c9e2d6d62285761cf063)
#16 pc 0000000000013be4 /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76) (BuildId: c232dee8f1f12bb33a7ae92577018c6b)
#17 pc 0000000000012fb4 /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+320) (BuildId: c232dee8f1f12bb33a7ae92577018c6b)
#18 pc 000000000035049c /apex/com.android.art/lib64/libart.so (void art::CheckedCall<int (void*, unsigned long, int), unsigned char*, unsigned long, int>(int const(&)(void*, unsigned long, int), char const*, unsigned char*, unsigned long, int)+212) (BuildId: b47cec4ad6c3c9e2d6d62285761cf063)
#19 pc 000000000034b4e8 /apex/com.android.art/lib64/libart.so (art::jit::JitCodeCache::Reserve(art::Thread*, art::jit::JitMemoryRegion*, unsigned long, unsigned long, unsigned long, art::ArtMethod*, art::ArrayRef<unsigned char const>*, art::ArrayRef<unsigned char const>*)+696) (BuildId: b47cec4ad6c3c9e2d6d62285761cf063)
#20 pc 00000000001f8f18 /apex/com.android.art/lib64/libart-compiler.so (art::OptimizingCompiler::JitCompile(art::Thread*, art::jit::JitCodeCache*, art::jit::JitMemoryRegion*, art::ArtMethod*, bool, bool, art::jit::JitLogger*)+1352) (BuildId: 1dc2b0f23e4b4908cc3017d42cb6a4e6)
#21 pc 0000000000112dd4 /apex/com.android.art/lib64/libart-compiler.so (art::jit::JitCompiler::CompileMethod(art::Thread*, art::jit::JitMemoryRegion*, art::ArtMethod*, bool, bool)+232) (BuildId: 1dc2b0f23e4b4908cc3017d42cb6a4e6)
#22 pc 0000000000339c30 /apex/com.android.art/lib64/libart.so (art::jit::Jit::CompileMethod(art::ArtMethod*, art::Thread*, bool, bool, bool)+992) (BuildId: b47cec4ad6c3c9e2d6d62285761cf063)
#23 pc 0000000000341de8 /apex/com.android.art/lib64/libart.so (art::jit::JitCompileTask::Run(art::Thread*)+668) (BuildId: b47cec4ad6c3c9e2d6d62285761cf063)
#24 pc 00000000005ca6cc /apex/com.android.art/lib64/libart.so (art::ThreadPoolWorker::Run()+108) (BuildId: b47cec4ad6c3c9e2d6d62285761cf063)
#25 pc 00000000005ca1c0 /apex/com.android.art/lib64/libart.so (art::ThreadPoolWorker::Callback(void*)+192) (BuildId: b47cec4ad6c3c9e2d6d62285761cf063)
#26 pc 00000000000b0048 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64) (BuildId: 07fbaeed7b7a19203975f06be6f1d5ef)
#27 pc 00000000000503c8 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 07fbaeed7b7a19203975f06be6f1d5ef)
Describe the bug
I have a json which contains the URL of the audio file, right now this is sample URL, when passed as string object it doesn't process the result.
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
Url should load the amplitudes
Screenshots
Smartphone
First of all, thank you for this beautiful library!
I tried to use this library to get wave forms from an MP4 audio file, that was recorded using android AudMediaRecorder.
However, the callback was never called, I thought it was calculating some stuff, but I understood the problem when I started reading the source code.
I wasted sometime to figure that out because i thought if there is something wrong the library will just throw since there is no error handler.
It would be amazing if the library threw exceptions on errors or just returned a callback with a throwable.
Describe the bug
When we used ffmpeg-kit with 'amplituda' then it give to error for the duplicate file path when merging native libs. Also, i am trying to 'packagingOptions' option but have not succeeded.
Screenshots
Execution failed for task ':app:mergeDebugNativeLibs'.
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
2 files found with path 'lib/arm64-v8a/libavcodec.so' from inputs:
- /Users/krunal.kevadiya/.gradle/caches/transforms-3/73e9ddb87dcbcf7f33e4d77e2fff8606/transformed/jetified-Amplituda-1.3/jni/arm64-v8a/libavcodec.so
- /Users/krunal.kevadiya/.gradle/caches/transforms-3/a4e37ee8cddd722ecef5cfd1c70207be/transformed/jetified-ffmpeg-kit-full-4.5/jni/arm64-v8a/libavcodec.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
Smartphone (please complete the following information):
dependencies {
implementation 'com.arthenica:ffmpeg-kit-full:4.5'
implementation 'com.github.massoudss:waveformSeekBar:4.1.0'
implementation 'com.github.lincollincol:Amplituda:2.1.2'
}
Amplituda calls should be more logical. For example amplitudesAs*() should be called after fromFile() and optional config calls.
The solution to this problem can be a "Builder" pattern or return type as a polymorphism with different interfaces
I believe this is bug to use common name like this as if other library use it as well you have to fork one and edti manualy to be able to use both in same project. It happened to me so just a suggestion/bug to improve project ;)
java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.example.chat/files/Documents/amplituda_tmp_values.txt (No such file or directory)
There is a problem that a library doesn't work when you start several files at once in the background thread getSampleFrom.
It works for a single file. But with multiple files it doesn't((
Is it possible to fix it somehow?
WaveformOptions.getSampleFrom(file.path) {
waves = it
}
I am now getting the following error in the latest 2.2.1. I have FFMPEGKit in the project as well that I was using to stitch audio files together as 3gp. The last version before the fix to prevent the library conflicts (2.1.4) can read the created audio files fine, but the latest version can't, as I am getting the error in the title. I was wondering if it is because there is a different version of ffmpeg used?Is there a way to use the older ffmpeg files from 2.1.4 and rename them? Or should I be looking at something else? I would stay with using amplituda 2.1.4, but it cannot run alongside ffmpegkit. I have to disable one to test the other.
I have used this library in my application. and it's working fine.
But there is no way to get progressive/countdown time to when the process will be completed.
It is taking longer to get amplitudes for the large audio files. and in that case, I want to show the percentage of the completed process for a better user experience.
It will be a rock if you can provide this feature in the same library.
Convert WAV(pcm_s16le) to mp3 (mp3float) using FFmpeg. The current implementation is using mp3lame for this function.
int process_audio(...)
- function with lame code.
Hello! I tried to use your lib. And I already have com.arthenica:mobile-ffmpeg-audio:4.4
When I use methods from mobile-ffmpeg-audio I receive this error. Is there any solution to fix this?
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "avpriv_init_elbg" referenced by "/data/app/~~mK1tfWTxMEGBmWk7nu8qVQ==/com.example-WGGQ2aG-lMJ1UI7bi6lsqA==/base.apk!/lib/arm64-v8a/libavfilter.so"...
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.arthenica.mobileffmpeg.Config.<clinit>(Config.java:133)
at com.arthenica.mobileffmpeg.Config.ffmpegExecute(Config.java:623)
at com.arthenica.mobileffmpeg.FFmpeg.execute(FFmpeg.java:68)
Thanks in advance
Hi.
Can't get a specific number of amplitudes ?
For example, whether the audio file is 1 minute or 10 minutes, let's get 60 .
In new android versions, WRITE_EXTERNAL_STORAGE is not available and Amplituda won't work without this permission.
Issue is with temporaryAmplitudaDataFile. We could use:
context.getCacheDir()
instead of
context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS)
This is a better solution as temp files by design should go to the internal cache folder.
This also doesn't require any READ or WRITE permissions.
Also, you can make a setter for temporaryAmplitudaDataFile so developers can choose between temp file directories.
Describe the bug
Smartphone (please complete the following information):
W/System.err: Read Amplituda doc here: https://github.com/lincollincol/Amplituda
W/System.err: at linc.com.amplituda.AmplitudaResultJNI.getExceptionFromCode(AmplitudaResultJNI.java:94)
W/System.err: at linc.com.amplituda.AmplitudaResultJNI.getErrors(AmplitudaResultJNI.java:74)
W/System.err: at linc.com.amplituda.AmplitudaProcessingOutput.(AmplitudaProcessingOutput.java:32)
W/System.err: at linc.com.amplituda.Amplituda.processAudio(Amplituda.java:80)
W/System.err: at linc.com.amplituda.Amplituda.processAudio(Amplituda.java:33)
W/System.err: at com.volio.vn.ui.audio.local.yourPhone.MusicOnPhoneEvent$buildModels$1$1$1.invoke(MusicOnPhoneEvent.kt:48)
W/System.err: at com.volio.vn.ui.audio.local.yourPhone.MusicOnPhoneEvent$buildModels$1$1$1.invoke(MusicOnPhoneEvent.kt:47)
W/System.err: at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)
Describe the bug
I have a chash, when I generate wave:
Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x3c in tid 3546 (DefaultDispatch), pid 3481 xxxx
crash_dump64 A #1 pc 0000000000070df4 /data/app/com.xxxx.android-R6ols2eWjmjo4OxXw7PH2Q==/lib/arm64/libavcodec-amplituda.so
To Reproduce
My code abowe:
waveSeekBar.setSampleFrom(file)
Smartphone (please complete the following information):
Huawey p10, android 9
Samsung A52, android 13
Hey there. I have a problem and I think it's related to my code. But I'm not sure and I need to ask:
The following code is setting an on long click listener for an ImageButton
. The newWaveForm
is the result of the processed array from amplituda.
npa_pause_ib.setOnLongClickListener {
val newWaveForm =
Amplituda(this).processAudio(SiQueue.getTrackToPlay().path).get().amplitudesAsList()
.toIntArray()
if (newWaveForm.isNotEmpty()) {
SiQueue.defaultSamples = newWaveForm
npa_sb.setSampleFrom(SiQueue.defaultSamples)
} else {
Toast.makeText(this, "Something went wrong!", Toast.LENGTH_SHORT).show()
Log.e(TAG, "The result of Amplituda is empty.")
Log.d(TAG, SiQueue.getTrackToPlay().toString())
}
true
}
2022-02-18 15:07:16.608 23906-23906/davoodi.mahdi.sievere E/NowPlayingActivity: The result of Amplituda is empty.
2022-02-18 15:07:16.608 23906-23906/davoodi.mahdi.sievere D/NowPlayingActivity: Track(context=davoodi.mahdi.sievere.activities.IntroActivity@a064f9d, id=27, uri=content://media/external/audio/media/27, path=/storage/18FF-1F12/Music/02 Mansionair - Alibi.mp3, fileName=02 Mansionair - Alibi.mp3, setTitle=Alibi, setArtist=Mansionair, setAlbum=Shadowboxer)
The problem is: in devices that are running Android 10, the result is always empty.
I've tested this with the exact same file on 8 devices. I only have this problem with Android 10.
How can I solve this?
Thank you.
Describe the bug
On Samsung Glaxy Tablet, it just crashed as didide by zero. but on huawei p40 phone is ok.
Expected behavior
No Crash
Smartphone (please complete the following information):
Additional context
log shows preferred_frames_per_second is zero(line 397), so I add extra condition in if case(line 387):
Amplituda should process audio asynchronous.
Current sequentially implementation: 10 audios => +-15 sec
Desired implementation: 10 audios => +-5 sec
I am recording audio files through android using the MediaRecorder. When I try to process the audio file i get the following error:
"linc.com.amplituda.exceptions.processing.CodecNotFoundException: Failed to find codec!"
I have a feature where I have to record an audio using Mic which is implemented by using MediaRecorder and it only output file format for .3gp as there is no encoder for .mp3 file to we have to specify the output format in .3gp.
so when passed this file path it does not create the amplitude for it. I'm using this library with waveformseekbar library in Android.
Amplituda provides only extracted audio data and compress(custom number of samples)/cache features.
Here are some instructions, which help you draw a flexible waveform:
Canvas size - the area in which the wave will be drawn (width
and height
in px
).
You can find an android view example here or a jetpack compose example here.
Single spike size - sum of desired spike width and padding (width
and paddings
in px
).
Most likely desired width and padding will be specified by the user via function parameters or view attrs.
spike width
= desired spike width
+ desired spike paddings
.
Spikes
per canvas width - number of spikes that canvas can accommodate.
spikes
= canvas width
/ single spike size
Samples
(or amplitudes
) - list of average samples for each spike. You should divide the original amplitudes list into chunks and then average each chunk. Finally, you get average samples for each spike of your amplitude.
Kotlin "pseudocode"
):val amplitudesList: List<Int> = Amplituda(context).process(...).amplitudesAsList()
val desiredSpikeWidth: Float = 4.px
val desiredSpikePadding: Float = 2.px
val canvas: Canvas = /* init canvas */
val singleSpikeWidth: Float = desiredSpikeWidth + desiredSpikePadding
val spikesPerCanvas: Int = canvas.width / singleSpikeWidth
val amplitudePerSpikeList: List<Float> = amplitudesList
.chunked(amplitudesList.count() / spikesPerCanvas)
.map { it.average() }
amplitudePerSpikeList.forEachIndexed { spikeIndex, spikeHeight ->
drawRoundRect(
brush = waveformBrush,
topLeft = Offset(
x = spikeIndex * singleSpikeWidth,
y = canvas.height / 2F - spikeHeight / 2F // Center spikes
),
size = Size(
width = singleSpikeWidth,
height = spikeHeight
)
)
}
Compose
. I have recently created AudioWaveform library for Jetpack Compose which is compatible with Amplituda. I used the instructions described above to draw the waveform. So, you can check the full code here.XML
. If you're looking for an android View
implementation, you can take a look at WaveformSeekBar, which is also compatible with Amplituda.When an audio file contains few streams, Amplituda produces empty result.
Example:
Stream 0: audio data
Stream 1: preview image
. . .
Stream n: . . .
If I pick audio and have content uri instead of file uri then how to process that?
I am building a chat module. So whenever I send an audio in the chat and the recyclerview adapter is refreshed, It crashes on
mBinding?.waveform?.setSampleFrom(file_path)
in the adapter. It also crashes randomly sometimes when there are a lot of audio messages as well. It gives the following exception
W/System.err: linc.com.amplituda.exceptions.processing.PacketSubmittingException: Error submitting a packet for decoding!
I would really appreciate some help here.
I am using
implementation 'com.github.lincollincol:amplituda:2.2.2'
implementation 'com.github.massoudss:waveformSeekBar:5.0.2'
Hi,
I am using this library to display waveform from an mp3 file.
Amplituda amplituda = new Amplituda(getContext()); amplituda.fromPath(audioFile.getPath()) .amplitudesAsList(list -> { waveFormSeekbar.setSample(ArrayUtils.toPrimitiveArray(list)); });
But its crashing. And in logs only this line is getting printed.
A/libc: FORTIFY: fprintf: null FILE*
A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 3330
Describe the bug
There is a runtime crash when calling processAudio
with a raw resource, observed in version 2.2.0:
val amplituda = Amplituda(applicationContext)
amplituda.processAudio(R.raw.<resource-here>) // crash
I have a minimal branch for reproducing the issue: travismacdonald/transcribe#1
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Actual behavior
2022-08-29 09:15:06.817 28037-28037/? A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x60 in tid 28037 (apps.transcribe), pid 28037 (apps.transcribe)
2022-08-29 09:15:06.827 2613-3390/? I/BtGatt.ScanManager: msg.what = 6
2022-08-29 09:15:06.828 1565-1565/? W/Looper: Drained
2022-08-29 09:15:06.902 1565-1579/? I/system_server: Background concurrent copying GC freed 409153(24MB) AllocSpace objects, 23(652KB) LOS objects, 32% free, 49MB/73MB, paused 532us total 390.724ms
2022-08-29 09:15:06.942 28078-28078/? I/crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
2022-08-29 09:15:06.943 841-841/? I/tombstoned: received crash request for pid 28037
2022-08-29 09:15:06.944 28078-28078/? I/crash_dump64: performing dump of process 28037 (target tid = 28037)
2022-08-29 09:15:06.949 1565-1582/? W/System: A resource failed to call release
2022-08-29 09:15:06.957 28078-28078/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-08-29 09:15:06.957 28078-28078/? A/DEBUG: Build fingerprint: 'TCL/T773O/Miami_Pro:11/...'
2022-08-29 09:15:06.957 28078-28078/? A/DEBUG: Revision: '0'
2022-08-29 09:15:06.957 28078-28078/? A/DEBUG: ABI: 'arm64'
2022-08-29 09:15:06.958 28078-28078/? A/DEBUG: Timestamp: 2022-08-29 09:15:06-0300
2022-08-29 09:15:06.959 28078-28078/? A/DEBUG: pid: 28037, tid: 28037, name: apps.transcribe >>> com.cannonballapps.transcribe <<<
2022-08-29 09:15:06.959 28078-28078/? A/DEBUG: uid: 10412
2022-08-29 09:15:06.959 28078-28078/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x60
2022-08-29 09:15:06.959 28078-28078/? A/DEBUG: Cause: null pointer dereference
2022-08-29 09:15:06.961 28078-28078/? A/DEBUG: x0 0000007ff247a920 x1 000000754b62db28 x2 0000000000000058 x3 0000000000000010
2022-08-29 09:15:06.961 28078-28078/? A/DEBUG: x4 b4000075b07d7e98 x5 00000075b8e015c8 x6 6f1f646b68651f60 x7 7f7f7f7f7f7f7f7f
2022-08-29 09:15:06.961 28078-28078/? A/DEBUG: x8 0000000000000000 x9 ffffff80ffffffd0 x10 0000007ff247a7d0 x11 0000000000000001
2022-08-29 09:15:06.961 28078-28078/? A/DEBUG: x12 00000075b8e001b0 x13 0000007ff247851b x14 000000763aa55be2 x15 0000000000000048
2022-08-29 09:15:06.961 28078-28078/? A/DEBUG: x16 000000754b63bc60 x17 000000763aa3e8a0 x18 0000007640006000 x19 0000007ff247a920
2022-08-29 09:15:06.961 28078-28078/? A/DEBUG: x20 000000754b62db28 x21 000000763ef4e000 x22 0000000000000085 x23 0000000000001864
2022-08-29 09:15:06.961 28078-28078/? A/DEBUG: x24 000000763ef4e000 x25 0000007ff247a944 x26 0000000000000000 x27 0000000000000000
2022-08-29 09:15:06.961 28078-28078/? A/DEBUG: x28 b4000075b087ebb0 x29 0000007ff247a7a0
2022-08-29 09:15:06.961 28078-28078/? A/DEBUG: lr 000000754b60c63c sp 0000007ff247a680 pc 000000763aa3e924 pst 0000000020000000
Smartphone (please complete the following information):
Additional context
The issue is not present on version 2.1.6
Happy to provide any info you need!
Describe the bug
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getPath()' on a null object reference
at linc.com.amplituda.FileManager.(SourceFile:19)
at linc.com.amplituda.Amplituda.(SourceFile:6)
To Reproduce
This happens in some devices
FileManager(final Context context) {
resources = context.getResources();
cache = context.getExternalCacheDir()
.getPath() + File.separator;
}
context.getExternalCacheDir() returns null
Expected behavior
no crash happens
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
Describe the bug
I am developer of Android chat application, and I tried to use WaveformSeekBar library to process audio files. This library uses this library. When I was processing multiple audio files in the same time, the app crashed. Stacktrace is here:
so it looks like there is some issue in native code libavcodec-amplituda.so
. Can you please help with this?
Other useful information:
@lincollincol I ran into a similar error. The problem is not with the audio, but with how the processing is done. If Amplitude is accessed in a loop, in several threads, a similar situation arises.
I tried the above code as you advised, getting below error
Failed to convert to modern format file descriptor java.io.IOException: Input file descriptor already original at android.provider.MediaStore.getOriginalMediaFormatFileDescriptor(MediaStore.java:943) at android.os.FileUtils.convertToModernFd(FileUtils.java:1470) at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:304) at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:250) at linc.com.amplituda.FileManager.getAudioDuration(FileManager.java:58) at linc.com.amplituda.Amplituda.processFileJNI(Amplituda.java:54) at linc.com.amplituda.Amplituda.processAudio(Amplituda.java:83)
Now I process the received audio sequentially and everything works without the errors described above, however, due to the sequential execution, I ran into a processing time problem - even with compression, it takes a long time
Originally posted by @UnateD in #21 (comment)
Hi. I see crash at the Firebase:
Fatal Exception: java.lang.NumberFormatException: For input string: "duration=1.724082"
at java.lang.Integer.parseInt(Integer.java:615)
at java.lang.Integer.valueOf(Integer.java:801)
at linc.com.amplituda.AmplitudaResult.amplitudesAsList(AmplitudaResult.java:65)
.....
Problem file below:
https://drive.google.com/file/d/1nnrBq0ghTGa03TDsgCVMjjQ9VM_hicnN/view?usp=sharing
Smartphone (please complete the following information):
Android 10, Honor 20 PRO
Hi.
Can you give a number between (float) 0 and 1?
I need to know the max value return.
I has an issue when process long mp3 file (over 1 hour) download from youtube via (https://www.y2mate.com/). Please take a look.
Hi, excuse me, does Amplituda project's ffmpeg can compile for ios? Thank you so much for your help.🤝
why result is very low decibel level in all sounds ?
(I can't make anything with this data)
how to get waveform normalize?
this ffmpeg command takes the correct waveform from the audio :
-filter_complex showwavespic -frames:v
but amplituda not get currect.
What should I do?
It looks like wav format always returns list of integers with all values 127.
Steps to reproduce the behavior:
Expected behavior
It should work as same as mp3 does with propper waveform
First of all, thank you for providing a very nice library!
During a security review, it was noted that the Amplituda native libraries could be susceptible to a stack smashing attack.
It is possible to build in protection against this by adding some compiler flags. Specifically by adding the complier flags: -fstack-protector-all
, -fpic
, and -fstack-protector-strong
.
Our ask: Create a new release of Amplituda with the native c/c++ code compiled with the above flags.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.