Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Music

Status
Not open for further replies.

ianimp

Technical User
Mar 5, 2005
1
US
Is there a way to return a tone in PHP? When I used to program in BASIC in the 80s as a kid I could make the computer play back notes I programmed in. Does PHP do that? I've been trying to search for it, but the only thing I can get a result on is how to embed a .wav file or the like. Thanks much.
 
To the best of my knowledge, PHP has no specific functions for that.

If you are using PHP to produce a dynamic web page, the only means available for making a sound is embedding sound files on the web page. Even if PHP could produce sound itself, in a web environment it would be running on the web server, so the sould would be produced by the server's hardware -- and so only those web users who happened to be in the same room as the server would ever hear it.

If you're using PHP as a general-purpose scripting language that will be running a script on the user's machine, there are probably OS- and machine-specific methods available to you, possibly using PHP to run an external program.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Just for elaboration:
It is conceivable to use PHP to generate a MIDI file that is played by the client. However, that has more to do with MIDI than PHP. The fact that PHP is used to create that file is merely circumstancial.
 
Yes, To elaborate here:
PHP is *server side*, so it cant really do anything with the client!

You can however, with php, generate some content that is *client side*. That content is no longer php though.

Example:
You want to make some silly function, that every noob wants on his/her web-page, like maybe.. hmm.. let's say You want fading images!

You can then make php parse the javascript that fades the images, however it's the javascript that does the actual fading. (or, it's actually the browser, after a request from the javascript).

This is why it's not easy to make chat-clients, games, etc. that are not "tick based" in meerly php and html, as then you would have to refresh the web-page for any changes to be made.

One could however make it through flash, java or something like that, but then suddenly the users have to download additions to theire web-browser.

I however think that there is a line, let's say it goes like this:

No fancy effects [-----X---] All fancy effects

The X here, will vary based on what you want to present to your users.
If you want to have a gaming-site, I would say you could do maybe 80% flash-content.

If you are to have a site with meerly content, I would do max. 20% fancy content, but I would keep it as low as possible.

This X factor, will vary, based on what you have to present and how you can present it.

As for "embedding" files, you can make php attatch files through header(), but I for one, really hate those sites where you suddenly have music playing in the background.

Here too, the X-Factor comes into play! If it's a gaming site, for an action game, the background-sound might be cool in cooperation with some fancy flash-animations.

However, if you go to google to search, you dont want to hear music playing in the background.
Keep those background-attatchments where you have the "site in progress" animated gif's. (in your friends first webpage)

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top