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 / Obtaining sound audio data for equalizer visuals?

Author
Message
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 14th Aug 2013 05:31 Edited at: 14th Aug 2013 05:33
For my project, I would like to have a visualizer effect for sounds being played.

Normally I'd look for a DLL to help me out with this, but seeing as AppGameKit can't use DLLs, I'm at a crossroads here. I don't want to ditch the idea as it plays a large roll in the project, but I am not entirely sure if it's possible to write my own code for pulling equalizer data from a sound... while it's playing. Maybe if I can parse the sound file myself, compile an array of equalizer positions, I can create an animation that will closely resemble the sound when I play it... even if it's not equalizing the sound data BEING played, it may be good enough?

But now my questions are: What kind of audio file should I be looking to use? What would be the easiest file to work with for extracting the information I'll need?


I've tried doing some research on various formats and I have to say I'm almost totally lost here.
I'm trying to set up a basic example, using a virtual piano as a starting place. I've seen mention of SoundFonts, DLS files, as well as a couple others (not mentioned as often). Would I be better off using WAVs, or are these other formats the way to go?


[EDIT]

The application is aimed strictly at being compatible with Windows, so I'm not worried about compatibility with other platforms.


~Plystire

A rose is only a rose until it is held and cherished -- then it becomes a treasure.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 14th Aug 2013 09:35
To be honest, if you're only aiming at Windows you'd be better off not using AppGameKit but instead use C#, C++ or Pascal straight to DirectX. Unless you want loads of whizzing sprites, AppGameKit can be more of a hindrance than a help.

You'll certainly want to use an uncompressed audio format like WAV for instruments.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 15th Aug 2013 00:21
I was going to use AppGameKit since it already had support for multitouch devices, which is also part of the project. I'm not against coding support for multitouch in C++, just figured I'd save myself some trouble where I could.

Now, why would you suggest WAV? If I'm to be using C++, wouldn't it be best to just go straight for using the more widely used formats for synth instruments? Not trying to argue here, just wondering what the reason behind your suggestion is.


~Plystire

A rose is only a rose until it is held and cherished -- then it becomes a treasure.
fog
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 15th Aug 2013 01:09
If you want to do a proper visualiser and don't mind using C++ then you might want to have a look at FMOD. That will allow you to read the sound data of any music file as you play it. I did some cool effects with that in DBPro.

It depends on whether the licensing suits you or not though.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 15th Aug 2013 01:19
Well, the project is for a competition, so not entirely sure if the license covers that, considering I'd be earning money from the DLL if my application wins anything.

I'll most likely be using FMOD, just need to sort through how to handle individual instrument notes. Hope it won't be too processor intensive.


~Plystire

A rose is only a rose until it is held and cherished -- then it becomes a treasure.
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 15th Aug 2013 02:02
I know this is a long shot, but it would be amazing if AppGameKit could modify their built-in commands for music to include features like adjusting the playback speed of a song and also determining the beats per minute.

This would allow AppGameKit to be expanded into areas such as being used to make exercise apps. I'd support a kickstarter for this feature(s) in addition to additional console support

Hi there. My name is Dug. I have just met you, and I love you.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 15th Aug 2013 08:37 Edited at: 15th Aug 2013 09:36
Quote: "Now, why would you suggest WAV?"


Internally, all soft synths will use PCM data, because that's what the audio output hardware uses. Examples of PCM format are WAV, AU, AIF. During playback of (say) an MP3 or OGG file the compressed data is decompressed to PCM data.

SoundFonts and VST instruments use PCM data because that's the only way you can get microsecond precision. If you want to process or mix this data it has be in a format that can be manipulated quickly in memory.

If you're doing PC only, check out the DirectMusic interface. This can load DLS files.

However - DSound and DMusic are now actually deprecated, and it would be wise to use the newer XAudio2 subsystem, which is included in DirectX 10 and 11.

Without knowing exactly what the program is supposed to do it's difficult to give more detailed advice.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 15th Aug 2013 11:06 Edited at: 16th Aug 2013 09:45
Just to add to that - you could look at SDL - cross-platform library that includes low-level audio stuff:

http://wiki.libsdl.org/moin.fcg/FrontPage

EDIT:

On further reflection, OpenAL is probably the best way to go, unless you can find something else. It gives you total control over your buffers, so you can FFT away like crazy for visualisation of effects-generation.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL

Login to post a reply

Server time is: 2024-11-24 17:39:55
Your offset time is: 2024-11-24 17:39:55