Mozart's Musikalisches Würfelspiel

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6464
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Mozart's Musikalisches Würfelspiel

Post by richmond62 » Sat Jan 09, 2021 5:00 pm

Which, probably, has got very little to do with either Leopold or Wolfgang, or Salieri, for that matter. 8)

I'm having a seriously nutty patch: and you too are welcome to partake in my lunacy:

Found this: http://www.cs.cornell.edu/courses/cs100 ... a5/a5.html

and thought I'd "have a go" in LiveCode:

https://www.dropbox.com/s/r52gkwlvshtnr ... e.zip?dl=0

-
MOZGEN.jpg
-
It is alright as far as it goes: BUT I cannot work out how to play audioClips sequentially so they sound like a single
sound file . . .

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6464
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Mozart's Musikalisches Würfelspiel

Post by richmond62 » Sat Jan 09, 2021 5:25 pm

This is the first time I have attempted anything with sound in LiveCode since 2004.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6464
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Mozart's Musikalisches Würfelspiel

Post by richmond62 » Sun Jan 10, 2021 10:29 am

I wonder why this:

Code: Select all

on mouseUp
get the length of audioClip "M9.wav"
end mouseUp
crashes LiveCode.

macOS 11.2 beta / LC 9.6.1

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6464
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Mozart's Musikalisches Würfelspiel

Post by richmond62 » Sun Jan 10, 2021 11:07 am

Screenshot 2021-01-10 at 11.59.04.png
-
If 'size' corresponds to the length of a piece . . .

The problem lies outwith LiveCode insofar as the WAV files I have of all the 'Mozart' measures have been regularised to 2 seconds in length,
obviously redulting in patch of silence at the ends of some of them.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6237
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Mozart's Musikalisches Würfelspiel

Post by jacque » Sun Jan 10, 2021 6:53 pm

LC has set up a method to do what you want, did you look at the "prepare" entry in the dictionary? The basic idea is to start the first audio file and immediately prepare the next. When the first one is done you'll get a message which you use to fire off the next one and prepare the following one. When I get back to my Mac I'll look up the message name unless someone else beats me to it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6464
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Mozart's Musikalisches Würfelspiel

Post by richmond62 » Sun Jan 10, 2021 7:10 pm

The problem does not seem to lie with LiveCOde, but with some software that I used to convert MIDI files
into WAV files. It 'padded' out each sound file to the nearest second: padding with silence!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6237
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Mozart's Musikalisches Würfelspiel

Post by jacque » Sun Jan 10, 2021 9:50 pm

Your best bet is to use a player control and sound files on disk. The player can be invisible if you don't want it to show. This lets you start the player at any location in the file, which will allow you to skip the silence at the beginning. You'll probably also want to skip any silence at the end, which you can do if you query the currentTime of the player and stop playback as needed, but it's much easier to just edit the file to eliminate the silences.

Once the files are cleaned up, use the method I described to seamlessly play back all the files. Without the prepare command, there will always be a delay between audio segments because LC has to load the entire content into memory before it can be played back. The prepare command was implemented to solve this problem.

The message that is sent when playback ends is "playStopped". Write a playStopped handler that immediately starts the next file and also prepares the following one so it's ready to go. That's as close as you'll get for continuous playback.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

capellan
Posts: 666
Joined: Wed Aug 15, 2007 11:09 pm

Re: Mozart's Musikalisches Würfelspiel

Post by capellan » Mon Feb 08, 2021 5:40 am

............

Post Reply

Return to “Multimedia”