Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Does anyone have the slightest idea how to read audio/music files as game data?  (Read 686 times)
0 Members and 1 Guest are viewing this topic.
Offline heisenbergman

JGO Coder


Medals: 14


L___ o_ G___ a__ P___


« Posted 2013-05-05 22:35:55 »

...like, reading an .mp3 file of, say, The Beatles' "A Hard Day's Night" and using it in some way as data in the game?

Offline HeroesGraveDev

JGO Kernel


Medals: 294
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #1 - Posted 2013-05-05 22:44:54 »

Load it through a DataInputStream and read level data off that.

It won't be pretty, but that's what you're asking for.

If you want something else, be more specific.

Offline davedes
« Reply #2 - Posted 2013-05-06 00:53:08 »

You can decompress to raw PCM float data (from WAV/OGG/MP3), i.e. in the range 0.0 .. 1.0, and then potentially do something interesting with the data.

A more practical application is to use a Fast Fourier Transform to split the frequencies of the sound data, i.e. to create a visualizer that reacts to bass hits. Or you can use onset detection:
https://code.google.com/p/audio-analysis/

If you just want to play the audio files in your game, you should use a solution like TinySound:
https://github.com/finnkuusisto/TinySound

Or if you are using LibGDX, it should be fairly simple to include audio in your game.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline heisenbergman

JGO Coder


Medals: 14


L___ o_ G___ a__ P___


« Reply #3 - Posted 2013-05-06 01:34:05 »

Actually, I was thinking more in terms of a game such as Audiosurf, which lets the player select a song from their music library and then builds the level that the player will play based on that song.

Offline Cero
« Reply #4 - Posted 2013-05-06 09:47:40 »

Actually, I was thinking more in terms of a game such as Audiosurf, which lets the player select a song from their music library and then builds the level that the player will play based on that song.

that would be the "potentially do something interesting with the data" part

Online gouessej
« Reply #5 - Posted 2013-05-06 12:03:07 »

You can use Paul Lamb Sound Library, it's very easy to use, it has tons of nice backends for both JavaSound and OpenAL, it supports several audio formats including Midi, Wav and Ogg. JOAL has a build-in wav decoder too.

Offline pjt33
« Reply #6 - Posted 2013-05-06 12:20:39 »

A more practical application is to use a Fast Fourier Transform to split the frequencies of the sound data, i.e. to create a visualizer that reacts to bass hits.
Or require MP3 and then you get data in the frequency domain already. Requires a bit more effort, perhaps, because decoders tend to be all-or-nothing.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (33 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (65 views)
2014-11-07 19:57:14

TehJavaDev (70 views)
2014-11-03 22:04:50

BurntPizza (68 views)
2014-11-03 18:54:52

moogie (83 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!