Jump to content


Photo

Construction of a horizontal timeline bar for the song?

timeline bar

  • Please log in to reply
10 replies to this topic

#1 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1028 posts
  • Gender:Male
  • Location:Spain

Posted 24 October 2017 - 16:27

Hi

 

I would like to build a horizontal bar with a timeline marker for the song. I think I would be able to build a reasonable GUI. But I need some way to calculate the time in seconds at all duration of the song. Some notions that I have thought to do this.

 

  • Basically, the song consists of patterns in sequence, from 1 to 1000. Each pattern is formed by a certain number of lines, from 1 to 512.
  • The minimum of a song is a pattern with a single line. The maximum would be 512 lines x 1000 patterns
  • The time of song depends on the  BPM (beats per minute)  and LPB (lines per beat) settings. EDIT: and the parameters ZT ZL!!!

My doubts are to construct a mathematical code that sums the lines of the whole song in each moment to get the real time of the song. Can anyone think of a code that can do that? I think the sum in seconds would be enough. Subsequently, it can be converted to minutes and seconds. If the user includes or deletes a single line (line or pattern (group of lines)), the mathematical code would recalculate the final figure in seconds.

 

It would be possible to use a timer to detect any line / pattern changes (not to be confused with the time calculation of the song, which is something else).

 

Any ideas for the mathematical code?

 

Some API data:

  • #renoise.song().sequencer.pattern_sequence
  • renoise.song().patterns[].number_of_lines
  • ... number_of_lines_in_pattern ???
  • renoise.song().transport.bpm (beats per minute, a minute = 60 s)
  • renoise.song().transport.lpb (lines per beat)
  • Is there any API code to help with all this?
Thanks!

Edited by Raul (ulneiz), 25 October 2017 - 11:49.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#2 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1502 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 24 October 2017 - 17:24

1) Not considering any speed changes that might occur. To keep track of such changes, you would have to iterate all patternlines. That's way too heavy, so I suggest that you just assume that the speed is the same thru-out the song. Anything else is too impractical, unfortunately.

 

2) Seconds / Line = bpm * lpb / 60. Iterate all previous patterns in the sequence and sum their number_of_lines (and of course, add the line_index in the current pattern to that). Multiply this by seconds / line, and reformat to taste.

 

3) To keep track of any updates in the sequence, you need to observe renoise.song().sequencer.pattern_sequence_observable and renoise.song().sequencer.pattern_assignments_observable, if I recall correctly.

 

PS. Do note that the estimated time is always visible in the native GUI, top right.


Edited by joule, 24 October 2017 - 17:24.

  • ffx likes this

#3 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1028 posts
  • Gender:Male
  • Location:Spain

Posted 24 October 2017 - 17:49

1)  :blink: Wow, I had not thought about the parameters that modify the time. I did not have this in mind. If I advance with this topic, this point will be ignored.

2) I really do not know how to approach this by iterating, to sum it all up, considering that each pattern can have a particular number of lines.

3) I do not think I'd have a problem with this.

Your PD) I am aware.

 
Really, I wanted to make this bar as a kind of LUA exercise, to manipulate the GUI and try things out. But sometimes some detail makes me unable to build certain things. Such a simple bar of time may not be useful, beyond learning itself.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#4 ffx

ffx

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2987 posts
  • Gender:Not Telling
  • Interests:macOS fanboying

Posted 25 October 2017 - 10:04

EDIT: Fine, I deleted my post. Go on.


Edited by ffx, 25 October 2017 - 11:35.

MacOS 10.12.6 Retina, Renoise 3.1 64 bit   -   Tuned Shortcuts | Multi-Jump From/To Send | Quick Template | Insert Native DSP Menu (incl. deprecated)


#5 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1502 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 25 October 2017 - 10:28

Well. I haven't said anything of the sorts.If someone wants to learn LUA and the Renoise API, that's up to him/her.

 

