Tempo in AIFF
-
- KVRAF
- Topic Starter
- 8388 posts since 11 Apr, 2003 from back on the hillside again - but now with a garden!
Afternoon, it's been a while.. Hope everyone's OK
I have a requirement for storing tempo information with some files used in a project we've got on. We use monolithic files with AIFFs stored within, this is tried and tested and we're not keen to tinker around the edges if we don't need to (i.e. don't really want to implement REX/Acid, nor keep a separate database of file->tempo maps).
I've been looking at the AIFF spec, and there's no declared provision for tempo. Some programs around offer tempo markings, but it's not clear how this metadata is stored in the file. We noticed there is an ANNOtation chunk, and using Myriad, etc. we could tag up samples. I can then read them back and use atoi/etc to extract the values.
Does this sound sensible? Is anyone using a better method?
All observations and ideas welcome
I have a requirement for storing tempo information with some files used in a project we've got on. We use monolithic files with AIFFs stored within, this is tried and tested and we're not keen to tinker around the edges if we don't need to (i.e. don't really want to implement REX/Acid, nor keep a separate database of file->tempo maps).
I've been looking at the AIFF spec, and there's no declared provision for tempo. Some programs around offer tempo markings, but it's not clear how this metadata is stored in the file. We noticed there is an ANNOtation chunk, and using Myriad, etc. we could tag up samples. I can then read them back and use atoi/etc to extract the values.
Does this sound sensible? Is anyone using a better method?
All observations and ideas welcome
-
- KVRian
- 853 posts since 13 Mar, 2012
You can embed an ID3v2 on AIFF.
Store it as IFF chunk and use "ID3" as chunkID.
Use TBPM frame on ID3 to store BPM (beats per mintue)
Store it as IFF chunk and use "ID3" as chunkID.
Use TBPM frame on ID3 to store BPM (beats per mintue)
~~ ॐ http://soundcloud.com/mfr ॐ ~~
-
- KVRist
- 81 posts since 24 Oct, 2000 from Bremen, Germany
There is/was a utility that Apple provided for writing Apple Loop AIFF files. Apple loops have 'trns' and 'basc' chunks, and the 'basc' chunk includes the length in beats of the whole file, so the tempo can be calculated from that.
-
- Banned
- 12368 posts since 30 Apr, 2002 from i might peeramid
obnoxiously coopting your thread because i doubt the matter would draw a reply on criteria besides infraction
it's nice to see such a pragmatic answer. yesterday i added avi writing to a graphic win32 app. fortunately an API is part of win32, and avi can be implemented in about half a dozen lines, though i haven't seen any notation anywhere near this concise, so most of the time was spent agonising through the implicit complications humans insist on amending all pragma with.
it's very interesting to me, a parameter as fundamental as frame rate is thoroughly obfuscated.
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
i'm not the first person to ponder such things, as eg. the enquiry posted to stackexchange drew a scornful "ms gives you all the information you need if that doesn't help you no one can" that seems so prevalent
because it doesn't bloody work.
10 frames per second. select the values. something else is going on, even accounting for the slowness of the player. file duration is certainly reported as not conforming to what is specified.
if you search for example data for these fields you will discover the matter is as agonic as it seems to be. instead of eg. being able to specify, 10 frames per second, values like 900001/2000202 seem to be implemented.
and as far as i can tell, there is no more meaningful consideration. no one dares to say, if you want 30 frames per second, try these default values.
the first thing to realise is that you are all insane.
god help us if just anyone can come along and find out how to do a thing and then does it.
some ad on this page keeps reloading every five seconds, barely able to enter data.
aah. it's the toyota RAV4 ad at the bottom of the page. it took about eight minutes of destroying my ability to write to load. it has audio.
the page stopped loading but the feeling that ben is totally fine with putting humanity through that isn't going to go away so fast. but i can type now! my cursor moves when i touch the button!
it's nice to see such a pragmatic answer. yesterday i added avi writing to a graphic win32 app. fortunately an API is part of win32, and avi can be implemented in about half a dozen lines, though i haven't seen any notation anywhere near this concise, so most of the time was spent agonising through the implicit complications humans insist on amending all pragma with.
it's very interesting to me, a parameter as fundamental as frame rate is thoroughly obfuscated.
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
what does this mean?dwScale
Time scale applicable for the stream. Dividing dwRate by dwScale gives the playback rate in number of samples per second.
For video streams, this rate should be the frame rate. For audio streams, this rate should correspond to the audio block size (the nBlockAlign member of the WAVEFORMAT or PCMWAVEFORMAT structure), which for PCM (Pulse Code Modulation) audio reduces to the sample rate.
dwRate
Rate in an integer format. To obtain the rate in samples per second, divide this value by the value in dwScale.
i'm not the first person to ponder such things, as eg. the enquiry posted to stackexchange drew a scornful "ms gives you all the information you need if that doesn't help you no one can" that seems so prevalent
because it doesn't bloody work.
10 frames per second. select the values. something else is going on, even accounting for the slowness of the player. file duration is certainly reported as not conforming to what is specified.
if you search for example data for these fields you will discover the matter is as agonic as it seems to be. instead of eg. being able to specify, 10 frames per second, values like 900001/2000202 seem to be implemented.
and as far as i can tell, there is no more meaningful consideration. no one dares to say, if you want 30 frames per second, try these default values.
the first thing to realise is that you are all insane.
god help us if just anyone can come along and find out how to do a thing and then does it.
some ad on this page keeps reloading every five seconds, barely able to enter data.
aah. it's the toyota RAV4 ad at the bottom of the page. it took about eight minutes of destroying my ability to write to load. it has audio.
the page stopped loading but the feeling that ben is totally fine with putting humanity through that isn't going to go away so fast. but i can type now! my cursor moves when i touch the button!
you come and go, you come and go. amitabha neither a follower nor a leader be tagore "where roads are made i lose my way" where there is certainty, consideration is absent.
-
- KVRian
- 853 posts since 13 Mar, 2012
@Xonos: AVI is a container designed to carry different audio and video formats (this thread was about AIFF, which is audio only )
So you need to take of the audio-only-glasses for a moment and also look at video.
Like, NTSC video has a framerate of 29,97fps or 23.976fps.
This values are not randomly choosen, but they derive from the frequency of the electrical power suply (NSTC -> US -> 60Hz vs PAL -> EU -> 50Hz).
The 29,97fps rate is 30000/1001, 23.976fps is 24000/1001.
It is quite common on video to specify 'tick' (frame or sample or chunk) rate as a rate / scale pair.
Otherwise you need to fiddle arround with floating-point formats or pre-defined rate enums to tackle all that non-integer frame rates.
Any specific question on that APIs?
Haven't touched AVI since.. uhmm.. >10 years, but might still be able rember some of the details
So you need to take of the audio-only-glasses for a moment and also look at video.
Like, NTSC video has a framerate of 29,97fps or 23.976fps.
This values are not randomly choosen, but they derive from the frequency of the electrical power suply (NSTC -> US -> 60Hz vs PAL -> EU -> 50Hz).
The 29,97fps rate is 30000/1001, 23.976fps is 24000/1001.
It is quite common on video to specify 'tick' (frame or sample or chunk) rate as a rate / scale pair.
Otherwise you need to fiddle arround with floating-point formats or pre-defined rate enums to tackle all that non-integer frame rates.
Any specific question on that APIs?
Haven't touched AVI since.. uhmm.. >10 years, but might still be able rember some of the details
~~ ॐ http://soundcloud.com/mfr ॐ ~~
-
- Banned
- 12368 posts since 30 Apr, 2002 from i might peeramid
thank you!, it would have been nice to have seen those figures somewhere.
the half a dozen lines i used bring up a little dialogue to select codec and one of them works, it's enough to export for editing. as said the reported playback time isn't right, but it's nice to know what it's supposed to be.
the half a dozen lines i used bring up a little dialogue to select codec and one of them works, it's enough to export for editing. as said the reported playback time isn't right, but it's nice to know what it's supposed to be.
you come and go, you come and go. amitabha neither a follower nor a leader be tagore "where roads are made i lose my way" where there is certainty, consideration is absent.
-
- KVRAF
- 2256 posts since 29 May, 2012
If the licenses of its parts are OK to you, you might find more info about FFMPEG. Use of rational numbers in the form of a/b is still there but I never had a problem with its documentation until I tried to implement hardware decoding, that wasn't documented at all. Even FFMPEG site itself had links to stackoverflow as a source of documentation replacement!
~stratum~
-
- KVRian
- 853 posts since 13 Mar, 2012
DXVA, or linux stuff? For DXVA, MS is a pretty good source for docu. For libva/OMX/vaapi/.... (linux) it's a mess, code & docu... like with all other GPU-related stuff. Just look at the mail from Linus about the latest pull-request for the new DRM stuff (kernel interface to the gpu drivers).stratum wrote:until I tried to implement hardware decoding, that wasn't documented at all. Even FFMPEG site itself had links to stackoverflow as a source of documentation replacement!
https://lists.freedesktop.org/archives/ ... 33794.html
https://lists.freedesktop.org/archives/ ... 33795.html
~~ ॐ http://soundcloud.com/mfr ॐ ~~
-
- Banned
- 12368 posts since 30 Apr, 2002 from i might peeramid
in a perfect world, my shrine to you would be close to jeff mcclintock's. in use.mda wrote:There is/was a utility that Apple provided for writing Apple Loop AIFF files. Apple loops have 'trns' and 'basc' chunks, and the 'basc' chunk includes the length in beats of the whole file, so the tempo can be calculated from that.
you come and go, you come and go. amitabha neither a follower nor a leader be tagore "where roads are made i lose my way" where there is certainty, consideration is absent.
-
- KVRAF
- 2256 posts since 29 May, 2012
I was hoping ffmpeg could handle that in a portable way, but there was no documentation at all. Eventually I ended up using intel media sdk + directx. Yes that's worse than DXVA in terms of portability because no gpu other than the one internal to intel chips are supported in this way. A more serious problem is that it does not work well with QT because QT also uses the gpu for its own rendering and the two seems to be conflicting ( I havent yet debugged the issue I dont know what it is) . On linux side things are even more complicated, even for using the internal intel gpu , nothing other than centos 7 is supported and only specific versions of that without any upgrade. This is like saying, err mr.customer, never run yum upgrade to install any security updates, because we would need to recompile the kernel and intel does not support anything other than that specific version we have installed...DXVA, or linux stuff? For DXVA, MS is a pretty good source for docu. For libva/OMX/vaapi/.... (linux) it's a mess, code & docu... like with all other GPU-related stuff. Just look at the mail from Linus about the latest pull-request for the new DRM stuff (kernel interface to the gpu drivers).
Seems like I'll see even more problems in near future.https://lists.freedesktop.org/archives/ ... 33794.html
https://lists.freedesktop.org/archives/ ... 33795.html
~stratum~