constant-q-cpp icon indicating copy to clipboard operation
constant-q-cpp copied to clipboard

How to match python librosa.cqt with constant-q-cpp ?

Open matt-42 opened this issue 3 years ago • 0 comments

Hi, Could anyone get the same output than python librosa.cqt [1] with constant-q-cpp ? constant-q-cpp has not hop_length parameter (time length of each output frame), we can only get output frames of 1/max_freq seconds. tried to subsample the output (by averaging chunks of constant-q-cpp output) to control hop_length but I could not match the output of librosa.cqt I also have another problem the first ~10 frames of constant-q-cpp almost equal to 0.. Any ideas ?

Here is the output I got so far, 8 octaves, 1bin per octave: librosa.cqt(raw_audio, sr=sr, hop_length=hop_length, sparsity=0.01, n_bins=8, bins_per_octave=1, scale=False, tuning=0)

81.77066 63.23853 85.73126 54.70133 22.289486 9.918793 2.5520785 0.21647891 75.88521 10.971143 131.40614 119.55048 40.561794 10.076316 2.4180284 0.6705376 22.214264 32.154934 235.28644 101.087166 33.556137 8.909314 2.2425086 0.6767296 23.478954 91.23524 263.20062 94.04591 27.230015 6.109539 1.6830908 0.602804 42.091568 295.96326 221.71324 40.985374 10.205679 4.3074627 2.4045377 1.4617078 42.226242 393.6818 205.13501 33.272266 9.2961855 4.230702 2.3848495 1.4510415 45.15438 487.38977 187.33626 52.973164 16.17459 5.936316 3.0049343 1.7815813 109.036606 520.87024 191.54544 48.494488 11.973509 3.007201 0.90094954 0.3631698 138.63243 485.88278 150.0018 38.036587 12.609086 5.1494775 2.7164395 1.6264207 229.58588 445.47095 128.89624 30.674294 9.998731 4.100301 2.1741393 1.302023 292.448 368.05667 99.17351 25.108074 6.6255517 1.910079 0.76821685 0.41326073 318.18692 314.9988 93.26109 23.693556 5.9957685 1.6768246 0.6439543 0.34057018 331.78436 264.88562 76.763535 19.671713 5.458373 1.8874139 0.91558653 0.5366652 305.27573 220.25504 61.272984 15.607285 4.908014 1.93713 1.0098768 0.60359365 291.54865 191.25163 55.126762 15.920821 5.224085 2.0496244 1.0622324 0.6337774 255.43016 156.81123 42.14081 11.137957 3.7328267 1.5303522 0.8096328 0.48542807 230.3502 136.72586 39.247414 11.453258 3.8305478 1.5232764 0.792822 0.47343737 200.73125 113.713486 30.808802 7.9827642 2.616217 1.0624368 0.560582 0.335974 169.69289 96.33693 27.53662 7.563389 2.347814 0.8993528 0.4637374 0.2765852 150.99515 82.90595 23.131922 5.8182926 1.812691 0.70740575 0.36589298 0.21819288 120.35955 66.39276 18.674355 4.630106 1.2619292 0.42355987 0.20073956 0.11685501 107.28719 58.5859 16.722078 4.256605 1.2394047 0.44282338 0.21800777 0.12824896 80.04482 44.47305 12.237413 2.889889 0.7032634 0.17434457 0.04924769 0.017795486

constant-q-cpp: 0 0 0 0 0 0 0 9.98623e-23 0 0 0 0 0 0 0 2.07275e-07 0 0 0 0 0 0 0 2.18631e-05 0 0 0 0 0 0 0 3.93869e-05 0 0 0 0 0 0 0 2.89571e-05 0 0 0 0 0 0 0 0.000100696 0 0 0 0 0 0 6.53269e-24 0.000299053 0 0 0 0 0 0 7.24039e-06 0.000537467 0 0 0 0 0 0 8.80853e-05 0.000867644 0 0 0 0 0 2.68308e-23 0.000262683 0.00122528 0 0 0 0 0 8.19945e-06 0.000547756 0.00157875 0 0 0 0 2.52329e-05 4.54567e-05 0.000907054 0.00183578 0.0155819 0.0153509 0.0148963 0.0141998 0.0125493 0.00971738 0.00790392 0.00621637 0.101505 0.101767 0.102588 0.104697 0.108255 0.10969 0.0781977 0.0186027 0.105382 0.105429 0.105727 0.106951 0.109555 0.111151 0.0986518 0.00984688 0.10238 0.102823 0.103907 0.106795 0.112937 0.120209 0.112378 0.0312081 0.107341 0.107281 0.107173 0.107203 0.10796 0.111972 0.116167 0.0599345 0.104164 0.104446 0.10508 0.106838 0.110942 0.116616 0.118102 0.082994 0.115768 0.115645 0.115318 0.114702 0.11342 0.111522 0.111123 0.102609 0.0909029 0.0911909 0.0918252 0.0935114 0.0979519 0.107182 0.117864 0.107549 0.116759 0.116644 0.116337 0.11578 0.114749 0.113639 0.116375 0.111216 0.111378 0.111448 0.111535 0.111845 0.112808 0.114785 0.115627 0.113197 0.105599 0.105723 0.105923 0.106471 0.108031 0.111899 0.118487 0.116803

Thanks for your help! [1] http://librosa.org/doc/main/generated/librosa.cqt.html

matt-42 avatar Apr 01 '22 20:04 matt-42