flat assembler
Message board for the users of flat assembler.

Index > Windows > music player

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4347
Location: Now
edfed 06 Jul 2011, 11:44
when i first tested the demos of fasmw, i tryed to modify a little the beer demo, in order to play a mp3 on a condition (hit the cancel button), and it works quite fine, only a problem with the stop of the mp3, it plays until the end of the song.

i suppose it is a minor thing to do, but when i look closer to my needs about a music player, i see i really need the oscilloscope view of the entire song, like in every good music softwares.


but i don't need to have a very complicated music player, just a tool bar with the music buttons, a sort of playlist, and the songbar with the oscilloscope of the entire song, with a cursor.

then, i really wonder, what kind of lib i can use for this.

i think about opengl because it is a verycool lib, and will let the music player become a psychedelic music player, using some image viewing and graphic effects to animate the song.

but before graphics, just have the music playback is essential of course.

then, i propose to discuss about the interface and the structure of this application.

first:

compile in a very little executable file, with no external dependencies other than the lib used to code it.
just use libs compatible with win9x and that don't need to install something.
play WAV, MP3, OGG, MIDI

be very fast:
to open
to play and change music
to close
to reopen
etc...

to be coded before december 22th 2012.

anybody here have something like an help to give in order to code this music player?


it will look like this:
Image
Post 06 Jul 2011, 11:44
View user's profile Send private message Visit poster's website Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22 06 Jul 2011, 13:14
For playback mciSendStringA API
http://board.flatassembler.net/topic.php?t=12888

For listing files FindFirstFile and FindNextFile APIs
http://msdn.microsoft.com/en-us/library/aa364419%28v=vs.85%29.aspx
Or you could use the open file dialog GetOpenFileName API
http://msdn.microsoft.com/en-us/library/ms646927%28v=vs.85%29.aspx

For visualizing the data it gets a little tricky. You need the sound data in PCM format (bytes/words that represent the amplitude of the wave).
I high pitched sound PCM would be like
0 5 10 20 30 20 10 5 0
A low frequency sound PCM would be
0 1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1
You'd plot it on the screen or in a graphics engine like the windows sound recorder does.

You could use a library like LAME or other library to convert MP3 to WAV then you'd be able to play the sound in OpenAL and visualize it with OpenGL

mp3 to wav libmad
http://www.codeproject.com/KB/audio-video/madlldlib.aspx
open al play wav
http://www.edenwaith.com/products/pige/tutorials/openal.php#code
Post 06 Jul 2011, 13:14
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4347
Location: Now
edfed 06 Jul 2011, 14:37
cool.

about the signal representation, lets say it will use only the envellope of the song.
for very short files like samples, the signal will be displayed dot per dot.

this is the scope part.

thank you for the playback part keywords, now i will learn more about this openAL thing, i hope it is something like win9x compatible.


then, if you believe it is forced to use something like lame to convert mp3 to wav, i will do it, because i don't want (and don't have hability) to code the mp3 decoder now. but latter, it can be interresting to write something like MP3 codec in asm. Laughing

then, lets go for the reading.
Post 06 Jul 2011, 14:37
View user's profile Send private message Visit poster's website Reply with quote
goldenspider



Joined: 16 May 2011
Posts: 38
goldenspider 09 Jul 2011, 15:13
You can use mpg123 ,LAME or other library to convert MP3 to WAV .

http://www.mpg123.de/

http://www.asmcommunity.net/board/index.php?topic=30509.0
Post 09 Jul 2011, 15:13
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.