Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / Media Player visualisations from sound

Author
Message
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 19th Mar 2003 22:35
18 lines I think. Will load a sound and create a visualisation from it, just like Windows Media Player. Of course, it's not that pretty but shows it can be done

If you have DBP then there's no need for media (see code). Press space to repeat sound.

Thanks to Van-B for showing me how to use sounds and memblocks through that excellent waveform code

rem Load the sound to be used
load sound "C:\program files\Dark Basic Software\Dark Basic Professional\Media\Sounds\Aliens\Kamikazi.wav",1

rem Make waveform to show user and set up memblocks
sync rate 0 : make memblock from sound 1,1 : sndlen=get memblock size(1)

do

play sound 1 : start = timer()

do

rem Clear screen
cls

rem Get length of sound in SECONDS
secs = int((sndlen / (sound speed(1))))

rem Get the elapsed time in MILLISECONDS
elapsed = timer()-start

rem Get the stepvalue between each millisecond
stepval# = (sndlen / secs)/1000

rem Get the current position based on stepvalue
p = int(elapsed * stepval#)

rem Do not get info if past end of sound
if p
You are the http://s15.sitemeter.com/meter.asp?site=s15dtsig[/img]th person to view this signature.
Programmers don't die, they just Gosub without return....
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 20th Mar 2003 21:22
Oh dear. Code tag again. No wonder no-one's replied!

Try again. This should still be under 20 lines.



You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 22nd Mar 2003 22:01
Come on, someone must be interested

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 22nd Mar 2003 23:47 Edited at: 22nd Mar 2003 23:51
Cool

You can put this instead of circles to make line visualizations.


"All programmers are playwrights and all computers are lousy actors."

-Anon.

[href]www.geocities.com/andrew11m[/href]
PiratSS
21
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 23rd Mar 2003 03:50
Yea, that's really good!

Wait till you see my new 20 Liner...

Cheers.

Current project for RGT:

ALL MY STUFF ARE GONE!! ALL OF IT!!!
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 24th Mar 2003 21:56
Thanks

I just used the circle command to preserve line space. I suppose that it would be feasable to create really nice 3d ones, too.

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 24th Mar 2003 22:15
That line one is very good!

My only problem now is how to do the same for music. There is no "make memblock from music" command

You are the th person to view this signature.
Programmers don't die, they just Gosub without return....

Login to post a reply

Server time is: 2024-04-25 09:56:01
Your offset time is: 2024-04-25 09:56:01