vee_yar Posted March 14, 2007 Report Share Posted March 14, 2007 Respected LabVIEW Experts, I want to play a audio signal with control over frequency and volume.Here i attached a VI which as got control over frequency,but i am unable to control the volume of sound played in the speaker.I want to have individual volume control for right and left speaker in the front panel(when PC Speaker volume is kept at the maximum position) kindly give suggestions to complete the program Thanks in advance Quote Link to comment
Jeff Plotzke Posted March 14, 2007 Report Share Posted March 14, 2007 I haven't tried it, but inside the 'Sound Output Set Volume' VI on the Sound Output palette, there's a subVI inside that gets the 'channels' of a sound device and sets the volume of all of them. Does each 'channel' refer to a speaker (ie, left/right). What if you use this VI and modify it to allow for two inputs, one for left speaker volume and one for right speaker volume? Quote Link to comment
vee_yar Posted March 15, 2007 Author Report Share Posted March 15, 2007 QUOTE(Jeff Plotzke @ Mar 13 2007, 09:10 PM) I haven't tried it, but inside the 'Sound Output Set Volume' VI on the Sound Output palette, there's a subVI inside that gets the 'channels' of a sound device and sets the volume of all of them. Does each 'channel' refer to a speaker (ie, left/right). What if you use this VI and modify it to allow for two inputs, one for left speaker volume and one for right speaker volume? Hi Jeff Plotzke sir, thanks for your immediate reply.Actually i am developing a simple audiometer for hearing test.The idea is to play a audio signal in the range of 20 cycles/sec to 10Kcycles/sec.when i run the VI the volume of the audio signal should increase automatically, and the user should stop the VI when he is able to listen the sound.The volume level at which the user stops the VI is taken for the calculation of the hearing loss.Here if we have individual control for right and left speaker then we can test the hearing loss of both right and left ear. Here I attached a VI which has got frequency and volume control.but the problem is the duration of the sound played is going on increases as time increases and also the delay(i.e 1ms)between each sound output is not maintained uniformly. Kindly help me to solve the issues Thanxs in advance Quote Link to comment
Jeff Plotzke Posted March 16, 2007 Report Share Posted March 16, 2007 QUOTE(vee_yar @ Mar 14 2007, 10:06 AM) Here I attached a VI which has got frequency and volume control.but the problem is the duration of the sound played is going on increases as time increases and also the delay(i.e 1ms)between each sound output is not maintained uniformly. Here's a few suggestions from playing around with your VI: -You may want to use the 'Sound Output Wait' VI after your Output Write VI to hold your loop until the sound has completed playing. After your Sound Output Wait, you can use a Wait (ms) VI to wait a given amount of time after your sound is output. This will help keep the duration between pulses equal. -Generate the amount of the sine wave you want in your Simulate Signal -- For example, right now you have it set for a simulated 10kHz acquisition and generating 5k points. Therefore, you'll get 0.5 seconds of a sine wave. Make sure that you generate as long as a sample as you need. -In the Output Configure VI, set the 'number of samples per channel' input to the number of points you're generating with the 'Simulate Signal' VI. If you leave this at 10000 and you give the sound output 5000 points, the sound card will actually output 5000 points that you gave it, then 5000 points of nothing. So, if you use the Output Wait VI, it actually waits for 10000 points. Therefore, it's probably a good idea to make sure that these two numbers match. -I also had much better timing switching to finite samples on the Output Configure. That said, I really wasn't able to get the duration of the time sample to change during my tests. Try out these suggestions and let us know if this doesn't fully correct it. Quote Link to comment
Adam Kemp Posted March 17, 2007 Report Share Posted March 17, 2007 Although the Sound Output Set Volume VI pretends to set volume on a per-channel basis, it doesn't really do that. It just takes the volume for the first channel and uses that as the volume for all channels. This is a known bug. I haven't fixed it because the DirectX API we use doesn't seem to actually have any method of setting volume on an individual channel, so the fix would be far more complicated than it should be (and few people have actually requested it). Even the Linux API we use only supports setting the volume for left/right channels. Even though it could theoretically use as many as 16 channels, it can only set volume for left/right. The LabVIEW code sets them both to the same value, though. Since you're generating your audio signal anyway, you should be able to simulate this by varying the amplitude of each channel separately. Quote Link to comment
Jeff Plotzke Posted March 17, 2007 Report Share Posted March 17, 2007 QUOTE(Adam Kemp @ Mar 15 2007, 07:05 PM) Although the Sound Output Set Volume VI pretends to set volume on a per-channel basis, it doesn't really do that. It just takes the volume for the first channel and uses that as the volume for all channels. This is a known bug. That's good to know. What about a way to pan your speakers from right to left output? I know there isn't a VI... perhaps a Windows API call? (I really don't need to do this... I'm just brainstorming) Quote Link to comment
Adam Kemp Posted March 17, 2007 Report Share Posted March 17, 2007 QUOTE(Jeff Plotzke @ Mar 15 2007, 08:54 PM) That's good to know.What about a way to pan your speakers from right to left output? I know there isn't a VI... perhaps a Windows API call? (I really don't need to do this... I'm just brainstorming) There is a way of setting pan in the API, but converting from the two volumes to one master volume and a pan setting would be more complicated than it's worth, and it can't be easily extended to other channels. Quote Link to comment
Firedragon Posted January 8, 2022 Report Share Posted January 8, 2022 Is this bug still going on? I'm on Win 10, LV2020 and DirectX is 12.0. The DirectX API applies all channels the same volume as the first and ignores the rest. TheĀ Sound Output Set Volume (array).vi appears to correctly send multiple channels volumes to the API but the API ignores all but the first. Anyone know of a work around? Thanks to any help. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.