* Easy question: ppq and tempo
@ 2002-05-24 7:57 Gerald Grabner
2002-05-24 10:48 ` Tim Goetze
0 siblings, 1 reply; 8+ messages in thread
From: Gerald Grabner @ 2002-05-24 7:57 UTC (permalink / raw)
To: alsa-devel
Hi,
I'm just starting to write my first alsa-lib midi applications. I'm
wondering what the acronym ppq stands for and what it means (especially
in relation to tempo). Unfortunately, I didn't find any docu on the
topic of tempo.
Thanks for your help,
Gerald
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Easy question: ppq and tempo
2002-05-24 7:57 Gerald Grabner
@ 2002-05-24 10:48 ` Tim Goetze
2002-05-24 14:03 ` Paul Davis
0 siblings, 1 reply; 8+ messages in thread
From: Tim Goetze @ 2002-05-24 10:48 UTC (permalink / raw)
To: Gerald Grabner; +Cc: alsa-devel
Gerald Grabner wrote:
>Hi,
>
>I'm just starting to write my first alsa-lib midi applications. I'm
>wondering what the acronym ppq stands for and what it means (especially
>in relation to tempo). Unfortunately, I didn't find any docu on the
>topic of tempo.
from <sound/asequencer.h>:
/* queue tempo */
struct sndrv_seq_queue_tempo {
int queue; /* sequencer queue */
unsigned int tempo; /* current tempo, us/tick */
int ppq; /* time resolution, ticks/quarter */
unsigned int skew_value; /* queue skew */
unsigned int skew_base; /* queue skew base */
char reserved[24]; /* for the future */
};
the value is usually synonymous to the 'division' of a standard midi
file.
tim
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Easy question: ppq and tempo
2002-05-24 10:48 ` Tim Goetze
@ 2002-05-24 14:03 ` Paul Davis
2002-05-24 14:47 ` Richard Bown
0 siblings, 1 reply; 8+ messages in thread
From: Paul Davis @ 2002-05-24 14:03 UTC (permalink / raw)
To: Tim Goetze; +Cc: Gerald Grabner, alsa-devel
>>I'm just starting to write my first alsa-lib midi applications. I'm
>>wondering what the acronym ppq stands for and what it means (especially
>>in relation to tempo). Unfortunately, I didn't find any docu on the
>>topic of tempo.
> int ppq; /* time resolution, ticks/quarter */
[ ... ]
>the value is usually synonymous to the 'division' of a standard midi
>file.
"ppq" stands for "parts per quarter". as the header file suggests
without much explanation, its length of a quarter note expressed in
clock ticks. if the meter is 4/4 and the tempo is 120bpm, then a
quarter note lasts 0.5 seconds. if the clock used for timing ticks 100
times per second, there are 50 clock ticks per quarter note, so
ppq=50.
--p
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Easy question: ppq and tempo
[not found] <200205241400.QAA27210@mailin.webmailer.de>
@ 2002-05-24 14:18 ` Tim Goetze
2002-05-24 14:37 ` Paul Davis
0 siblings, 1 reply; 8+ messages in thread
From: Tim Goetze @ 2002-05-24 14:18 UTC (permalink / raw)
To: Paul Davis; +Cc: Gerald Grabner, alsa-devel
Paul Davis wrote:
>>>I'm just starting to write my first alsa-lib midi applications. I'm
>>>wondering what the acronym ppq stands for and what it means (especially
>>>in relation to tempo). Unfortunately, I didn't find any docu on the
>>>topic of tempo.
>
>> int ppq; /* time resolution, ticks/quarter */
>
> [ ... ]
>
>>the value is usually synonymous to the 'division' of a standard midi
>>file.
>
>"ppq" stands for "parts per quarter". as the header file suggests
>without much explanation, its length of a quarter note expressed in
>clock ticks. if the meter is 4/4 and the tempo is 120bpm, then a
>quarter note lasts 0.5 seconds. if the clock used for timing ticks 100
>times per second, there are 50 clock ticks per quarter note, so
>ppq=50.
though usually it will be a number divisible by 3 and 4 to make
triplets and even beats alike coincide with integer ticks. cubase
on the atari used to set this to 192, though some do prefer 480 or
even more to allow for minute timing ('groove') adjustments.
tim
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Easy question: ppq and tempo
2002-05-24 14:18 ` Easy question: ppq and tempo Tim Goetze
@ 2002-05-24 14:37 ` Paul Davis
2002-05-24 17:35 ` Frank van de Pol
0 siblings, 1 reply; 8+ messages in thread
From: Paul Davis @ 2002-05-24 14:37 UTC (permalink / raw)
To: Tim Goetze; +Cc: Gerald Grabner, alsa-devel
>>"ppq" stands for "parts per quarter". as the header file suggests
>>without much explanation, its length of a quarter note expressed in
>>clock ticks. if the meter is 4/4 and the tempo is 120bpm, then a
>>quarter note lasts 0.5 seconds. if the clock used for timing ticks 100
>>times per second, there are 50 clock ticks per quarter note, so
>>ppq=50.
>
>though usually it will be a number divisible by 3 and 4 to make
>triplets and even beats alike coincide with integer ticks. cubase
>on the atari used to set this to 192, though some do prefer 480 or
>even more to allow for minute timing ('groove') adjustments.
where "it" is the clock ticks per second.
thanks tim, i had always wondered why 192 or 480 etc. was used, and
never knew until now :)
--p
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Easy question: ppq and tempo
2002-05-24 14:03 ` Paul Davis
@ 2002-05-24 14:47 ` Richard Bown
0 siblings, 0 replies; 8+ messages in thread
From: Richard Bown @ 2002-05-24 14:47 UTC (permalink / raw)
To: alsa-devel
Paul Davis wrote:
> "ppq" stands for "parts per quarter".
Rather boringly I was under the impression it was "pulses per quarter note"
and that's why you sometimes see it as PPQN as well as PPQ.
Sorry.
R
--
http://www.all-day-breakfast.com/rosegarden
http://www.bownie.com
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Easy question: ppq and tempo
2002-05-24 14:37 ` Paul Davis
@ 2002-05-24 17:35 ` Frank van de Pol
2002-05-31 16:44 ` Gerald Grabner
0 siblings, 1 reply; 8+ messages in thread
From: Frank van de Pol @ 2002-05-24 17:35 UTC (permalink / raw)
To: Paul Davis; +Cc: Tim Goetze, Gerald Grabner, alsa-devel
I don't want to spoil the party, but PPQ is indeed parts per quarter note
and is used to specify the desired resoluting for the sequencer timing grid.
Let me explain:
If the sequencer is set to eg. 4 PPQ this means that a quarter note
devided in 4 parts, actually being 16th notes in 4/4 meter.
Actually, I've a Roland DR-550mkII drum machine on my desk which works in 4
PPQ. On it's display there is a grid with 16 columns, at 4 PPQ every grid
unit corresponds with one tick (as specified in the song position field for
an event).
Since a 4 PPQ is rather course for most sequences (you get instantanious
quantisation!) most sequencer applications use a higher resolution, eg. 384
PPQ (Steinberg Cubase) or 480 (Emagic Logic).
If the tempo would be set to 120 bpm, which is 120 quarter notes per minute
or 2 quarter notes per second, then in case of a 4 PPQ sequence there would
be 8 parts per second. Changing the tempo (quite a common operation) would
leave the sequencer events at the same grid position while changing the time
(in seconds) at which they would be dispatched
So the "it" Paul mentioned has nothing (directly) to do with number of
seconds (Paul, I presume you were refering to the clock frequency the
sequencer engine is running at).
Frank.
see also an ancient document on the ALSA sequencer:
http://www.alsa-project.org/~frank/alsa-sequencer/node5.html
On Fri, May 24, 2002 at 10:37:49AM -0400, Paul Davis wrote:
> >>"ppq" stands for "parts per quarter". as the header file suggests
> >>without much explanation, its length of a quarter note expressed in
> >>clock ticks. if the meter is 4/4 and the tempo is 120bpm, then a
> >>quarter note lasts 0.5 seconds. if the clock used for timing ticks 100
> >>times per second, there are 50 clock ticks per quarter note, so
> >>ppq=50.
> >
> >though usually it will be a number divisible by 3 and 4 to make
> >triplets and even beats alike coincide with integer ticks. cubase
> >on the atari used to set this to 192, though some do prefer 480 or
> >even more to allow for minute timing ('groove') adjustments.
>
> where "it" is the clock ticks per second.
>
> thanks tim, i had always wondered why 192 or 480 etc. was used, and
> never knew until now :)
>
> --p
>
> _______________________________________________________________
>
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel
--
+---- --- -- - - - -
| Frank van de Pol -o) A-L-S-A
| FvdPol@home.nl /\\ Sounds good!
| http://www.alsa-project.org _\_v
| Linux - Why use Windows if we have doors available?
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Easy question: ppq and tempo
2002-05-24 17:35 ` Frank van de Pol
@ 2002-05-31 16:44 ` Gerald Grabner
0 siblings, 0 replies; 8+ messages in thread
From: Gerald Grabner @ 2002-05-31 16:44 UTC (permalink / raw)
To: alsa-devel
Hi,
last week I asked about the meaning of ppq - thanks a lot so far for
all the answers! Now I have a related question, namely about tempo: If
I set ppq to 1, then tempo should be the duration of a quarter note in
microseconds, right?
But there seems to be a factor of about 100 between this and what I
get with my test program. Setting tempo to 100000000 makes one quarter
last about one second. Is there something wrong with my program or
what's my mistake?
Thanks again,
Gerald
--
snd_seq_queue_tempo_t *queue_tempo ;
snd_seq_get_queue_tempo (seq_handle, queue_id, queue_tempo) ;
int ppq = 1 ;
snd_seq_queue_tempo_set_ppq (queue_tempo, ppq) ;
unsigned int tempo = 100000000 ;
snd_seq_queue_tempo_set_tempo (queue_tempo, tempo) ;
snd_seq_set_queue_tempo (seq_handle, queue_id, queue_tempo) ;
snd_seq_ev_clear(&ev);
snd_seq_ev_set_source(&ev, port_id);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_set_noteon(&ev, 9, 60, 127) ;
snd_seq_tick_time_t tick = 0 ;
for ( int i=0 ; i<4 ; i++ ) {
snd_seq_ev_schedule_tick(&ev, queue_id, 0, tick);
snd_seq_event_output(seq_handle, &ev);
tick++ ;
}
snd_seq_drain_output(seq_handle);
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-05-31 16:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <200205241400.QAA27210@mailin.webmailer.de>
2002-05-24 14:18 ` Easy question: ppq and tempo Tim Goetze
2002-05-24 14:37 ` Paul Davis
2002-05-24 17:35 ` Frank van de Pol
2002-05-31 16:44 ` Gerald Grabner
2002-05-24 7:57 Gerald Grabner
2002-05-24 10:48 ` Tim Goetze
2002-05-24 14:03 ` Paul Davis
2002-05-24 14:47 ` Richard Bown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.