Understanding the timescale property

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
minogaade
Posts: 9
Joined: Fri Aug 15, 2008 10:27 pm
Location: Madison, WI, USA

Understanding the timescale property

Post by minogaade » Sun Dec 02, 2018 6:08 pm

I've worked with LiveCode/Revolution for decades, not as a developer but as an educator and researcher. I have a dictionary app (of an American Indian language) that I've made that uses audio files to play examples of words in the dictionary. To do this, I take a full audiotext (as an mp3), and then cycle through the text, getting the "duration" of the snippet that represents the portion of the audiotext corresponding to the sentence I want to play for a given word. I noticed in LiveCode 9 (and perhaps earlier versions, it's been years since I played with dictionary app) that the audio snippets weren't playing properly, and with some trial-and-error, figured out that the timescale property was different than I had originally programmed for. I did not factor in timescale to calculations in my earlier version of the app, because I didn't need to. Now, on my Mac, in LiveCode 9, some audiofiles have a timescale of 22050 and others of 44100. So this seems pretty obviously to correspond to the sampling rate of the original audiofile. So I rewrote my scripts to accommodate these values, and now things work quite well. However, when I went to work with the dictionary stack in Windows 10, nothing worked in terms of the audio. Some inspection showed that the timescale in Windows 10 was

10000000

that is, 10 million. Why this number? It is the same for both 22050 audio and 44100 audio. I found that taking the measurements that worked on my Mac and multiplying them by 226 (for the 44100 audio), everything works. I haven't tested the 22050 samples yet. Here is my question:

Where is the value of 10000000 coming from in Windows, and how consistent is this across various Windows OS versions? Another possibility is that this is a value inside LiveCode itself, and the StandAlone might work differently? I would just like some clarification here.

Obviously, I now know, the way to code to allow the playing of audio snippets inside a unit audiofile is to factor the timescale into the determination of the start and endpoints of the player.

Thanks.

Rand (Minogaade) Valentine
Madison, Wisconsin

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Understanding the timescale property

Post by Klaus » Thu Dec 06, 2018 5:43 pm

Hi Rand,

sorry for being a bit late for the party...

I am just a user of LC and have no knowledge about the "innerds" of LC. But I think "the timescale of player xyz" is only something that the underlying multimedia-system returns and we and LC do not have any influence on that.

Since there are probably differences in "the timescale ..." on Mac and Window I usually compute any information relying on that (convert current time, duration etc. to e.g. SMPTE timecode) "live", means I do NOT save or hardcode any timscale-dependant data on any platform, just use what I get. Know what I mean?

Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Understanding the timescale property

Post by dunbarx » Fri Dec 07, 2018 4:15 pm

Hi.

Just happened to see this, which makes me suggest you post to a more widely read pane here, like "Talking LiveCode"

Craig Newman

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Understanding the timescale property

Post by Klaus » Fri Dec 07, 2018 5:58 pm

I can move this thread, but lets wait if Rand agrees!

minogaade
Posts: 9
Joined: Fri Aug 15, 2008 10:27 pm
Location: Madison, WI, USA

Re: Understanding the timescale property

Post by minogaade » Sun Dec 09, 2018 6:50 pm

Hi. Thanks for your suggestions, sorry to be slow in responding myself. Feel free to move the thread wherever it would be most useful for other LiveCode users.

Post Reply

Return to “Talking LiveCode”