Is actually sound being played? - audio

There are a lot of reasons for sound not work (no speakers, speakers turned off, volume set to zero, software configuration problems, etc)
How can I discover from within my program if sound is working and being heard?

The only way to reliably do that is pretty much to ask the user:
play sound;
if (user_hears_sound_dialog)
sound works;
Edit: Please don't do an unannounced sound test by killing the users ears, potentially blowing his speakers and forcing him to kill the application. It's just not nice, see!

Of course only the user can decide if sound is working.
Programmatically, I believe that only with a micro you could trace sounds.

On the screen display two buttons.
Put a note below the buttons: "Please click the right button".
At the same time play this sound message: "Please disregard the note text on the screen and click the left button."
Wait for a button to be clicked.

Related

Play recorded audio into Communicator Business Edition (or Skype) while keeping mic active

I am having so much trouble doing something that should be SIMPLE. I do sales for a golf course and I have to read the same thing over and over again on every call and it gets so damn annoying. I want to be able to play a pre-recorded wave/mp3 file through the mic input of my headset so I can just play the recording at the right point in the sales cycle instead of repeating it 200X a day. I have succeeded in doing it with stereo mix BUT it will disable the voice aspect of the microphone so when the recording is finished, I have to jump into setting real fast and switch the mic input - which is not doable.
I know there is a way to do this. I see twitch streamers do this sort of thing all the time. I have tried SO MANY methods and nothing seems to work.

Play More Than One Sound Files in Livecode

