sync flanger period to tempo#1257
Conversation
daschuer
left a comment
There was a problem hiding this comment.
Could you explain why we do not need the delay knob?
What happens with channels without a beat value like Aux?
| const unsigned int kMaxDelay = 5000; | ||
| const unsigned int kLfoAmplitude = 240; | ||
| const unsigned int kAverageDelayLength = 250; | ||
| const unsigned int kMaxDelay = 441000000; |
There was a problem hiding this comment.
What is the unit of these values? What does they mean? A comment could be useful.
There was a problem hiding this comment.
I thought they were previously all in units of samples, but I could be wrong. @JosepMaJAZ or @rryan could you clarify?
| const int kChannels = 2; | ||
|
|
||
| const unsigned int lfoAmplitude = | ||
| kLfoAmplitude / sampleRate / kChannels; |
There was a problem hiding this comment.
Why is the Amplitudes sampleRate depending?
Well it wasn't doing anything before. Do you have ideas for where in the code it could manipulate something in a musically useful way?
It acts like the tempo is 100 BPM because I don't know what else to do. |
|
Mmm.. a flanger effect is such that it mixes the input signal into output with a delay that oscillates slowly over a center delay value. The delay parameter would generally mean this center value, and there are also the commonly known parameters of amplitude of the LFO and for the speed of that LFO. They can also have a stereo phase, which means that the phase of the left audio channel and the right audio channel would not be at the same phase, which does a sort of ping-pong effect as well as image widening, and could also have feedback. And in the case where the speed parameter is removed, on other applications i tended to like the effect of a 0.25Hz LFO. |
|
|
||
| CSAMPLE periodFraction = CSAMPLE(pState->time) / lfoPeriod; | ||
| CSAMPLE delay = kAverageDelayLength + kLfoAmplitude * sin(M_PI * 2.0f * periodFraction); | ||
| CSAMPLE delay = averageDelayLength + lfoAmplitude * sin(M_PI * 2.0f * periodFraction); |
There was a problem hiding this comment.
@JosepMaJAZ I tried turning the center value (averageDelayLength) and amplitude into effect parameters but it didn't seem very useful to me. Maybe I just didn't choose appropriate scales for them. Do you have suggestions?
41e590a to
c1ee02a
Compare
plus remove unused delay parameter and remove assumption of 44.1 kHz sample rate
c1ee02a to
7bd4876
Compare
|
It was only the period that needed to be adjusted for the sample rate. Now it sounds the same when changing the sample rate (which is not the case in master). |
| CSAMPLE lfoPeriod; | ||
| if (m_pSyncParameter->toBool() && groupFeatures.has_beat_length) { | ||
| // period is a number of beats | ||
| lfoPeriod = periodTime * groupFeatures.beat_length; |
There was a problem hiding this comment.
Why do you need the file sample rate here? I think the track is already re-sampled here.
There was a problem hiding this comment.
The input signal is resampled, but groupFeatures.beat_length is calculated from the beat_prev and beat_next ControlObjects in BpmControl::collectFeatures, which does not seem to be adjusted for the engine sample rate. When I play a 44.1 kHz track at 44.1 kHz with a tempo synced effect it works as expected, but when I set Mixxx's sample rate to 96 kHz, the period approximately halves.
Perhaps there could be a way to tap in a tempo? The delay knob isn't so good by itself, but if you could tap it in (clicking on delay knob repeatedly or separate button), you could use it to make fine adjustments. |
|
That's a good idea, but I think it is beyond the scope of this simple pull request. |
|
Agreed, just pointing out that there could be a reason to keep the delay knob/parameter in the meantime. |
|
The delay knob was removed because it literally did nothing. I think you are confusing it with the period parameter. |
|
This effect is difficult to hear without the Depth parameter way up, but then it makes the the output quite a bit louder than the input. Any ideas to improve that? |
dde3fe7 to
ec07adb
Compare
|
I have added a Triplet parameter like Echo. Like Phaser and unlike Echo, I do not think there is a use case for a Quantize parameter. |
|
Anyone care to test? @radusuciu, @MK-42? |
|
Sorry, I'm not actively using the effects and only have little experience with "how that should hear like", so I'm probably the wrong one for this PR |
| period->setUnitsHint(EffectManifestParameter::UnitsHint::BEATS); | ||
| period->setMinimum(0.00); | ||
| period->setMaximum(4.00); | ||
| period->setDefault(0.50); |
There was a problem hiding this comment.
I prefer here 2. That sounds good and is the centre position.
1 works also for me. (currently there is a by two bug that makes 0.50 to 1)
| lfoPeriod = lfoPeriod * groupFeatures.beat_length_sec | ||
| * sampleRate * kChannels; | ||
| } else { | ||
| // lfoPeriod is a number of seconds |
There was a problem hiding this comment.
these comments are confusing, because lfoPeriod variable changes unit. We should use two variables for it.
periodParameter and periodFrames
There was a problem hiding this comment.
Yes, two variables could make the code easier to understand.
There was a problem hiding this comment.
Low Frequency Oscillator
| * sampleRate * kChannels; | ||
| } else { | ||
| // lfoPeriod is a number of seconds | ||
| lfoPeriod = std::max(lfoPeriod, 1/4.0) * sampleRate * kChannels; |
There was a problem hiding this comment.
without kChannels, because the loop below is already in stereo.
There was a problem hiding this comment.
Okay, I will fix this.
| lfoPeriod /= 3.0; | ||
| } | ||
| lfoPeriod = lfoPeriod * groupFeatures.beat_length_sec | ||
| * sampleRate * kChannels; |
There was a problem hiding this comment.
without kChannels, because the loop below is already in stereo.
|
According to: It would be also Cool to have an Manual Switch to tweak a constant delay. A short fix for this PR could be to rename the Depth parameter, though. |
|
Ah, I got it, "Manual" sets kAverageDelayLength. |
|
Let's keep this PR focused on syncing the period parameter to the tempo and move discussion about the Depth parameter to #1326. |
|
Notes addressed. |
|
Thank you. LGTM |
|
I was confused by the doubled period but trusted my misunderstanding of the code more than my ears, so thanks for catching that. |
|
Thank you for your elaboration, but previous version of Flanger was far more better, at least for me. New Flanger sounds like phaser rather than flanger. To increment the period (default and max value is too short) make the sound more similar to the previous, but something is still missing. |
|
What do you think should be the maximum for the Period parameter? 8 beats? 16 beats? You can try different values by editing this line. |
|
The flanger can be considered as broken. |
|
Here it is: |
plus remove unused delay parameter and remove assumption of 44.1 kHz
sample rate
Depends on: