Bug 1436 - Spectral crossfader begins with audio from next track
Summary: Spectral crossfader begins with audio from next track
Status: RESOLVED FIXED
Alias: None
Product: BpmDj
Classification: Unclassified
Component: Audio (show other bugs)
Version: unspecified
Hardware: Other other
: Future major
Assignee: Werner Van Belle
URL:
: 1431 1439 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-01-25 14:28 CET by Vidar Wahlberg
Modified: 2015-02-09 00:55 CET (History)
1 user (show)

See Also:


Attachments
Example of mixing two tracks using spectral crossfader (607.54 KB, audio/mp3)
2015-01-25 14:32 CET, Vidar Wahlberg
Details
Crossfading two tones (warning: Loud) (285.08 KB, audio/mp3)
2015-01-25 15:13 CET, Vidar Wahlberg
Details
Reverse spectral crossfade, low frequencies not faded in during transition (888.34 KB, audio/mp3)
2015-01-27 20:25 CET, Vidar Wahlberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Comment 17 Vidar Wahlberg 2015-02-09 00:55:57 CET
(In reply to comment #16)
> Ticks, audio distortion and filters are 3 different things. 

[snip]

Thanks for the clarification. I chose a poor word for the audio artifacts I'm hearing, it's not distortion as in the audio clipping. It's likely that the artifacts I'm hearing is the issue you're already aware of (repositioning a filter).

> - Ticks: a sample that is wrong. These are really annoying fuckers to find and
> fix. However, without clear bug that shows that the played audio is different
> from the original mp3, it is hard to find these.
> 
> In any case, as you might guess now, I will need something replicable and
> tangible before I can fix any bug.

As noted this is not a significant issue for my part, and as you're obviously aware of the issue I see no need to nitpick about it. If I dig more into it I'll let you know if I can reproduce it in a more controlled environment.

> You mention you have an export where there is data at the start. Could you file
> a bugreport for this individually ?

Certainly: http://bpmdj.yellowcouch.org/bugzilla/﷒0
Comment 16 Werner Van Belle 2015-02-08 21:13:16 CET
Ticks, audio distortion and filters are 3 different things. 

- A filter that repositions itself is observed as a sweeping sound. At the moment I don't intend on fixing this problem with the crossfader because I don't want to screw up all the mixes people made. Yet I do realize it is there. In the future I will very likely add a second spectral crossfader. One that is of a slightly higher quality.
- Audio distortion (if the volume is too loud, it digitally clips, which is not a very nice effect to hear). This problem can occur in the resampler. Check whether turning off the resampler has any effect. However, if it is in the resampler then you should be able to repeat the bug and show me where a problem occurs.  Digital distortion also occurs because android gains the audio too much. This is outside the control of BpmDj. You can check this by turning the volume of the phone down (typicall at 75%). If the problem still persists, then export the audio and file a bugreport. A third place where small distortions might occur is in the limiter. If you turn on/off the limiter you should be able to detect/replicate the problem as well. 
- Ticks: a sample that is wrong. These are really annoying fuckers to find and fix. However, without clear bug that shows that the played audio is different from the original mp3, it is hard to find these.

In any case, as you might guess now, I will need something replicable and tangible before I can fix any bug.

You mention you have an export where there is data at the start. Could you file a bugreport for this individually ?
Comment 15 Vidar Wahlberg 2015-02-08 20:28:20 CET
Apologies for continuing on this closed report, but I'm still experiencing some audio distortion. I'm not reopening the case or creating a new report as I don't have a good enough test case or test data, so for now I'll just write down some of the problems I'm experiencing.

There's at least one transition where I'm able to repeatedly reproduce an audio distortion (like the one in attachment "Example of mixing two tracks..."), and the impact of the distortion correlates to where the last transition stopped:
If I play entirely through the transition, then set the playback to just before the transition begins, there will be an audible "flanger"-ish sound as the transition begins.
If I play halfway through the transition and then set playback to just before the transition beings the "flanger"-ish sound will be less audible.
If I set the playback to just before the transition immediately after the transition has begun, there will be no audible distortion.

Earlier you wrote «The chirp at the beginning of the transition is a bit weird. I guess this is because the LR4 filter goes back to its initial state (from being at the top). I should be able to fix that.», could this still be the case?

I exported the mix and listened a couple times to the transitions, and this transition does have the same audible distortion here (although I perceive it as more audible in the editor when testing as described above). I've tried moving the start of the transition, see if I can find another place to start the transition, but this is not always a possibility and it may not alleviate the issue. I've also checked that the envelope is a standard crossfade to rule out errors related to this, and I'm not using the XY-pad.

In the exported file there is however audio at the start of the mix, even though the first track starts with complete silence. The audio is too short for me to identify which track or if it comes from a track in the mix. Looking at the file in Audacity it turns out to be exactly 20ms with audio before it goes silent. Is this a magic number you're familiar with?

And finally for todays update: During transitions, both spectral crossfade and the non tempo locked transition (possibly other transitions, I've only tested these two) there are occasional clicks. These are few and not very audible, and is such not a significant problem, but I thought I'd mention it.
Comment 14 Vidar Wahlberg 2015-01-28 12:10:54 CET
(In reply to comment #13)
> The crossfader starts at octave 3. Maybe I should allow it to start at a lower
> frequency, but in that case that type of filter tends to add a fair amount of
> rumbling. And changing it would change all the mixes other people made. So the
> only solution is to add a new crossfader that starts lower.

I see. Perhaps another solution is to somehow make the octave/frequency configurable, set default to octave 3, but make it possible to override to a lower/higher setting?

> Regarding the mixes ? The mix you made should of course be available in the new
> one. If it isn't you might need to rescan your filesystem; and if it still is
> not in themixes list, you can manually scan the /mnt/sdcard/BpmDj directory,
> then it should find all the old mixes you made.

Oh, the mixes are available. I was just wondering if BpmDj precalculates the transition and cache it between sessions, meaning that upgrading BpmDj potentially could still cause an old mix to play a cached transition. I presume this is not the case, so when I export a mix with BpmDj 4.6.0 which I made with BpmDj 4.5.9, all the transitions will be recalculated.
Comment 13 Werner Van Belle 2015-01-28 07:08:45 CET
The crossfader starts at octave 3. Maybe I should allow it to start at a lower frequency, but in that case that type of filter tends to add a fair amount of rumbling. And changing it would change all the mixes other people made. So the only solution is to add a new crossfader that starts lower.

Regarding the mixes ? The mix you made should of course be available in the new one. If it isn't you might need to rescan your filesystem; and if it still is not in themixes list, you can manually scan the /mnt/sdcard/BpmDj directory, then it should find all the old mixes you made.
Comment 12 Vidar Wahlberg 2015-01-27 20:25:03 CET
Created attachment 24 [details]
Reverse spectral crossfade, low frequencies not faded in during transition

It seems like the normal spectral crossfade works much better now, but the reverse one doesn't fade in low frequencies as I'd expect it to. At least not in one of my transitions.
Attached file is a long transition (about a minute), the oncoming track has the same beat for the entire transition, but it's completely filtered out until the transition is over (and the beat then pops in midway in a bar/measure - the transition came to an end midway into said bar/measure).
I've checked that it's not using an envelope, even changed to the plain crossfader and back to spectral again.

Just to make sure, it shouldn't be necessary to recreate the mix form scratch in 4.6.0? Is there some cache I need to clear?
I'm using a mix I created with 4.5.9, I've only restarted both the app and the device so far. I can remake the mix, but that will take some more time if I'm to reproduce the exact same transition.
Comment 11 Vidar Wahlberg 2015-01-27 00:39:27 CET
(In reply to comment #10)
> Hello Vidar, did the transition boundary fading fix your problem ?

It did help significantly, there are some issues still, but I need to export a mix and create some clips of the transitions to show/explain the issue properly. I didn't have time to do it this evening, but I'll try to get it done tomorrow evening.
Also, I have a question about the reverse spectral crossfader (mirrored 'Z' symbol), it may be that I'm using it incorrectly, but the low frequencies of the next track isn't faded fully in when the transition ends. This cause the bass to suddenly pop in after the transition instead fading in smoothly as the transition nears its end. I believe this was the case in the previous version too and not something introduced in the latest version, for the record. I have an example of this, I'll see if I can upload a clip of this tomorrow as well.

Also, I briefly tried the two tones fading into each other. The "chirp" is notably less audible now, but still there. Do note that this transition is very short.
Comment 10 Werner Van Belle 2015-01-27 00:08:01 CET
Hello Vidar, did the transition boundary fading fix your problem ?
Comment 9 Werner Van Belle 2015-01-25 22:59:38 CET
*** Bug 1439 has been marked as a duplicate of this bug. ***
Comment 8 Werner Van Belle 2015-01-25 22:57:35 CET
*** Bug 1431 has been marked as a duplicate of this bug. ***
Comment 7 Werner Van Belle 2015-01-25 22:46:41 CET
Good, allthough not a perfect solution, the filters now fade in and out properly.
Update somewhere in the future.
Comment 6 Vidar Wahlberg 2015-01-25 19:29:06 CET
(In reply to comment #5)
> Okay, I see what you mean. The chirp at the beginning of the transition is a
> bit weird. I guess this is because the LR4 filter goes back to its initial
> state (from being at the top). I should be able to fix that.

Do note that a distortion sometimes also happens at the very start of a mix (like it does in the example I uploaded), where there's no transition and presumably no LR4 filter (at least not displayed in the UI). This is why I expected it to be a buffer issue, data remaining from a previous playback/transition.

I am however unable to reproduce the chirp at the beginning of a transition using the plain crossfader. Even though the chirp at the beginning of the mix and the chirp at the beginning of the spectral crossfade transition sounded quite similar, the issues may not be as related as I thought they were.

> In any case, I was planning to look at this problem for a while and now it
> seems as good a time as any.

That's great!
Let me know if I can be of assistance.
Comment 5 Werner Van Belle 2015-01-25 18:57:19 CET
Okay, I see what you mean. The chirp at the beginning of the transition is a bit weird. I guess this is because the LR4 filter goes back to its initial state (from being at the top). I should be able to fix that.

However, in the audio demo you gave me the problem is slightly different. There the bass of the old song is suddenly cut out (because the LR4 filter starts at octave 3), yet the new bass is not ready yet because the filter has not been primed. How to solve that is not yet clear I must admit. 

A third problem (which you might not be aware of), is that the transition is abruptly, which leads sometimes to ticks if the old phase shifted bass is replaced by the non-phase shifted bass.  Yet crossfading a filtered and non-filtered signal didn't work out too well and added a DC offset. 

In any case, I was planning to look at this problem for a while and now it seems as good a time as any.

With kind regards,

Werner,-
Comment 4 Vidar Wahlberg 2015-01-25 15:15:06 CET
(In reply to comment #2)
> Did you perform a manual crossfade or is this an automatic crossfade ?

Forgot to answer the question: This was automatic crossfade, no messing with sliders, just selected spectral crossfade.
Comment 3 Vidar Wahlberg 2015-01-25 15:13:55 CET
Created attachment 21 [details]
Crossfading two tones (warning: Loud)

Trying to upload the two tone crossfade again. It was likely discarded as I uploaded it as a 5 MB .wav-file first
Comment 2 Werner Van Belle 2015-01-25 15:05:00 CET
Hello, 

Thanks for the bugpreport.
I think you forgot to attach the demo with the two tones ?

Did you perform a manual crossfade or is this an automatic crossfade ?

Werner,-
Comment 1 Vidar Wahlberg 2015-01-25 14:32:55 CET
Created attachment 19 [details]
Example of mixing two tracks using spectral crossfader

Here's an example using proper audio tracks. Note the distortion around 11 seconds into the clip. I had to encode it to MP3 due to file size constraints (don't mistake the distortion as a broken MP3 file).
The rest of the crossfade is fine, it's only at the beginning of the crossfade I've noticed signification distortion of sound.
Description Vidar Wahlberg 2015-01-25 14:28:12 CET
This issue sometimes happen elsewhere (notably start of mix), but seems to be consistently reproducible using the spectral crossfader (both variations).
Tested on Sony Xperia Z3 and ASUS Transformer Pad TF300T.

The attached file is a simple tone faded into another tone about an octave higher. At start of clip you can hear the second tone for a short duration, and when the crossfading begins you also hear the second tone for a short duration.
This causes crossfading between two tracks to start with a quite audible distortion.

Buffer issue, perhaps? That would be my first guess.