Closed giuliomoro closed 5 years ago
Hum... this should obviously not happen. Are the effects from the SAM folder? Or better just send me the exact DSP code you are using.
Can you possibly test the exact same code and configuration outside of the bela? (that is on you laptop, with something like faust2caqt..etc)
dsps.zip here are the files
zip dsps.zip "/usr/local/share/faust/instruments.lib" "/usr/local/share/faust/envelopes.lib" "/usr/local/share/faust/basics.lib" "/usr/local/share/faust/maths.lib" "/usr/local/share/faust/signals.lib" "/usr/local/share/faust/noises.lib" "/usr/local/share/faust/oscillators.lib" "/usr/local/share/faust/delays.lib" "/usr/local/share/faust/filters.lib" "/usr/local/share/faust/reverbs.lib" "/usr/local/share/faust/routes.lib" "/Users/giulio/faust/examples/SAM/virtualAnalog/layout2.dsp" "/usr/local/share/faust/stdfaust.lib" "/Users/giulio/faust/examples/SAM/effects/echo.dsp" "/Users/giulio/faust/examples/SAM/effects/flanger.dsp" "/usr/local/share/faust/signals.lib" "/usr/local/share/faust/basics.lib" "/usr/local/share/faust/maths.lib" "/usr/local/share/faust/delays.lib" "/usr/local/share/faust/oscillators.lib" "/usr/local/share/faust/filters.lib" ~/bela.wiki/vfl.dsp ../effects/effects.dsp
I tried the code here on my MacBook with scalar (= default) then-vec -vs 16
with faust2caqt -vec -vs 16 -midi -nvoices 1 -effect effects.dsp flute.dsp
No difference. The sound is not so clean when hitting a second note while a first one is playing (since -nvoices 1 , the second note "steals" the first playing one). Could it be a CPU issue ? Coud you possible make a video shown the problem?
can you try to build it a few times? I have random behaviour, also when building on the mac with:
faust2caqt -midi -httpd -nvoices 1 -effect effects.dsp ~/workspace/bela.wiki/vfl.dsp
and hacking it to have -vec -vs 16
.
Trying to reproduce here... could be a corner case of this specific DSP. Can you possibly true some others, like from physicalModeling/ folder ?
I tried with the SAM/virtualAnalog
one (actually that's how I found out about it).
steps to reproduce: apply this
diff --git a/tools/faust2appls/faust2caqt b/tools/faust2appls/faust2caqt
index d83f06c96..26ec131e9 100755
--- a/tools/faust2appls/faust2caqt
+++ b/tools/faust2appls/faust2caqt
@@ -161,15 +161,15 @@ for p in $FILES; do
adaptor(F,G) = adapt(outputs(F),inputs(G));
process = adaptor(library("$SRCDIR/$f").process, library("$SRCDIR/$f").effect) : library("$SRCDIR/$f").effect;
EndOfCode
- faust -i -json -a $ARCHFILE $OPTIONS "$SRCDIR/$f" -o "$TMP/${f%.dsp}_tmp.cpp" || exit
- faust -i -cn effect -a minimal-effect.cpp "$TMP/effect.dsp" -o "$TMP/effect.h" || exit
+ faust $FAUST_ARGS -i -json -a $ARCHFILE $OPTIONS "$SRCDIR/$f" -o "$TMP/${f%.dsp}_tmp.cpp" || exit
+ faust $FAUST_ARGS -i -cn effect -a minimal-effect.cpp "$TMP/effect.dsp" -o "$TMP/effect.h" || exit
rm "$TMP/effect.dsp"
else
- faust -i -json -a $ARCHFILE $OPTIONS "$SRCDIR/$f" -o "$TMP/${f%.dsp}_tmp.cpp" || exit
- faust -i -cn effect -a minimal-effect.cpp "$SRCDIR/$EFFECT" -o "$TMP/effect.h" || exit
+ faust $FAUST_ARGS -i -json -a $ARCHFILE $OPTIONS "$SRCDIR/$f" -o "$TMP/${f%.dsp}_tmp.cpp" || exit
+ faust $FAUST_ARGS -i -cn effect -a minimal-effect.cpp "$SRCDIR/$EFFECT" -o "$TMP/effect.h" || exit
fi
else
- faust -i -json -a $ARCHFILE $OPTIONS "$SRCDIR/$f" -o "$TMP/${f%.dsp}_tmp.cpp" || exit
+ faust $FAUST_ARGS -i -json -a $ARCHFILE $OPTIONS "$SRCDIR/$f" -o "$TMP/${f%.dsp}_tmp.cpp" || exit
fi
# add preset management
run the following script to build 20 copies of an instrument containing physicalModeling/guitarMIDI.dsp
and smartKeyboard/associatedEffects/elecGuitarEffect.dsp
:
bash -exc 'for a in {1..20}; do rm -rf /tmp/tmp$a; mkdir -p /tmp/tmp$a ; cd /tmp/tmp$a; cp ~/faust/examples/physicalModeling/guitarMIDI.dsp ~/faust/examples/smartKeyboard/associatedEffects/elecGuitarEffect.dsp ./; FAUST_ARGS="-vec -vs 16" faust2caqt -midi -nvoices 1 -effect elecGuitarEffect.dsp guitarMIDI.dsp; cd ..; done'
Here are the projects that were generated for me: guitarMIDIs.zip If I listen to each one in turn. In my case, these have distortion artefacts, the others don't:
tmp11/guitarMIDI.app
tmp12/guitarMIDI.app
tmp15/guitarMIDI.app
tmp17/guitarMIDI.app
tmp3/guitarMIDI.app
(it's also possible that just running the same binary multiple times yields different effects, although I tried a few times)
Then I tried the same as above but without the effect. Here is the result: vecnoeffect.zip
If I listen to each in turn, these have a click at the beginning of each attack, that the others don't have:
tmp12/guitarMIDI.app
tmp14/guitarMIDI.app
tmp15/guitarMIDI.app
tmp18/guitarMIDI.app
Building 20 projects without vectorizing works fine, both with and without effect.
OK, I've have a look. Note that faust2caqt
(and other faust2xx
scripts) can take additional Faust compiler parameters (those are going in the $OPTIONS variable), so the $FAUST_ARGS stuff should not be necessary.
oh ok, I checked with -help
but there was nothing there. I will keep that in mind.
Right, we should add that point on all faust2xx -h part yes...
1) I cannot test any of your binaries: all of them crash with the following (strange) message:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 C4DM.guitarMIDI 0x000000010899ceb0 JSONUIDecoder::buildUserInterface(UI*) + 2064
1 C4DM.guitarMIDI 0x000000010899389f dsp_voice_group::init() + 79
2 C4DM.guitarMIDI 0x0000000108993799 mydsp_poly::mydsp_poly(dsp*, int, bool, bool) + 473
3 C4DM.guitarMIDI 0x000000010897ebf2 main + 834
4 libdyld.dylib 0x00007fff896dd5ad start + 1
2) I tried your test here with guitarMIDI.dsp
and elecGuitarEffect.dsp
and faust2caqt
. I cannot reproduce the problem. I tested also with faust2jack
(with -effect added here https://github.com/grame-cncm/faust/commit/abe234fc9381418ada226079a72bf28e67720d73). Stil don't hear the problem. Can you possibly test with faust2jack
?
3) so still investigating....
So I gave it another try, this time saving the temporary .cpp
and .h
files (attached below).
Summary:
Applied this patch to keep temporary files
diff --git a/Users/giulio/faust/tools/faust2appls/faust2caqt b/usr/local/bin/faust2caqt
index bbe05a9..55412ab 100755
--- a/Users/giulio/faust/tools/faust2appls/faust2caqt
+++ b/usr/local/bin/faust2caqt
@@ -67,7 +67,6 @@ do
elif [ "$p" = -icc ]; then
ignore=" "
elif [ $p = "-nvoices" ]; then
- POLYDEFS="DEFINES += POLY2"
shift
NVOICES=$1
if [ $NVOICES -ge 0 ]; then
@@ -240,7 +239,7 @@ EndOfCode
rm $p.json
cp -r "$TMP/${f%.dsp}$EXT" "$SRCDIR/${f%.dsp}$EXT"
- RMTMP=true
+ RMTMP=false
if $DEBUG;
then
echo "====> delete temporary folder $TDR ? [Y/n]"
Using this build script (with parallel builds!):
#!/bin/bash -ex
export PATH=/opt/local/libexec/qt5/bin:$PATH
faust_path=~/faust
num_builds=20
srcs="$faust_path/examples/physicalModeling/guitarMIDI.dsp $faust_path/examples/smartKeyboard/associatedEffects/elecGuitarEffect.dsp"
base_dsp=guitarMIDI.dsp
base_opts="-midi -nvoices 1 "
faust_command=faust2caqt
jobs_max=3
function build ()
{
rm -rf $base_folder
for a in $(seq 1 $num_builds); do
set -x
dir=$base_folder/build$a
mkdir -p $dir
cd $dir
cp $srcs $dir/
$faust_command $base_opts $opts $base_dsp &
while [ `jobs | wc -l` -gt $(($jobs_max - 1)) ]; do
set +x
sleep 0.5
done
cd ..
done
set -x
printf "Wait for jobs to complete..."
while [ `jobs | wc -l` -ne 0 ]; do
jobs
sleep 0.5;
done
echo done
zip -r $base_folder.zip $base_folder
}
opts="-vec -vs 16 -effect elecGuitarEffect.dsp"
base_folder=/tmp/veceffect
build
opts="-vec -vs 16"
base_folder=/tmp/vecnoeffect
build
opts="-effect elecGuitarEffect.dsp"
base_folder=/tmp/noveceffect
build
Outcomes:
-vec -vs 16 -effect
:
veceffect.zip
The below have a much noisier attack than the others:
veceffect/build13 THIS
veceffect/build18 THIS
veceffect/build9 THIS
-vec -vs 16
: (no effect)
vecnoeffect.zip
The below have a much noisier attack than the others:
vecnoeffect/build10 THIS
vecnoeffect/build13 THIS
vecnoeffect/build14 THIS
vecnoeffect/build16 THIS
vecnoeffect/build17 THIS
vecnoeffect/build8 THIS
Vectorize and no effect: noveceffect.zip
Thanks; Still cannot test the binary (SIGILL execution , so non compatible CPU I guess).
Nothing has changed in the generated C++ code since yesterday.
I've now try to integrate those tests in our "impulse-test" that test DSP produced samples with a given reference. This will possibly help understand if the problem is related to C++ generated code, or control parameter handling (like incorrect restoration...)
Can you try to rebuild the .cpp
files from the archive?
New finding: the noisy attack I get does not happen when using the GUI's "gate", but only when using a MIDI controller to trigger it.
Aha... so you get noisy attack with MIDI controller mode only and -vec compilation mode yes ?
yes that seems to be the case now.
Several things:
1) I could not reproduce the initial problem with our automatic tests ))-:
2) But I did some reworking and simplifications in the polyphonic handling code in https://github.com/grame-cncm/faust/commit/9692a58add0f4236753822345e1e8233a2eb482a that may help
3) Now I am reworking the automatic tests themselves to test more things. Up to now I could not detect any problem with the new polyphonic model.
4) I would be interested if you can test on your side.
yeah it seems that I cannot detect it any more now ... This is very weird, because when I opened the issue (c2478b2) I was getting horrible squeals and thunderous sounds with both the flute and the virtualAnalog examples and some weird distortion with the guitarMIDI one. Both on Bela and on caqt
. Then the next day ( 375ff40 ) I could only get that noisy attack on guitarMIDI
and now (9692a58 ) nothing ...
I also tried to roll back to c2478b2, but I get none of the obvious issues I had there ... but I still have some of the generated C++ code from when I started having issues, if that helps?
Nothing has changed at the code generation level between c2478b2 and 9692a58 . The thing that I've changed is part of the architecture files (so outside the generated code itself...)
I ran a modified
faust2bela
script that uses vectorization, as:faust2bela -midi -gui -tobela -nvoices 1 -effect effects.dsp ./vfl.dsp
the actual calls to the faust compiler are below:
the
vfl.dsp
file is simplyphysicalModeling/faust-stk/flute.dsp
, and theeffects.dsp
file contains:I have mixed results: sometimes the result works fine, sometimes I get a quiet squeal, sometimes I get a louder squeal when pressing a key, sometimes I just hear stuttering noise when pressing the key and then I hear the effects when releasing it,. I guess there may be some uninitialized memory somewhere? What would help you troubleshoot this?