"duration" is an integer, should be double

Bug #1497183 reported by Chloé AVRILLON
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
Wishlist
Unassigned

Bug Description

Summary :
The Mixxx control value "duration" gives a rounded integer value

We need :
the actual "duration" value as a real number (400 milliseconds difference is 1 beat !)

"duration should be equal to =track_samples/track_sample_rate/2 (real value) "/2" because stereo

Tags: easy metadata
Revision history for this message
Daniel Schürmann (daschuer) wrote :

As a workaround, you can use
"track_samples" and "track_samplerate"

Changed in mixxx:
status: New → Confirmed
importance: Undecided → Wishlist
tags: added: easy metadata
removed: bug mixxxcontrol
description: updated
Revision history for this message
Daniel Schürmann (daschuer) wrote :

If you like, you can fix it your self.
https://github.com/mixxxdj/mixxx/blob/0774d77a3bf03a520a207e4b3c9be1dd83e221be/src/trackinfoobject.h#L74
you can make it a double, all ControlObjects are double anyway.
But you need to track where this value is used and if the fractions of a second didn’t do bad things.

Our general bugfix workflow is described here:
http://www.mixxx.org/wiki/doku.php/bugfix_workflow

Revision history for this message
Chloé AVRILLON (chloe-avrillon) wrote :

hum, something clear is missing here daniel :
http://www.mixxx.org/wiki/doku.php/bugfix_workflow

are you sure it is the good link ?

Revision history for this message
Chloé AVRILLON (chloe-avrillon) wrote :

Majors problems for me :
1) a bit lost in the Mixx code
2) I did not program in C since ages. I am a Delphi developper girl
3) I am not used to gitub

Hey, I have some limits :/

Anyway, I will try to understand everything, but the bugfix workflow page is gone somewhere in the Twilight Zone ! :D

Revision history for this message
Chloé AVRILLON (chloe-avrillon) wrote :

hannnnnn.... I understood something reading the source code !!!!
The duration given is the duration given by the tags of the file , wich is an integer.

Soooo it's better to leave as it is.

But what is interesting and not dociumented is that we have a property available : "Channels", that provide us the info to know if our track is Stereo or not.

Therefore we can return a real value for the duration like that :
real_duration==track_samples/track_sample_rate/channels

Revision history for this message
Daniel Schürmann (daschuer) wrote :

The page was hijacked, now the original content is back.

> Majors problems for me ....

If you still have fun to take these challenges, go ahead, I will try to give you a help if yo ask.

Revision history for this message
Chloé AVRILLON (chloe-avrillon) wrote :

Thank you Daniel, but they are not priorities since they can be get around without problem.
In my list of bug I have one very serious, and 3 that are a bit annoying :

The very serious one is this one (and I think it is urgent and critical since it can resolve a bunch of issues that might be related to it) :
https://bugs.launchpad.net/mixxx/+bug/1499738

The two annoying :
https://bugs.launchpad.net/mixxx/+bug/1498868 (those two permitted me to discover the serious one)
https://bugs.launchpad.net/mixxx/+bug/1498960

https://bugs.launchpad.net/mixxx/+bug/1498134 (this one is diferent, but can get around)

Revision history for this message
Daniel Schürmann (daschuer) wrote :

After the track is loaded, to the player, TrackInfo::m_duration is updated with the real value, which is sample precise. The "duration" ControlObject is set from this real value. A ControlObject is always of type double, so it might make sense to use double precision here. But as said, we need to make sure not to introduce any regression.
And if you have an other workaround ....

Revision history for this message
Chloé AVRILLON (chloe-avrillon) wrote :

Yes, the workaround is that in midi scripting we have accesss to the track_samples and track_sample_rate value

We could expose the Channels value without any drawback for everything else, so that we could get in MIDI scripting our value like that :

___________

MyController.getduration = function(group) {
       var track_samples = engine.getValue(group,"track_samples");
       var track_sample_rate = engine.getValue(group,"track_samplerate");
       var track_channels = engine.getValue(group,"channels");
 return track_samples/track_sample_rate/channels;
};

___________

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Yes, this will work for me as well. We should call it "track_channels", since a deck has currently always two channels.
And even without the channel value, you should be able to guess the value of channels.

Revision history for this message
Chloé AVRILLON (chloe-avrillon) wrote :

"And even without the channel value, you should be able to guess the value of channels."

Ho yes we can guess the value of channel, 99% of the time it will be Stereo.
But for the 1% left, the Midi script is not able to guess that the provided track is mono.

For mp3, I don't know if Mono audio exist (I think not), but for PCM wav file, yes, for sure.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

If "duration" is 3:30 and "track_samples / track_sample_rate / 2" is 1:15:3 we have a mono track. :-)

Revision history for this message
Chloé AVRILLON (chloe-avrillon) wrote :

This is good! Nice trick!

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Taglib 1.10 supports finer duration values. We should update Mixxx accordingly.

summary: - Midi scripting : "duration" is an integer
+ "duration" is an integer, should be double
Changed in mixxx:
assignee: nobody → Uwe Klotz (uklotzde)
status: Confirmed → In Progress
Revision history for this message
Uwe Klotz (uklotzde-deactivatedaccount) wrote :
Changed in mixxx:
status: In Progress → Fix Committed
jus (jus)
Changed in mixxx:
milestone: none → 2.1.0
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/8229

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.