pouët.net

Some questions about V2

category: code [glöplog]
hej people!

since there is NOT much documentation given with V2 player/source package, I need some help from people who successfully used it :D

1) what is "tick" exactly? I display and use this counter on the intro, i think it's something like millisecond? (one tick=one second divided by 1000?)

2) how can we use synchro in intro/demo code? I have seen in the source that V2 can generate an array without synchro values (tick number?) automatically, but how can I add synchro keys in the music? it's a special midi command to add?

Thank for your help :)
added on the 2011-03-07 18:24:21 by rez rez
1) A "tick" is a generic audio programming term which is of arbitrary length. Could be one millisecond, but don't count on it :) . You don't need to know its length in order to use the plugin or the player lib, though.

2) That one I'm not sure, but last I checked there's a function in libv2 to retrieve a channel's peak or rms volume at any given time. Poke around in libv2.h and see what you find :)
added on the 2011-03-07 20:51:53 by ferris ferris
haven't read or used that code for a while.

1) there's like different "ticks" in V2. the per frame DoTick() that should be called and the tick value which is meant to be an internal value and is indeed intialised at 1000 persec. how else?!

2) since the internal playerstates are readable there's tons of possibilities to animate stuff with that values. the channel volume is the simplest case. else you could work with the CalcPosition() to get sync on time. Or you'd hard code or seperately data script the animation events in a timeline like fr usually does.
added on the 2011-03-07 22:01:54 by yumeji yumeji
Two additional things:

That DoTick() per frame makes things worse on dualcore CPUs, so better don't call it anymore ;)

And CalcPosition() only works if the time info in the midi data is intact. Which isn't the case since the .v2m export button in the plugin, so don't use it. You won't get any useful data out of it. (If you'd got the .mid+.v2b -> v2m converter that I never released it would work :)
added on the 2011-03-07 22:26:03 by kb_ kb_
If you've got the original midi-data from i.e. Renoise, you can use that for timing instead of relying on the synth-"replies". In the xrns-format, you've got the tempo in beats per minute and the positions per beat. Along with the actual note-on's there's also the instrument-number and you would probably have all you need.

I'm not sure if that's an option, but as I see it, it would definately work as long as you have the original midi-data from your intro-tune.
added on the 2011-03-07 22:34:28 by Punqtured Punqtured
Good to know I babbled alotta shit again. -.-
added on the 2011-03-07 22:57:10 by yumeji yumeji
Using V2 in Ableton is really a pain in teh sheiize
In Windows there's a function called GetTickCount which gives you the amount of ticks since a certain point in time. One tick seems to be a millisecond by default, but it is possible to change that.
added on the 2011-03-08 00:23:47 by Adok Adok
thanks for your input, adok.
added on the 2011-03-08 07:19:50 by reed reed
Adok: GetTickCount always counts milliseconds, there's no way to change that.
added on the 2011-03-08 09:47:01 by KeyJ KeyJ
Quote:
Adok: GetTickCount always counts milliseconds

... and its not even at an effective millisecond precision ...
... and it has nothing to do with the actual question, adok.
fucking learn to read, or even better than that: stfu
added on the 2011-03-08 11:12:55 by gopher gopher
Thank for your answers Messieurs!

I'm currently using GetTickCount() and that seems to works well, and since I'm pretty that the value is milliseconds (kb_ can you confirm me that?) I think I will be able to set all my synchros with that :)
added on the 2011-03-08 12:11:42 by rez rez
What gopher said. GetTickCount() doesn't have anything to do with the discussion AT ALL.

In the end, "tick" is simply a word for "a clock increment", because, you know, clocks, well, they make that sound when they run. Has to mean something, I think. But it's NO standard word for a certain time span. If someone refers to "ticks" or "frames", it can mean _anything_.

In the case of V2, the default tick rate is milliseconds because people are used to that from Windows and I wanted to make the transition to music based sync as smooth as possible. And at the beginning of, i think, v2mplayer.h or .cpp there's a "#define TICKS_PER_SECOND" which specifies that. You can even change it if you want, it'll work.
added on the 2011-03-08 12:36:35 by kb_ kb_
Quote:

# click: make a clicking or ticking sound; "The clock ticked away"
# a metallic tapping sound; "he counted the ticks of the clock"
# any of two families of small parasitic arachnids with barbed proboscis; feed on blood of warm-blooded animals
# sew; "tick a mattress"
# check mark: a mark indicating that something has been noted or completed etc.; "as he called the role he put a check mark by each student's name"
# check: put a check mark on or near or next to; "Please check each name on the list"; "tick off the items"; "mark off the units"
kb_: i didn't find any "TICKS_PER_SECOND" but a line who gives some hint:
Code:void Init(sU32 a_tickspersec=1000) { m_tpc=a_tickspersec; m_base.valid=0; }


so my last n00b question will be: can I count or not (haha) on that getTickCount() function to make my synchro?

I just some counter I can use to trigger my events at the good moment (without skipping some must be great ;))
added on the 2011-03-08 12:48:29 by rez rez
OK, seriously, forget about GetTickCount(). Use dsGetCurSmp() from libv2.h - the return value has a resolution of 44100 "ticks" per second, works pretty well, and most importantly: is in perfect sync with the music. The start of the song is at time 0; but beware that you'll get negative numbers first because it compensates for output latency.

or to put it into pseudocode:

while (!bored)
{
float time_in_seconds = (float)dsGetCurSmp()/44100.0f;
if (time_in_seconds>=0)
show_demo(time_in_seconds);
else
show_black_screen_or_dont();
}
added on the 2011-03-08 13:31:48 by kb_ kb_
tick tick tick tick tick tick booom.

shake shake shake shake the room
added on the 2011-03-08 15:31:53 by wysiwtf wysiwtf
@kb_: just finished to implement dsGetCurSmp() and it works fine!

now my differents effects are triggered by that counter.

as you said I added a blackscreen to wait until the counter reach 0 value.

thank a lot for your help, I hope it will works fine on compo-machine at Revision ;)
added on the 2011-03-08 16:47:57 by rez rez
Still related to v2 and synchro, I've been playing with v2mplayer.cpp file. I'd like to get information from the midi data (to know when each note will be played). I can get everything I need (note, instrument, channel, volume...), except the time the note be played.

Is there a way to get seconds or ms from PlayerState struct? I've found that "2.9f * m_state.time" is an approximation of the time in ms (at least on my computer), but I'd like to find a more correct value. :)

Thanks!
added on the 2011-03-11 18:16:02 by LLB LLB
2.90249433106575963718820861678 :D

(I could also say "a frame size of 128 samples at 44100 Hz" but that'd be boring, wouldn't it :)
added on the 2011-03-11 19:31:40 by kb_ kb_
Wonderful! Thanks!
added on the 2011-03-11 21:14:29 by LLB LLB
With Revision/TG approaching, this thread is starting to depress me a little bit. Write your own damn synths, people!

Or let's make a rule: If you use V2*, you saved so much time that you will be DISQUALIFIED if your visuals aren't FUCKING AWESOME.

* or another other good synthesizer that you didn't write yourself
added on the 2011-03-11 21:21:18 by revival revival
revival: it's like asking people to write their own language/compiler to make a new demo...

for me, using an already existing softsynth is like using minifmod to replay, I will NOT make a new version of Protracker if I want to play something sounding like module.
added on the 2011-03-25 15:18:54 by rez rez
@kb_: I tried "float time_in_seconds = (float)dsGetCurSmp()/44100.0f;" but I think there's a problem since the "timer_in_seconds" value seems to be 2x or 3x faster than real seconds :'(
added on the 2011-03-25 15:22:09 by rez rez

login