I want to create a game with sound effects. When I start the game, the background music should be played until the game is over. When I click on something in the game (such as buttons), a sound effect should be played but the background music is stopped.
How can I make the background music play continuously while the sound effect from object is playing?
I already have these scripts...
Card script...
on openCard
play "backgroundmusic.wav" looping
end openCard
Buttons (or any object)...
on mouseup
play "sound.wav"
end mouseup
How to play these sounds together?
Update: I found a game uploaded to Game Jam. This game was ranked #1. When I play the game, the sound was amazing that it has background music and sound effects. But the owner of this game doesn't upload the livecode stack file in order to study it. The game was entitled Space Shooter Game. The sounds of this game is what I expect.
Note:
As what I figured out from the answers, using the player object can be work. But this requires QuickTime which I don't have that installed in my PC. I want also the sound to be able to play in mobile devices.
As it stands, the soundChannel property has no effect in LiveCode and is only provided for Hypercard compatibility.
Currently on desktop there are two ways to do multi-channel sound: 1) play imported sounds as one channel, and use a player object as the second channel, or 2) use two player objects.
Typically, a good option is to import short sounds as sound effects into a stack that only play once, and reserve the player object for background music. Imported sounds usually play with the least latency, however, you cannot play multiple imported simultaneously -- attempting to play a second sound while a first is playing will stop the first to play the second. If you have a need to play asynchronous sound effects, this option will not work; you must use a combination of playback options.
Multiple players can be used, but note that there can be some latency during the process of loading a sound (assigning a sound's filepath to a player) and playing it.
Also note that truly seamless playback of of a track is difficult if not impossible -- LiveCode will at some point become susceptible to some system event that will cause a slight pause between loops. A while back, Trevor Devore made an addition to his Enhanced QuickTime external that enabled true seamless looping of audio. However, with Apple getting rid QuickTime, it's unknown how much longer this option will be useful.
With the enhancements that the RunRev guys have been making to the engine, it's likely we'll see improvement with media playback and management, hopefully sooner rather than later.
In the LiveCode forums, they suggest using player objects on the card instead and telling them to play.
In HyperCard, you could set the soundChannel property for that. Have you checked in the LiveCode documentation whether it supports that? The docs for the play command and the the sound property might also help. Maybe those contain hints. FWIW, in HC
set the soundChannel to 1
play "BackgroundMusic"
set the soundChannel to 2
play "SoundEffect"
would play the sound effect and background music at the same time. Maybe that's how it works in LiveCode as well?
The multimedia capabilities are a going through a transformation. Previously everything was built around QuickTime (well almost everything) and you needed to add a player control for each concurrent sound. Currently the whole foundation is changed as Apple dropped QuickTime, but assuming you develop for desktop you should still (again) be able to add a player object and then use:
start player "name of player"
You can also create player object dynamically by
create player "my player""
and then use
set the filename of player "my player to "/path/to/your/audio/file"
before staring your sound. And as long as you have different players for your different sounds they should play simultaneously.
on openCard
put specialFolderPath("engine") & "/soundfx/backgroundmusic.wav" into tSound
mobilePlaySoundOnChannel tSound, "Background", "looping"
end openCard
on mouseup
play "sound.wav"
end mouseup

XNA, XACT ; how to apply delay and reverb to sound effects

I've just started looking at xact... I have it working basically. triggering sounds.
The reason I'm looking at xact is so I can use the same sound effect audio files and apply differing amounts of delay and reverb programmatically.
So depending on the size of the room you are in all sound effects played will have more or less delay and reverb.
The official documentation does not cover this (or DSPs in general) at all.
I've noticed there is a "Microsoft Reverb" DSP but I cant get it to do anything. Also can I use other DSPs ?
Links to any documentation explaining this would be great
I agree that the XACT documentation are very lacking.
As far as I found out there are only one DSP available that is "Microsoft Reverb" you mentioned.
To get it to work, you first create the Microsoft Reverb by right clicking DSP Effect Path Preset > Global and select "New Microsoft Reverb Preset". To make things obvious select "Massive" effect preset from Microsoft Reverb's drop down list. Then drag "Microsoft Reverb" to your sound bank name. Your mouse pointer should turns into "shortcut" icon when dragging over a sound bank that has no reverb applied yet.
You can confirm that there is an effect applied to your sound bank by looking at "Attached Objects" box of sound bank's property. There should be 1 effect in the right table of that box.
Test your sound bank by highlight it and press space bar. You should hear the reverb by now. Then proceed to reduce reverb parameter so it's less annoying.

How to capture still image from a live video programatically

When i try to take a screenshot of my desktop I found the area of the Windows Media Player window was empty, nothing in it, I google for it for a while and found that most of video players user Overlay surfaces for performance, and overlay surfaces can not be caputured, so some ideas come out said to disable the DDraw accelaration so that you can grap an still image from a live video, but when the player was launched, it's already use the hardware accelaration, even i disable hardware accelaration, it will not take effect until i relaunch the player, my question is: how to capture a image from a live video without diasble the ddraw accelaration? or how to make the settings(disable hardware accelaration) work work without relaunch the video player?
I won't play the vedio with my program, i just want to take a still
image while it is played by a 3rd party player such as Windows Media
Player or Real player etc...
I want to do this programatically, say
by C/C++ and DirectX, so I don't want to use any exsisting software
or tools
No matter which player in use, my program should capture it, I know some tool can do this like CapTrue and tencent qq, so i think it is possible to do so.
A workaround can be to use vlc to play your file. It gives a screenshot option in it directly.
AFAIK, this is an intentional "feature" in WMP, for protection. If you need to have WMP, then you need a decent screengrabber. Unfortunately, the ones I know like hypersnap are not free.
If you only want a screengrab of a frame, VLC is your friend, like #zdd said.

Touchscreen using sound input?

i don't really know if it is actually possible, but i believe that it can be made. How possible is it to make a program that recognizes different sound bouncing from the screen and turn it into a position that will obviously be later fed to the mouse.
I know that it sounds kind of dumb, but lately i've been noticing that a very dull, strong sound is made when touching the screen, and that sound varies when doing so at different positions. Probably the microphone "hears" differently because the screen acts as a drum with the casing. Anyways, what do you think, anyone has any experience programming with sound?
First of all most domestic touch screens work by detecting pressure based on a criss-cross mesh layer underneath the display layer.
However I have seen an example where a touch interface was interrogated onto a pane of glass, it used 4 microphones to determine the corners, when you tapped a certain part of the screen it measures the delay in the sound getting to each microphone, therefore allowing one to triangulate the touch.
This is the methodology you would use, you don't even need to set up the hardware to test it, you could throw up an interface in VB, when you click in a box it sends out a circular wave and just calculate using the times it takes to reach the 4 points where the pointer is.
EDIT
As nikie suggested, drag & drop, or any kind of gestures would be impossible using the microphone method, as the technique needs a wave of sound to detect the input.
http://computer.howstuffworks.com/question7161.htm
I don't know if this will get you far, but you can investigate the techniques used in MIDI drums for returning various nuances of play.

Resources