@Raul, 2) Each renoise.Pattern has a property named something like .number_of_lines. And the sequence list (with pattern numbers) is accessible from renoise.song().sequencer.pattern_sequence[]

 

I assume that you have seen http://forum.renoise...31-transporter/ . Maybe you'll find some answers there as well.



#6 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6458 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 25 October 2017 - 11:13

I think most of the work here would be about getting the UI right. Obtaining the patterns that make up the song, easy. Length of each pattern, easy.

The "hard part" is to represent this on the screen in a way that adapts to whatever size your tool might have. 

 

Actually, I have been dabbling a bit with this. My (slightly delayed  :blush:) update to the selection-shaper tool has a helper function which can be used for representing the relative size of a list of numbers. 

So you give it a horizontal size and hand over all the pattern lengths. Voilá, it will then give you the size your buttons/whatever would need to have. 

 

It's used for building stuff like the keyzone and slice marker visualization in this screenshot: 

http://forum.renoise...haper/?p=360457

 

You're welcome to dive into the code, of course. Something to copy-paste, experiment with...   ^_^

 

The helper function: ("distribute sizes")

https://github.com/r...es/vLib.lua#L72

 

UI widget implemention ("vButtonStrip")

https://github.com/r...ButtonStrip.lua


Tracking with Stuff. API wishlist | Soundcloud


#7 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1028 posts
  • Gender:Male
  • Location:Spain

Posted 25 October 2017 - 11:20

@FFX, I have no problem reading the time clock (top right), in knowing which pattern I am in the sequence (left column). I'm just trying to build a tool involving the time of the song, to see if I'm capable. Rubbing windows are useful if they are well made. I'm not interested in other DAWs to learn LUA. We are discussing if there is any way to get song time in seconds at all times (I guess it plays iterate and the sum), depending on what the user does (using timers to update or _observables).

 

@Joule. I am able to get the number of lines in each pattern separately, but I do not know how to add it in an iteration (do the sum). Yes, I saw your transporter tool in its infancy. It looks like you've released other versions.

 

I'll take a look. I think this issue of getting the total time of the song is somewhat complicated, precisely by the parameters ZL and ZT of LPB and BPM. Anyway, I want to make clear that I am doing exercises with LUA, I really do not seek to create a useful tool with this, just experiment.


Edited by Raul (ulneiz), 25 October 2017 - 11:22.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#8 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1028 posts
  • Gender:Male
  • Location:Spain

Posted 25 October 2017 - 11:29

@Danoise. Let's say this is like 2 phases:

  1. Get the necessary values (numbers), patterns, lines, the time each line lasts, the sum of all times ...
  2. Using the previous numbers, build the UI

So I'm getting into these things for fun. Probably find things to help me in the future for other tools. Thanks for all the links! I will look at them in depth.

 

EDIT:  :D  :D  :D  :D http://forum.renoise...r/#entry360457  You see? precisely for these things I want to manipulate the code. I am far from building things like that yet!!!


Edited by Raul (ulneiz), 25 October 2017 - 11:34.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#9 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1502 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 25 October 2017 - 11:31

@Raul, The for loop has its own scope, so you should put the sum in an outer scope. Otherwise the "sum" variable below will get overwritten in every loop.

local sum = 0

for i = 1, 100 do
  sum = sum + 10
end

-- here, the sum will be 1000


#10 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1502 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 25 October 2017 - 11:39

PS. @Danoise,

 

I do think these functions benefit from minimum overhead (?). I did something similar in my chordtracker tool. I would suspect they are a bit faster, but I'm not sure.

 

Spoiler


#11 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6458 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 25 October 2017 - 12:46

@joule: hah, that's cool. And true, raw performance was not my main concern.

 

One edge case you don't seem to be concerned about: Once you set something to a sufficiently small value, the actual displayed button/rack/whatever size doesn't necessarily reflect the size you tried to set - 

so some "magic" has to be injected then  ^_^

 

In any case, it's always great to see alternative takes on the same problem ! 


Tracking with Stuff. API wishlist | Soundcloud