Jump to content

how to manage sound


jebat886

Recommended Posts

Hi anyone..i need some i've found that MsAccess able to record sound by using OLEOBJECT in .wav formatthe problem is when i've tried to connect the database in asp pages the other data able to read but the sound that i've stored within the same .mdb file cannot read..Please give me suggestion

Link to comment
Share on other sites

What happens when you try to read it? How are you trying to read it? What are you trying to do with the data? To reproduce a binary file that was stored in a database you typically need to send the HTTP headers for the correct content type to tell the browser what type of file it is, what the name of it is, and how big it is, and then send the actual data. Binary data isn't like text data.

Link to comment
Share on other sites

What happens when you try to read it? How are you trying to read it? What are you trying to do with the data? To reproduce a binary file that was stored in a database you typically need to send the HTTP headers for the correct content type to tell the browser what type of file it is, what the name of it is, and how big it is, and then send the actual data. Binary data isn't like text data.
i read it with SQL..when i tried to read the other table is ok and the table that stored sound will come out like this ?![] i dont know how to manage it..i'm a student and i'm doing my project paper and what i'm trying to do is online english-local dialect dictionary where when user click the alphabet..it will returns the value of the selected alphabet and there are colum which is "sound" colum where user can played the sound that i record in the database which is in the local dialect.Is there possible to do..
Link to comment
Share on other sites

If you have a database field with binary data in it that you read out of a file, like a .wav file, then in order to send it to the browser to play you need to do like I said above, send the headers that tell the browser what the file is, then the data.

<%' the "data" variable is your binary data from the databaseResponse.ContentType = "audio/wav"Response.AddHeader "Content-Length", len(data)Response.AddHeader "Content-Disposition" "attachment;filename=sound.wav"Response.Write(data)%>

Link to comment
Share on other sites

If you have a database field with binary data in it that you read out of a file, like a .wav file, then in order to send it to the browser to play you need to do like I said above, send the headers that tell the browser what the file is, then the data.
<%' the "data" variable is your binary data from the databaseResponse.ContentType = "audio/wav"Response.AddHeader "Content-Length", len(data)Response.AddHeader "Content-Disposition" "attachment;filename=sound.wav"Response.Write(data)%>

I have a file name data.mdb, the table that hold the information Id- AutoNumberenglish- store the english wordskadazan- store the words in local dialectsentences- store the sentences example of the wordssound- OLEOBJECT which is the sound that recorded within the database itselfI dont understand the code - "attachment;filename=sound.wav" whats exactly it point to..
Link to comment
Share on other sites

No, it tells the browser the filename of the wav file that it's downloading. It doesn't point to anything. If someone's browser doesn't support playing audio and they try to play it they will see a download box show up for the file and the default filename will be "sound.wav". You can change that if you want to change the default filename.You might want to reconsider using OLE objects though. OLE objects contain a lot of overhead that you don't need, and since Access has a 2GB size limit for a MDB file, then storing a lot of OLE objects is going to cause your database to fill up pretty quickly. It would be better if you changed the field to a long binary field instead of OLE object and saved the binary data of the actual wav file, or even better if you can save the file in a folder somewhere and just save the filename in the database. Either of those are going to work better than using an OLE object (the code I posted above is the code to output a long binary field). I can't find many examples about getting an OLE object out of a database and using it. Everything I see related to OLE objects and databases (especially Access) says not to use them together.

Link to comment
Share on other sites

One thing that I have done with db is rather than including the big multimedia file inside the db is to store the path/filename in a field in the table. I have done it with photos and it will also work with sounds. This keeps the db size down and the data transferred from it to a minimum.Just realised I have echoed some of the last paragraph in the previous post.

Link to comment
Share on other sites

One thing that I have done with db is rather than including the big multimedia file inside the db is to store the path/filename in a field in the table. I have done it with photos and it will also work with sounds. This keeps the db size down and the data transferred from it to a minimum.Just realised I have echoed some of the last paragraph in the previous post.
what you mean by store path/filename in a field in the table..i can't catch it i have tried what justsomeguy advise in the message above but there's an error and it state at "line 5 colum 40 which is "Response.AddHeader"Content-Disposition" attachment;filename=sound.wav".. what's wrong with that
Link to comment
Share on other sites

I mean store the filename in the field instead of an OLE object. Instead of using an OLE object to hold a wav file, just save the wav file on the server, like sound1.wav. Then in the database you store "sound1.wav" instead of the actual data, then you look up the filename from the database and link to it on the page.There shouldn't be a problem with that line, do you have a space after AddHeader?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...