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.

AppGameKit Classic Chat / Show a waveform from an .ogg file

Author
Message
Hubert BAYRE
7
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 28th Sep 2018 12:55 Edited at: 28th Sep 2018 12:59
Hi.
Please see my attached picture.
Is there a method to show a .ogg file waveform with code ? Or something else when you play an .ogg file ! I need to display something fun when the music file is played.
Many thanks.

Attachments

Login to view attachments
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 28th Sep 2018 13:57
It is probably possible using CreateMemblockFromSound() , to determine what the audio does at what point in the file at what playback time and then change bars or blocks in real-time based upon playback. But... not sure how to technically do it lol. I haven't dug into using memblocks yet. Really should though.

From manual:

"The duration of the sound can be calculated with the following formula, numFrames/samplesPerSecond"

..so I guess you could create a couple of bar images that make up a waveform using memblock, with the length / size calculated using the duration formula above.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 28th Sep 2018 15:21
I posted an example of doing this a few months ago. Loading a peice of music then getting average audio levels and then displaying the waveform and bargraphs of the volume etc...

Should still be on here somewhere.
Hubert BAYRE
7
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 29th Sep 2018 04:14
@Bengismo. Could you give me more info to find your previous post ? Keywords or Title to search it !
Many thanks.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 29th Sep 2018 11:46 Edited at: 29th Sep 2018 11:48
Its this thread from 1 month ago:

https://forum.thegamecreators.com/thread/222791

It uses loadsound() but you can just change that to loadsoundogg() and then be able to get audio levels.

Preben E did an example to which I could post up if wanted which is closer to what you want....with bars that animate with the music instead of a wave.
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 29th Sep 2018 16:27
Bengismo: Naaa the code is part of GameGuru Loader , but when you emailed me about how to do it , you said you did not have GG Loader , so i made that sample just for you, and its never been published

Anyway you can all have it, i have attached the project here.

Its the same as used in this video:



It also have the beat detection if you need object to react to the beat (global beaton = 0) when beaton = 1 then do something

If you already have GameGuru Loader , you can just copy the code from there.
Subscribe and checkout great AppGameKit video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,

Attachments

Login to view attachments
Hubert BAYRE
7
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 29th Sep 2018 16:32
@Bengismo : File was deleted from server.
Could you mail me the project to hubert.bayre@wanadoo.fr ?
Many Thanks !
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 29th Sep 2018 16:32 Edited at: 29th Sep 2018 16:35
The code that i posted was written from scratch so not game guru loader related at all.

In the case of Prebens though...it looked much better than mine i would have recommended anyone using that as mine just drawed the sound waveform and averaged over 100ms to give a sound level. Not quite as exciting as the visualisation in prebens work. Mine didnt do beat detection either.

And i do have ggloader now... Worth it for the PBR rendering alone!
Hubert BAYRE
7
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 29th Sep 2018 16:57
Thanks Preben for the code !
Hubert BAYRE
7
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 29th Sep 2018 17:05
@preben : Could i use ogg files with your code ?
Hubert BAYRE
7
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 29th Sep 2018 19:37 Edited at: 29th Sep 2018 19:50
Nice code.
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 30th Sep 2018 07:42
Bengismo: did not see your code, it was just your comment:
Quote: "Preben E did an example to which I could post up if wanted which is closer to what you want."

So i just wanted to post it before you, as i never published it anywhere , so NP dude.

Hubert BAYRE:
Quote: "Could i use ogg files with your code ?"


Never tried it but give it a go using "LoadSoundOGG" instead of "LoadSound" , let us know if it works

Subscribe and checkout great AppGameKit video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,
Hubert BAYRE
7
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 30th Sep 2018 14:26
@preben : with LoadSoundOgg no problem. Many thanks again for your code sample.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-23 16:26:17
Your offset time is: 2024-11-23 16:26:17