I am haaving some problem with a loop in a Html5 game.
I have a sound ( 4-5sec) that I wanted to play with a loop.
But between each loop I can hear the sound stop (for 0.5sec) and replay.
I read that "MP3 has a 0,25 seconds piece of silence at the start of the audio file.",
and tried this:
start loop and sound for every sample at T = 0,25, so there were a preloading of all of the audio file, but play and loop after 0,25 seconds."
However, the delay is still present for mp3 ogg, or wave, (Firefox and chrome)
Can someone help me find a solution?
Related
I set my audio clip to loop (by checking off the loop checkbox in the audio source) however, after about an hour the audio stops playing. How do I fix this? Is there code that I have to add to the script?
Apparently the loop function is not indefinite.. not too sure about this.
Thank you!!
If your sound file is an .mp3, try changing it to an .ogg file. Unity seems to have some problems with .mp3.
Also, it could be simply be a lack of computing resources to run in play mode that long. Try building your application and seeing if the error still occurs.
I am trying to write a program to play a frequency for a time. I can't find any way of simply just playing a certain frequency. How do I go about doing this in OpenAL?
I eventually found a video on properly reading form a WAV file (huge credit to this video) and how a WAV file is formatted (explained here in detail) and did some trial-and-error work until I figured out how to do it. I figured that if I could make a WAV-style file with the frequencies in them and set up the OpenAL buffer and source manually, it would work.
I ran into some trouble when I found that the format differed from the first explanation of WAV file format I found, as some apparently have additional meta-data, which I had to test for and skip over when trying to load a WAV file. Then I made a WAV file containing the frequencies and played it, which worked as well as I could have hoped for.
Here's another article about how bit-depth works that really helped me understand what I was doing.
Hopefully this helps anyone else who is trying to do something similar to this!
I am working on a simple application using Gstreamer on C, that involves playing a song and show some info about it on terminal. Thta info includes the total length of the song in seconds. As usual, I used the function gst_element_query_duration to get this data. The thing is, when I run my program, sometimes it shows the right time on screen, but then I run it again and the total time showed is about 6 seconds less. Because is just a simple trial application, I am using playbin as the general bin for reproduction, so I tried with different file extensions and it seems this only happens with mp3 files. Have anyone ever experienced this? Any ideas on how to fix it?
MP3 has the problem that there is no duration stored inside the file (usually). With constant bitrate files you can simply check the bitrate and the file size, but for variable bitrate files you can only do an approximation based on that. Your problem is probably exactly that.
The only way to know the exact duration of a variable bitrate MP3 file without header information with the duration (see Xing header) is to parse the file until the end and count the exact duration. With playbin you should get the accurate duration at the end of the file.
Hey all I want to play a sound. I issue a c command and it plays the sound, then the user presses a key, let's say "h" and then the sound stops for 5 seconds, and returns after 5 seconds. What c command can i use to do this? I thought mci send string might work, but I'm not sure.
Play Sound was my go to but it doesn't have this functionality.
any code suggestions?
I assume you are using Windows
Use the waveOutPause() to pause the audio.
Use Sleep(5000);
Use the waveOutRestart() to start the audio from where it paused.
See also: waveOutPause MSDN documentation
How can I set my MediaElement (Silverlight) to play an audio file when it has some data (for example 10 % of the streamed file) ?
I want to start playback immediately after a little portion has buffered, then, if the application had no data, just pause the playback and wait. Is this possible?
Thanks in advance,
Regards
I think this is supported by the MediaElement. You just have to specify thru one of its properties whether it should Begin automatically.