Page 1 of 1

Thanks for Media / MP3 playback question

Posted: Mon Apr 10, 2006 2:13 pm
by FrankR
First - thanks for Media. I had evaluated RunRev in the past, and now I'm back with another project idea that Media might be the fit for.

While playing back MP3's, can I script:
- the start and stop time of a Segment of an MP3
- the number of times to Loop the segment
?

Thanks.

Posted: Tue Apr 11, 2006 12:48 pm
by FrankR
Bueller?

Posted: Tue Apr 11, 2006 1:58 pm
by marielle
Hi Frank,

I don't really use mp3 much. You will need to check out whatever I say and perhaps adapt the code to get it work.

In the doc, you need to look under "play" (dictionary)

Code: Select all

play "/usr/local/clips/music.aiff" -- a file
play videoClip "Movie" at 100,100 -- an imported video clip
play audioClip "Trust No One" looping
from the doc:
If you use the play...looping form, the sound or video plays continuously from start to beginning until you stop it.
if you kow how long it takes to make a single loop, then you can stop it after a given number of loops.

Code: Select all

send stopmovie to me in tmovietime seconds
on stopmovie
    stop playing audioClip "my audio clip" 
end stopmovie

Posted: Tue Apr 11, 2006 8:35 pm
by malte
Hi Frank,

if you want to use MP3 in your stacks, you need to use a player object. MP3 is not supported as an audioclip.
You can set the currenttime of the player and might be nterested in their callbacks property.

Hope that helps,

Malte

Re: Thanks for Media / MP3 playback question

Posted: Wed Apr 12, 2006 4:53 pm
by pevensen
FrankR wrote:First - thanks for Media. I had evaluated RunRev in the past, and now I'm back with another project idea that Media might be the fit for.

While playing back MP3's, can I script:
- the start and stop time of a Segment of an MP3
- the number of times to Loop the segment
?

Thanks.
You can set the start and stop time on a Player object, which you use to play an mp3 file, using startTime, endTime, and playSelection. You may also need duration and timeScale to figure out the desired values for startTime and endTime.

As far as looping only a number of times, I'm not sure there's an automated way to do it.

You could set up a handler on the player something like:

Code: Select all

on playStopped
    set the cpTimesToPlay of me to the cpTimesToPlay of me - 1
    if the cpTimesToPlay of me > zero then
        set the currentTime of me to the startTime of me
        start me
    end if
end playStopped
You would have previously had to set the cpTimesToPlay of your player to the number of times.