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.
Related
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'm currently recording an RTSP stream using the FFMPEG libaries (essentially recording in 1 minute video files). Everything is working well, with the exception that if I launch the video files, the player views them as streams, not as videos (so seeking is disabled, etc.).
I suspect I need to set the proper option when I am using avformat_write_header(output_context, NULL) instead of giving no options.
I've discovered the list of options in libavformat/options_table.h but none of them seem to apply. As an example of how I'm thinking I need to solve this, I've looked at https://ffmpeg.org/pipermail/libav-user/2013-January/003541.html and I see things like "sample_rate", "pixel_format" etc. that could be set. Is there something to set the metadata in the file I'm writing from an RTSP stream to behave as a video instead of a stream when I play it after the fact? Or if it isn't written with the header, is there some other way I can do this?
Seems like the issue is related to the specific video player being used, which makes me believe its not related to the meta data but how the player is interpreting the video stream.
If it does turn out that I can explicitly set this using the FFMPEG libraries I'll mark that as the accepted answer.
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
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?