ch-nry / VCV_nozori

port of nozori eurorack module for VCV Rack
GNU General Public License v3.0
15 stars 2 forks source link

Pitch module question #6

Closed vcvrackideas closed 4 years ago

vcvrackideas commented 4 years ago

HI! It seems to me Pitch module doesn't always work. Looks like it expects some louder signal or signal with specific range of the pitch but I didn't get it yet. Sometimes it works as expected but sometimes the output is silent

ch-nry commented 4 years ago

thanks for your report. Can you share a simple patch that show the problem? thanks

mattcollier commented 4 years ago

Hello, came to put in an issue for no output from pitch module and it's here already. I have only tried hooking it up to FM OP, and I have never gotten any output.

Using Rack v1.1.6 Pitch v1.1.4 Ubuntu Studio 18.04 with JACK audio. 48kHz sample rate.

pitch_test.vcv.zip

ch-nry commented 4 years ago

Thanks for reporting the problem, and for the test patch. your setup is very similar to mine (ubuntu 18.04, and same software version), but I can't reproduce the problem. here is a picture of your patch running fine on my computer : Capture du 2020-04-06 11-47-02

mattcollier commented 4 years ago

I have found a clue. If I open the test patch while Rack is already running, there is no output. But if I close Rack with the patch loaded and start rack again, the output is working. Does that help?

I tried it a handful of times and it does what I described 100%.

ch-nry commented 4 years ago

Thanks, that help, but I still can't reproduce the problem. Do other nozori module works? (can you test the delay?) Do you use a 32 bit or 64 bit OS?

mattcollier commented 4 years ago

The delay module works fine.

64 bit OS.

matt@matt-HP-Pavilion-dv7-Notebook-PC:~/Rack$ uname -a
Linux matt-HP-Pavilion-dv7-Notebook-PC 4.15.0-91-lowlatency #92-Ubuntu SMP PREEMPT Fri Feb 28 12:15:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
mattcollier commented 4 years ago

After debugging for a while, here's what I've learned.

If I add the following logging above L299 here: https://github.com/ch-nry/VCV_nozori/blob/master/src/m68_PITCH.ino#L299

  printf("G1 %d\n", grain1_used);
  printf("G2 %d\n", grain2_used);
  printf("OUTS %d\n", outS);

When the module outputs audio properly, G1 and G2 log 1 for true and OUTS is some non-zero value.

When the failure occurs (no audio), G1 and G2 are logged as two different values like 71 and 103 and OUTS is zero.

I checked the places where grain1_used and grain2_used are set and they seem to be proper. So the fact that they seem to be getting set to some value other than true/false 0 or 1 suggest to me that the memory for those variables is getting overwritten somehow.

I can also report that when loading the test patch about 10% of the time, VCV rack dumps

5.477 fatal src/main.cpp:45] Fatal signal 8. Stack trace:
7: ./Rack() [0x56d2b1]
6: /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7fb3a9dc7f20]
5: /home/matt/.Rack/plugins-v1/Nozoid/plugin.so(_ZN15Nozori_68_PITCH7processERKN4rack6engine6Module11ProcessArgsE+0x184) [0x7fb39249f340]
4: ./Rack() [0x5b5da3]
3: ./Rack(_ZN4rack6engine12EngineWorker3runEv+0x15e) [0x5b7200]
2: /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xbda50) [0x7fb3aa7eda50]
1: /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db) [0x7fb3ac3836db]
0: /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7fb3a9eaa88f]

I note there are several compiler warnings when building: https://gist.github.com/mattcollier/b4544ac63fea5f06fc3ce4c60a5b1af4

ch-nry commented 4 years ago

thanks for your help and your work,

I checked the places where grain1_used and grain2_used are set and they seem to be proper. So the fact that they seem to be getting set to some value other than true/false 0 or 1 suggest to me that the memory for those variables is getting overwritten somehow.

71 and 103 are both "true", since you are printing a bool using %d I think it(s ok to have garbage when printing it). if you change their definition to "int", then things should print better...

ch-nry commented 4 years ago

I can reproduce the bug! So I will be able to debug it! if you open rack, create a new patch, close rack, open rack, open the patch, then pitch works. that's what I was doing.

But if you open the patch, remove the pitch module, close rack, open rack, open the patch, then it's not working.

The difference is opening this patch from an empty patch, or from this demo patch without the pitch module.

ch-nry commented 4 years ago

ok, I found the problem. I was missing some initialisation in the init procedure: grain1_used = false; grain2_used = false;

should be fixed with commit : 98a3c76104549242e86c27d8a8a3be5a6c4045a5