polochon-street / bliss Goto Github PK
View Code? Open in Web Editor NEWBliss music library that can compute distance between songs
Home Page: https://lelele.io/bliss_old.html
License: MIT License
Bliss music library that can compute distance between songs
Home Page: https://lelele.io/bliss_old.html
License: MIT License
Hi,
I got some segfault on a MP3 song using Bliss (analyze.c
provided example). Here is coredump:
% coredumpctl gdb ±[master]
PID: 20127 (analyze)
UID: 1000 (phyks)
GID: 1000 (phyks)
Signal: 11 (SEGV)
Timestamp: dim. 2016-04-17 20:23:40 CEST (5s ago)
Command Line: ../build/bliss/analyze /home/phyks/Musique/good/Oomph!/2004 - OOMPH!/01 - Mein Herz.mp3
Executable: /home/phyks/MPDBliss/build/bliss/analyze
Control Group: /user.slice/user-1000.slice/session-c16.scope
Unit: session-c16.scope
Slice: user-1000.slice
Session: c16
Owner UID: 1000 (phyks)
Boot ID: 47a59b84f28049fba325b241666f3e0a
Machine ID: 0d3e7eb4bfec4ebab0d2b4335b90a327
Hostname: desktop
Coredump: /var/lib/systemd/coredump/core.analyze.1000.47a59b84f28049fba325b241666f3e0a.20127.1460917420000000000000.lz4
Message: Process 20127 (analyze) of user 1000 dumped core.
Stack trace of thread 20127:
#0 0x00007f5ae2bd5bd3 bl_audio_decode (libbliss.so)
#1 0x00007f5ae2bd6cf1 bl_analyze (libbliss.so)
#2 0x0000000000400956 main (analyze)
#3 0x00007f5ae05c6710 __libc_start_main (libc.so.6)
#4 0x0000000000400819 _start (analyze)
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/phyks/MPDBliss/build/bliss/analyze...done.
[New LWP 20127]
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `../build/bliss/analyze /home/phyks/Musique/good/Oomph!/2004 - OOMPH!/01 - Mein'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f5ae2bd5bd3 in bl_audio_decode (filename=0x7ffecfaf2703 "/home/phyks/Musique/good/Oomph!/2004 - OOMPH!/01 - Mein Herz.mp3", song=0x7ffecfaf0a40)
at /home/phyks/MPDBliss/bliss/src/decode.c:265
265 *p = ((int8_t*)(decoded_frame->extended_data[j]))[i + k];
I can send you the MP3 file by email if you want.
Thanks
Hi,
When an error occur in the bl_analyze
function, one may like to recover and free the struct.
Typically,
if (BL_UNEXPECTED == bl_analyze(song_full_uri, &song_analysis)) {
fprintf(stderr, "Error while parsing song: %s.\n\n", song_full_uri);
// Free song analysis
bl_free_song(&song_analysis);
}
But bl_free_song
will fail with a segfault if the BL_UNEXPECTED
was launch due to a file which cannot be found. So, I guess we should either distinguish two types of errors, or make bl_free_song
safe to use on a not-allocated song? Or state it somewhere in the doc?
I may have missed something.
Thanks!
Does Bliss still works if we apply ReplayGain on the files? Just wondering at the moment :)
Hi,
$ sudo make install
$ gcc -o example example.c -lbliss
Does not work (at least on Fedora):
/tmp/MPDBliss/bliss/include/bliss.h:5:34: erreur fatale : libavformat/avformat.h : Aucun fichier ou dossier de ce type
compilation terminée.
Hi,
Tests are failing on Debian/buster (20/03/2019).
Building with:
I Had to patch the values in order to pass the tests.
--- a/tests/test_analyze.c
+++ b/tests/test_analyze.c
@@ -31,12 +31,12 @@
struct bl_song song;
bl_analyze("../audio/song.mp3", &song);
- assert_floateq(song.force, -1.349859);
+ assert_floateq(song.force, -1.284405);
- assert_floateq(song.force_vector.tempo, -0.110247);
- assert_floateq(song.force_vector.amplitude, 0.197553);
- assert_floateq(song.force_vector.frequency, -1.547412);
- assert_floateq(song.force_vector.attack, -1.621171);
+ assert_floateq(song.force_vector.tempo, -0.378798);
+ assert_floateq(song.force_vector.amplitude, 0.262785);
+ assert_floateq(song.force_vector.frequency, -1.547190);
+ assert_floateq(song.force_vector.attack, -1.207954);
assert_eq(song.channels, 2);
assert_eq(song.nSamples, 12508554);
I'm using ubuntu 14.04 which is Canonical's 5 year supports o/s
Unfortunately I cannot compile this under the o/s due to the older libraries available.
The projects CMake dependency is slated to be 3.0 or later :(
if I add this diff I can start compiling...
diff --git a/CMakeLists.txt b/CMakeLists.txt index bbdaf61..5a27b7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 2.8) project(bliss C) @@ -9,7 +9,7 @@ pkg_check_modules(MULTIMEDIA REQUIRED libavformat libavutil liba include_directories(${MULTIMEDIA_INCLUDE_DIRS} include/) link_directories(${MULTIMEDIA_LIBRARY_DIRS}) add_definitions(${MULTIMEDIA_CFLAGS_OTHER}) -add_definitions(-Wall -Wno-long-long -pedantic) +add_definitions(-Wall -Wno-long-long -std=c99) ##################################### # Bliss target to build the library #
This then complains about the use of M_PI ... so I've applied this patch:
diff --git a/src/frequency_sort.c b/src/frequency_sort.c index 2487375..a51b4be 100644 --- a/src/frequency_sort.c +++ b/src/frequency_sort.c @@ -2,6 +2,10 @@ #include #include "bliss.h" +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + // Number of bits in the FFT, log2 of the length #define WIN_BITS 9 // Length of the samples used in FFT
... this gets me down to these errors:
Linking C executable analyze libbliss.so: undefined reference to `av_frame_unref' libbliss.so: undefined reference to `av_frame_alloc' libbliss.so: undefined reference to `av_frame_free' collect2: error: ld returned 1 exit status make[2]: *** [analyze] Error 1 make[1]: *** [CMakeFiles/analyze.dir/all] Error 2 make: *** [all] Error 2
I presume I'm missing linking against one of the libav libraries? - am I using too old a libav library or am I missing an explicit link in my library linking?
It would be interesting to use aubio to extract features from the songs to be compared.
aubio provides standard implementations of several features which are thoroughly used in academic research, and as well as in a large number of music softwares.
aubio runs on most architectures, can be built to use ffmpeg or libav, as well a fftw3, and has python bindings which are ... fast.
See also aubio on github.
cheers, piem
The README says that the version is 1.2.0 but there's no tag.
have the raw stats in the struct is ok for a single song.
However I'm thinking of using this for another media player like rhythmbox.
On its own the individual values don't make much sense to end-users - leleplayer's "calm" and "loud" filters do.
Maybe expose analyze.c functions in leleplayer here in bliss? - looking at the code of analyze.c - perhaps looks needs the native C variant rather than trying to recode analyze in python (python plugin for rhythmbox)
Hi,
Do you think it could be possible to switch off the verbose output from ffmpeg when calling bl_analyze
? (and eventually provide a verbose
option to reenable it, if it can be of any use)
Thanks
Hi,
what is the status of this project ?
Looking at the commit history it looks stall.
Cheers
k
In the PKGBUILD in the Dependecies list you have a "," (comma) seperating the FFMpeg dep and the cmake dep. The "comma" needs to be removed as it forces the package to attemp to find an alternate FFMpeg that doesn't exist. removing the "comma" fixes the issue and it accepts the default FFMpeg install.
Just a heads up, and btw nicly done!
killhellokitty-
Got the following error when installing the python bindings ... note - I've had a guess here since the README appears not to have the installation instructions.
I presume python_cffi is a dependency? - or should it be python3_cffi ?
@Phyks - any thoughts?
Looking at the bottom of the trace - is this a similar issue as #8 where those libav function calls are the older names?
dad:~/.../bliss/python$python setup.py install Traceback (most recent call last): File "setup.py", line 22, in install_requires=["cffi>=1.0.0"], File "/usr/lib/python2.7/distutils/core.py", line 111, in setup _setup_distribution = dist = klass(attrs) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 243, in __init__ _Distribution.__init__(self,attrs) File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__ self.finalize_options() File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 277, in finalize_options ep.load()(self, ep.name, value) File "/home/dad/Downloads/bliss/python/cffi-1.3.1-py2.7-linux-x86_64.egg/cffi/setuptools_ext.py", line 161, in cffi_modules add_cffi_module(dist, cffi_module) File "/home/dad/Downloads/bliss/python/cffi-1.3.1-py2.7-linux-x86_64.egg/cffi/setuptools_ext.py", line 48, in add_cffi_module execfile(build_file_name, mod_vars) File "/home/dad/Downloads/bliss/python/cffi-1.3.1-py2.7-linux-x86_64.egg/cffi/setuptools_ext.py", line 24, in execfile exec(code, glob, glob) File "./bliss/build_bliss.py", line 18, in ffi.cdef(header) File "/home/dad/Downloads/bliss/python/cffi-1.3.1-py2.7-linux-x86_64.egg/cffi/api.py", line 107, in cdef self._parser.parse(csource, override=override, packed=packed) File "/home/dad/Downloads/bliss/python/cffi-1.3.1-py2.7-linux-x86_64.egg/cffi/cparser.py", line 243, in parse self._internal_parse(csource) File "/home/dad/Downloads/bliss/python/cffi-1.3.1-py2.7-linux-x86_64.egg/cffi/cparser.py", line 251, in _internal_parse self._process_macros(macros) File "/home/dad/Downloads/bliss/python/cffi-1.3.1-py2.7-linux-x86_64.egg/cffi/cparser.py", line 327, in _process_macros % (key, key, key, value)) cffi.api.CDefError: only supports one of the following syntax: #define av_frame_unref ... (literally dot-dot-dot) #define av_frame_unref NUMBER (with NUMBER an integer constant, decimal/hex/octal) got: #define av_frame_unref avcodec_get_frame_defaults
as the title says - if you try to decode files one after another, the process produces a segmentation fault.
I've tried a couple of folders each folder full of .ogg files (not sure if that is relevant)
In the example below I am looping through a music album - the process is killed somewhere after processing around the 7th or more ogg file - i.e. it doesnt process the remaining folder contents and thus doesnt get to "wrapped" and the rest of the module
Any thoughts?
import os from bliss import bl_song from time import sleep if __name__ == '__main__': # start 4 worker processes #sleep(30) from os import listdir from os.path import isfile, join #mypath = "/home/dad/Music/Whitney Houston - I'm Your Baby Tonight" mypath = "/home/dad/Music/All Saints - All Saints" onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))] print (onlyfiles) for f in onlyfiles: if "m3u" in f: continue try: fullpath = mypath + "/" + f print ("processing %s" % fullpath) b = bl_song(fullpath) #print (b["force_vector"]) except: pass print ("wrapped")
output:
dad:~/Downloads/dbus$["03 - All Saints - I Know Where It's At.ogg", '04 - All Saints - Under The Bridge.ogg', '02 - All Saints - Bootie Call.ogg', '11 - All Saints - Take The Key.ogg', '12 - All Saints - War Of Nerves.ogg', '08 - All Saints - Trapped.ogg', "07 - All Saints - If You Want To Party (I Found Lovin').ogg", '13 - All Saints - Never Ever (All Star Mix).ogg', '01 - All Saints - Never Ever.ogg', 'All Saints - All Saints.ogg.m3u', '05 - All Saints - Heaven.ogg', '06 - All Saints - Alone.ogg', '09 - All Saints - Beg.ogg', '10 - All Saints - Lady Marmalade.ogg'] processing /home/dad/Music/All Saints - All Saints/03 - All Saints - I Know Where It's At.ogg processing /home/dad/Music/All Saints - All Saints/04 - All Saints - Under The Bridge.ogg processing /home/dad/Music/All Saints - All Saints/02 - All Saints - Bootie Call.ogg processing /home/dad/Music/All Saints - All Saints/11 - All Saints - Take The Key.ogg processing /home/dad/Music/All Saints - All Saints/12 - All Saints - War Of Nerves.ogg processing /home/dad/Music/All Saints - All Saints/08 - All Saints - Trapped.ogg processing /home/dad/Music/All Saints - All Saints/07 - All Saints - If You Want To Party (I Found Lovin').ogg processing /home/dad/Music/All Saints - All Saints/13 - All Saints - Never Ever (All Star Mix).ogg processing /home/dad/Music/All Saints - All Saints/01 - All Saints - Never Ever.ogg processing /home/dad/Music/All Saints - All Saints/05 - All Saints - Heaven.ogg [1]+ Segmentation fault (core dumped) python3 example_crash.py dad:~/Downloads/dbus$
I've compiled bliss with debug symbols (-g) and got a backtrace:
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word". (gdb) handle SIG33 pass nostop noprint Signal Stop Print Pass to program Description SIG33 No No Yes Real-time event 33 (gdb) set pagination 0 (gdb) attach 13027 Attaching to process 13027 Reading symbols from /usr/bin/python3.4...(no debugging symbols found)...done. Reading symbols from /lib/x86_64-linux-gnu/libpthread.so.0...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libpthread-2.19.so...done. done. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Loaded symbols for /lib/x86_64-linux-gnu/libpthread.so.0 Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.19.so...done. done. Loaded symbols for /lib/x86_64-linux-gnu/libc.so.6 Reading symbols from /lib/x86_64-linux-gnu/libdl.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libdl-2.19.so...done. done. Loaded symbols for /lib/x86_64-linux-gnu/libdl.so.2 Reading symbols from /lib/x86_64-linux-gnu/libutil.so.1...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libutil-2.19.so...done. done. Loaded symbols for /lib/x86_64-linux-gnu/libutil.so.1 Reading symbols from /lib/x86_64-linux-gnu/libexpat.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/x86_64-linux-gnu/libexpat.so.1 Reading symbols from /lib/x86_64-linux-gnu/libz.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/x86_64-linux-gnu/libz.so.1 Reading symbols from /lib/x86_64-linux-gnu/libm.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libm-2.19.so...done. done. Loaded symbols for /lib/x86_64-linux-gnu/libm.so.6 Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.19.so...done. done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 Reading symbols from /usr/local/lib/python3.4/dist-packages/Bliss-0.3.0-py3.4-linux-x86_64.egg/bliss/_bliss.cpython-34m.so...done. Loaded symbols for /usr/local/lib/python3.4/dist-packages/Bliss-0.3.0-py3.4-linux-x86_64.egg/bliss/_bliss.cpython-34m.so Reading symbols from /usr/lib/x86_64-linux-gnu/libavformat.so.54...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libavformat.so.54 Reading symbols from /usr/lib/x86_64-linux-gnu/libavutil.so.52...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libavutil.so.52 Reading symbols from /usr/lib/x86_64-linux-gnu/libavcodec.so.54...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libavcodec.so.54 Reading symbols from /usr/lib/x86_64-linux-gnu/libavresample.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libavresample.so.1 Reading symbols from /usr/lib/x86_64-linux-gnu/librtmp.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/librtmp.so.0 Reading symbols from /usr/lib/x86_64-linux-gnu/libgnutls.so.26...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libgnutls.so.26 Reading symbols from /lib/x86_64-linux-gnu/libbz2.so.1.0...(no debugging symbols found)...done. Loaded symbols for /lib/x86_64-linux-gnu/libbz2.so.1.0 Reading symbols from /usr/lib/x86_64-linux-gnu/libxvidcore.so.4...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libxvidcore.so.4 Reading symbols from /usr/lib/x86_64-linux-gnu/libx264.so.142...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libx264.so.142 Reading symbols from /usr/lib/x86_64-linux-gnu/libvpx.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libvpx.so.1 Reading symbols from /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 Reading symbols from /usr/lib/x86_64-linux-gnu/libvorbis.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libvorbis.so.0 Reading symbols from /usr/lib/x86_64-linux-gnu/libtheoraenc.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libtheoraenc.so.1 Reading symbols from /usr/lib/x86_64-linux-gnu/libtheoradec.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libtheoradec.so.1 Reading symbols from /usr/lib/x86_64-linux-gnu/libspeex.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libspeex.so.1 Reading symbols from /usr/lib/x86_64-linux-gnu/libschroedinger-1.0.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libschroedinger-1.0.so.0 Reading symbols from /usr/lib/x86_64-linux-gnu/libopus.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libopus.so.0 Reading symbols from /usr/lib/x86_64-linux-gnu/libopenjpeg.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libopenjpeg.so.2 Reading symbols from /usr/lib/x86_64-linux-gnu/libmp3lame.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libmp3lame.so.0 Reading symbols from /usr/lib/x86_64-linux-gnu/libgsm.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libgsm.so.1 Reading symbols from /usr/lib/x86_64-linux-gnu/libfdk-aac.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libfdk-aac.so.0 Reading symbols from /usr/lib/x86_64-linux-gnu/libva.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libva.so.1 Reading symbols from /lib/x86_64-linux-gnu/libgcrypt.so.11...(no debugging symbols found)...done. Loaded symbols for /lib/x86_64-linux-gnu/libgcrypt.so.11 Reading symbols from /usr/lib/x86_64-linux-gnu/libtasn1.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libtasn1.so.6 Reading symbols from /usr/lib/x86_64-linux-gnu/libp11-kit.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 Reading symbols from /usr/lib/x86_64-linux-gnu/libogg.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libogg.so.0 Reading symbols from /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 Reading symbols from /lib/x86_64-linux-gnu/libgpg-error.so.0...(no debugging symbols found)...done. Loaded symbols for /lib/x86_64-linux-gnu/libgpg-error.so.0 Reading symbols from /usr/lib/x86_64-linux-gnu/libffi.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/x86_64-linux-gnu/libffi.so.6 Reading symbols from /usr/local/lib/python3.4/dist-packages/_cffi_backend.cpython-34m.so...done. Loaded symbols for /usr/local/lib/python3.4/dist-packages/_cffi_backend.cpython-34m.so 0x00007f3306ff2b40 in ?? () from /usr/lib/x86_64-linux-gnu/libavcodec.so.54 (gdb) continue Continuing. Program received signal SIGSEGV, Segmentation fault. bl_audio_decode (filename=, song=song@entry=0x7f3309aac3a8) at ../src/decode_av.c:93 93 song->sample_array[i] = 0; (gdb) backg��[Ktrace full #0 bl_audio_decode (filename=, song=song@entry=0x7f3309aac3a8) at ../src/decode_av.c:93 i = 1 ret = avpkt = {pts = 139857182198896, dts = 9900992, data = 0x7f3302b2f888 "", size = 45464859, stream_index = 32563, flags = 29807632, side_data = 0x4bdea3 , side_data_elems = 162740048, duration = 32563, destruct = 0x7f3302b24e88, priv = 0x7f3309a9a170, pos = 9900992, convergence_duration = 139857065299592} context = 0x2212b60 audio_stream = 0 codec_context = 0x1ed2c00 codec = 0x7f3307435e60 decoded_frame = 0x0 avr_ctx = size = 101592288 tags_dictionary = is_planar = beginning = got_frame = 1 index = #1 0x00007f3307ef877d in bl_analyze (filename=, current_song=0x7f3309aac3a8) at ../src/analyze.c:14 rating = 2.6010304e+32 envelope_result = {tempo = 0, attack = 0} #2 0x00007f3307ef81f9 in _cffi_f_bl_analyze (self=, args=) at build/temp.linux-x86_64-3.4/bliss._bliss.c:526 _save = 0x1c6d410 x0 = 0x7f3302b21498 "/home/dad/Music/All Saints - All Saints/05 - All Saints - Heaven.ogg" x1 = 0x7f3309aac3a8 datasize = result = arg0 = 0x7f3302b21468 arg1 = 0x7f3309abbbd0 #3 0x0000000000518545 in PyEval_EvalFrameEx () No symbol table info available. #4 0x000000000051c29d in PyEval_EvalFrameEx () No symbol table info available. #5 0x00000000004879bf in ?? () No symbol table info available. #6 0x00000000004c05ad in ?? () No symbol table info available. #7 0x00000000004c49a1 in ?? () No symbol table info available. #8 0x00000000004c2ab6 in ?? () No symbol table info available. #9 0x000000000051c577 in PyEval_EvalFrameEx () No symbol table info available. #10 0x0000000000487164 in PyEval_EvalCode () No symbol table info available. #11 0x000000000056be90 in ?? () No symbol table info available. #12 0x000000000047b1c3 in PyRun_FileExFlags () No symbol table info available. #13 0x000000000047b5a0 in PyRun_SimpleFileExFlags () No symbol table info available. #14 0x00000000005c0b33 in Py_Main () No symbol table info available. #15 0x000000000047dbc1 in main () No symbol table info available. (gdb) info registers rax 0x1 1 rbx 0x1ed2c00 32320512 rcx 0x0 0 rdx 0x0 0 rsi 0x20000 131072 rdi 0x60e2d30 101592368 rbp 0x431bde82d7b634db 0x431bde82d7b634db rsp 0x7ffe2ec05230 0x7ffe2ec05230 r8 0x1 1 r9 0x21000 135168 r10 0x22 34 r11 0x201 513 r12 0x0 0 r13 0x60e2ce0 101592288 r14 0x7f3309aac3a8 139857182245800 r15 0x7ffe2ec05278 140729682776696 rip 0x7f3307ef8fe7 0x7f3307ef8fe7 eflags 0x10202 [ IF RF ] cs 0x33 51 ss 0x2b 43 ds 0x0 0 es 0x0 0 fs 0x0 0 gs 0x0 0 (gdb) x/16i $$��[Kpc => 0x7f3307ef8fe7 : movb $0x0,(%rcx,%rdx,1) 0x7f3307ef8feb : mov %eax,%edx 0x7f3307ef8fed : cmp %rdx,%r13 0x7f3307ef8ff0 : ja 0x7f3307ef8fe0 0x7f3307ef8ff2 : mov 0x18(%r14),%rax 0x7f3307ef8ff6 : mov %rax,0x20(%rsp) 0x7f3307ef8ffb : mov 0x1e8(%rbx),%edi 0x7f3307ef9001 : movl $0x0,0x38(%r14) 0x7f3307ef9009 : callq 0x7f3307ef7160 0x7f3307ef900e : mov %eax,0x30(%r14) 0x7f3307ef9012 : mov 0x1e4(%rbx),%eax 0x7f3307ef9018 : mov %eax,0x20(%r14) 0x7f3307ef901c : mov 0x1e8(%rbx),%eax 0x7f3307ef9022 : lea -0x3(%rax),%edx 0x7f3307ef9025 : cmp $0x1,%edx 0x7f3307ef9028 : jbe 0x7f3307ef95e7 (gdb) thread apply all backtrace Thread 1 (Thread 0x7f3309c35740 (LWP 13027)): #0 bl_audio_decode (filename=, song=song@entry=0x7f3309aac3a8) at ../src/decode_av.c:93 #1 0x00007f3307ef877d in bl_analyze (filename=, current_song=0x7f3309aac3a8) at ../src/analyze.c:14 #2 0x00007f3307ef81f9 in _cffi_f_bl_analyze (self=, args=) at build/temp.linux-x86_64-3.4/bliss._bliss.c:526 #3 0x0000000000518545 in PyEval_EvalFrameEx () #4 0x000000000051c29d in PyEval_EvalFrameEx () #5 0x00000000004879bf in ?? () #6 0x00000000004c05ad in ?? () #7 0x00000000004c49a1 in ?? () #8 0x00000000004c2ab6 in ?? () #9 0x000000000051c577 in PyEval_EvalFrameEx () #10 0x0000000000487164 in PyEval_EvalCode () #11 0x000000000056be90 in ?? () #12 0x000000000047b1c3 in PyRun_FileExFlags () #13 0x000000000047b5a0 in PyRun_SimpleFileExFlags () #14 0x00000000005c0b33 in Py_Main () #15 0x000000000047dbc1 in main () (gdb) quit A debugging session is active. Inferior 1 [process 13027] will be detached. Quit anyway? (y or n) Detaching from program: /usr/bin/python3.4, process 13027
I should add a check for the Python bindings build in Travis-CI.
There is also a problem with my unittests as they expect to be run from a subdirectory (in a build
subdir typically) which is quite ugly. Will try to find a way to solve it.
Hi,
Could you confirm me I did not break anything with my latest pull request?
Maybe it could be useful to add some really simple unit-tests with some free of charge musics to ensure that nothing breaks in a future commit.
I am concerned by this due to the following result:
% ./analyze /tmp/test.mp3
[mp3 @ 0x6b5d00] Skipping 0 bytes of junk at 42438.
[mjpeg @ 0x6cfb00] Changeing bps to 8
[mp3 @ 0x6cf300] Header missing
Analysis for music /tmp/test.mp3:
Force: 0.000000
Force vector: (4.258503, 1.849175, -nan, 12.724423)
Channels: 2
Number of samples: 21309696
Sample rate: 44100
Bitrate: 254847
Number of bytes per sample: 2
Calm or loud: Unknown
Duration: 241
Artist: Phoenix
Title: Lisztomania
Album: Wolfgang Amadeus Phoenix
Track number: 1
genre: Alternative
force
and calm_or_loud
are a bit weird. The rest is ok AFAIK :)
Hi,
I saw that in one of the latest commits, you added some distance estimation between two songs. For this purpose, you chose to use a standard euclidian distance in 4D.
Have you tried using a cosine distance?
I think it could give better results for this purpose.
Hi,
I've just thought again about the k-means quick analysis you performed. Did you manage to somehow form "clusters" according to music genres?
Typically, do you think it would be possible to form a "rock" cluster, a "classical" cluster and so on to try to guess the genre of an unknown music?
My idea behind it is, besides the obvious thematic radio à la Spotify, to be able to make a playlist drift from one genre to another one, either because I am listening to pop, but want the music to drift toward jazz as time passes and as I will be going to bed, or to use it for some "education"/discovery pupose, starting from a music the user likes and knows well, and going toward another genre in a continuous manner.
just thinking slightly ahead...
maybe a bliss version api call is needed - especially if the API evolves and future changes may break stuff.
need therefore to expose a python binding on such a call.
===> Building for bliss-music-analyzer-1.2.0.6
[ 5% 2/17] /usr/bin/cc -Dbliss_EXPORTS -I/usr/local/include -I/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -Wall -Wno-long-long -pedantic -std=c99 -Wall -Wextra -pedantic -MD -MT CMakeFiles/bliss.dir/src/decode.c.o -MF CMakeFiles/bliss.dir/src/decode.c.o.d -o CMakeFiles/bliss.dir/src/decode.c.o -c /wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c
FAILED: CMakeFiles/bliss.dir/src/decode.c.o
/usr/bin/cc -Dbliss_EXPORTS -I/usr/local/include -I/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -Wall -Wno-long-long -pedantic -std=c99 -Wall -Wextra -pedantic -MD -MT CMakeFiles/bliss.dir/src/decode.c.o -MF CMakeFiles/bliss.dir/src/decode.c.o.d -o CMakeFiles/bliss.dir/src/decode.c.o -c /wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c
/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c:32:3: error: must use 'struct' tag to refer to type 'AVCodecContext'
AVCodecContext *codec_context = NULL;
^
struct
/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c:50:3: warning: implicit declaration of function 'av_register_all' is invalid in C99 [-Wimplicit-function-declaration]
av_register_all();
^
/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c:71:64: warning: passing 'AVCodec **' (aka 'struct AVCodec **') to parameter of type 'const AVCodec **' (aka 'const struct AVCodec **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
av_find_best_stream(context, AVMEDIA_TYPE_AUDIO, -1, -1, &codec, 0);
^~~~~~
/usr/local/include/libavformat/avformat.h:2161:41: note: passing argument to parameter 'decoder_ret' here
const AVCodec **decoder_ret,
^
/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c:90:19: warning: implicit declaration of function 'avcodec_alloc_context3' is invalid in C99 [-Wimplicit-function-declaration]
codec_context = avcodec_alloc_context3(codec);
^
/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c:90:17: warning: incompatible integer to pointer conversion assigning to 'struct AVCodecContext *' from 'int' [-Wint-conversion]
codec_context = avcodec_alloc_context3(codec);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c:92:16: error: incomplete definition of type 'struct AVCodecContext'
codec_context->thread_count = 0;
~~~~~~~~~~~~~^
/usr/local/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
^
/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c:93:16: error: incomplete definition of type 'struct AVCodecContext'
codec_context->thread_type = FF_THREAD_FRAME;
~~~~~~~~~~~~~^
/usr/local/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
^
/wrkdirs/usr/ports/audio/bliss/work/bliss-1.2.0-6-ga443635/src/decode.c:93:32: error: use of undeclared identifier 'FF_THREAD_FRAME'
codec_context->thread_type = FF_THREAD_FRAME;
^
FreeBSD 13.1
my choice of development distro is ubuntu 14.04 (trusty)
Unfortunately libswresample is not a dependency available for this distro.
Also checked Debian Jessie (the latest recommended version) and it is similarly not available.
For Ubuntu 15.04 the package is called libswresample-ffmpeg-dev.
For Ubuntu 15.10 and Debian Sid libswresample-dev is available
I havent checked any other distro - I suspect most will be similarly affected.
Hi,
First the disclaimer, I'm trying to build bliss on an unsupported distribution, gentoo ~amd64. (~ kinda means "testing")
For now, it still use ffmpeg 2.8.8 since build regressions with versions >= 3 are not all fixed (https://bugs.gentoo.org/show_bug.cgi?id=574788).
It does not build with ffmpeg 2.8:
[ 6%] Building C object CMakeFiles/bliss.dir/src/decode.c.o
/home/kleph/sources/bliss/src/decode.c: In function ‘bl_audio_decode’:
/home/kleph/sources/bliss/src/decode.c:15:2: error: unknown type name ‘AVCodecParameters’
AVCodecParameters *codecpar = NULL;
^
/home/kleph/sources/bliss/src/decode.c:62:43: error: ‘AVStream’ has no member named ‘codecpar’
codecpar = context->streams[audio_stream]->codecpar;
^
/home/kleph/sources/bliss/src/decode.c:76:30: error: request for member ‘sample_rate’ in something not a structure or union
song->sample_rate = codecpar->sample_rate;
^
/home/kleph/sources/bliss/src/decode.c:80:62: error: request for member ‘format’ in something not a structure or union
song->nb_bytes_per_sample = av_get_bytes_per_sample(codecpar->format);
^
/home/kleph/sources/bliss/src/decode.c:81:27: error: request for member ‘channels’ in something not a structure or union
song->channels = codecpar->channels;
^
/home/kleph/sources/bliss/src/decode.c:110:13: error: request for member ‘format’ in something not a structure or union
if(codecpar->format != AV_SAMPLE_FMT_S16 &&
^
/home/kleph/sources/bliss/src/decode.c:111:11: error: request for member ‘format’ in something not a structure or union
codecpar->format != AV_SAMPLE_FMT_S16P) {
^
/home/kleph/sources/bliss/src/decode.c:116:56: error: request for member ‘channel_layout’ in something not a structure or union
av_opt_set_int(swr_ctx, "in_channel_layout", codecpar->channel_layout, 0);
^
/home/kleph/sources/bliss/src/decode.c:118:59: error: request for member ‘format’ in something not a structure or union
av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", codecpar->format, 0);
^
/home/kleph/sources/bliss/src/decode.c:120:57: error: request for member ‘channel_layout’ in something not a structure or union
av_opt_set_int(swr_ctx, "out_channel_layout", codecpar->channel_layout, 0);
^
/home/kleph/sources/bliss/src/decode.c:192:46: error: request for member ‘format’ in something not a structure or union
is_planar = av_sample_fmt_is_planar(codecpar->format);
^
/home/kleph/sources/bliss/src/decode.c:216:4: warning: implicit declaration of function ‘avcodec_send_packet’ [-Wimplicit-function-declaration]
ret = avcodec_send_packet(codec_context, &avpkt);
^
/home/kleph/sources/bliss/src/decode.c:217:4: warning: implicit declaration of function ‘avcodec_receive_frame’ [-Wimplicit-function-declaration]
got_frame = !avcodec_receive_frame(codec_context, decoded_frame);
^
/home/kleph/sources/bliss/src/decode.c:230:14: error: request for member ‘format’ in something not a structure or union
codecpar->format,
^
make[2]: *** [CMakeFiles/bliss.dir/build.make:87: CMakeFiles/bliss.dir/src/decode.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/bliss.dir/all] Error 2
make: *** [Makefile:161: all] Error 2
I'm not sure it's a real issue as it will probably solve itself with ffmpeg-2.8 natural disappearance.
Maybe just a warning about version of libavcodec or ffmpeg >= 3 in the readme or with cmake should be enough.
Hi,
just running some tests - I'm using (python) cosine_similarity between two bl_song's - one is a latin track - the other is a reggae track
song3 = bl_song("/home/dad/Music/UB40 - The Very Best of UB40 1980-2000/14 - UB40 - Tell Me Is It True.ogg")
song = bl_song("/home/dad/Music/Various - Latin Fever (Disc 2)/01 - Enrique Iglesias - Bailamos (Groove Brothers Radio Edit).ogg")
print (distance.cosine_similarity(song3, song)["similarity"])
0.9550393223762512
So how should I interpret that result - are they similar?
print (song["force_vector"])
{'amplitude': 5.691754341125488, 'tempo': 5.7260565757751465, 'frequency': 6.2037200927734375, 'attack': -6.0}
print (song3["force_vector"])
{'amplitude': 5.661318778991699, 'tempo': 5.719758987426758, 'frequency': 2.5806758403778076, 'attack': -6.0}
Here: https://github.com/Polochon-street/bliss/blob/master/CMakeLists.txt#L96
Paths should be lib
and include
.
Bonjour
j'essaye de compiler la librairie bliss sous une ubuntu 14.04 lts
le cmake passe sans problèmes
et j'ai des erreurs
[ 6%] Building C object CMakeFiles/bliss.dir/src/decode.c.o
/home/jack/bliss/src/decode.c: In function ‘bl_audio_decode’:
/home/jack/bliss/src/decode.c:15:2: error: unknown type name ‘AVCodecParameters’
AVCodecParameters codecpar = NULL;
^
/home/jack/bliss/src/decode.c:62:43: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codecpar’
codecpar = context->streams[audio_stream]->codecpar;
^
/home/jack/bliss/src/decode.c:76:30: error: request for member ‘sample_rate’ in something not a structure or union
song->sample_rate = codecpar->sample_rate;
^
/home/jack/bliss/src/decode.c:80:62: error: request for member ‘format’ in something not a structure or union
song->nb_bytes_per_sample = av_get_bytes_per_sample(codecpar->format);
^
/home/jack/bliss/src/decode.c:81:27: error: request for member ‘channels’ in something not a structure or union
song->channels = codecpar->channels;
^
/home/jack/bliss/src/decode.c:110:13: error: request for member ‘format’ in something not a structure or union
if(codecpar->format != AV_SAMPLE_FMT_S16 &&
^
/home/jack/bliss/src/decode.c:111:11: error: request for member ‘format’ in something not a structure or union
codecpar->format != AV_SAMPLE_FMT_S16P) {
^
/home/jack/bliss/src/decode.c:116:56: error: request for member ‘channel_layout’ in something not a structure or union
av_opt_set_int(swr_ctx, "in_channel_layout", codecpar->channel_layout, 0);
^
/home/jack/bliss/src/decode.c:118:59: error: request for member ‘format’ in something not a structure or union
av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", codecpar->format, 0);
^
/home/jack/bliss/src/decode.c:120:57: error: request for member ‘channel_layout’ in something not a structure or union
av_opt_set_int(swr_ctx, "out_channel_layout", codecpar->channel_layout, 0);
^
/home/jack/bliss/src/decode.c:192:46: error: request for member ‘format’ in something not a structure or union
is_planar = av_sample_fmt_is_planar(codecpar->format);
^
/home/jack/bliss/src/decode.c:216:10: warning: implicit declaration of function ‘avcodec_send_packet’ [-Wimplicit-function-declaration]
ret = avcodec_send_packet(codec_context, &avpkt);
^
/home/jack/bliss/src/decode.c:217:17: warning: implicit declaration of function ‘avcodec_receive_frame’ [-Wimplicit-function-declaration]
got_frame = !avcodec_receive_frame(codec_context, decoded_frame);
^
/home/jack/bliss/src/decode.c:230:14: error: request for member ‘format’ in something not a structure or union
codecpar->format,
^
CMakeFiles/bliss.dir/build.make:86 : la recette pour la cible « CMakeFiles/bliss.dir/src/decode.c.o » a échouée
make[2]: ** [CMakeFiles/bliss.dir/src/decode.c.o] Erreur 1
CMakeFiles/Makefile2:104 : la recette pour la cible « CMakeFiles/bliss.dir/all » a échouée
make[1]: *** [CMakeFiles/bliss.dir/all] Erreur 2
Makefile:160 : la recette pour la cible « all » a échouée
make: *** [all] Erreur 2
Merci !!!
Hi,
I am working on integrating Bliss in MPD, see https://github.com/Phyks/MPDBliss/.
I have something almost working, but running bliss on every song (almost 50k in my case) and storing distances across each songs in a db is really long.
I do not remember leleleplayer being that long to build its cache. Which approach are you using?
What about sharing the built infos in an open online database? Like associating computed values using bliss to musicbrainz ID or things like this?
Hi,
Maybe it could be useful to put the ranges of each analysis value (tempo, amplitude, frequency and attack) in the README.
Moreover, I was thinking about the way we compute distance and cosine similarity. The way we compute it at the moment kind of implies that each coordinate has the same weight, due to the implicit assumption that the basis (tempo, amplitude, frequency and attack) is orthonormal.
This means that an increase of 1 on the tempo value gives the same result as an increase of 1 of the amplitude value, in terms of distance.
I am not sure this is actually the case and maybe we should try to refine the formula.
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.