openal - get the current volume

I am trying to animate displayobjects witch are moving to the volume of a playing sound.
(Note that this is not the gain of the source.)

Is it possible to get this value with the help of openal?

Thanks :wink: [import]uid: 7190 topic_id: 32740 reply_id: 332740[/import]

If I understand the problem correctly: you want the absolute loudness of the sound that is playing at an exact point in time (effectively the final value rendered to the sound card at a given moment). Unfortunately, this not really possible with OpenAL. For this kind of thing, you would have to do this yourself. You would need a copy of the PCM data and keep track of the seek position (within a margin of error) and also know how OpenAL effects are transforming the volume. None of this is currently practical with Corona. (We would need to expose PCM arrays through Lua and that could be slow, plus expose you to a lot more complicated audio details which most users wouldn’t understand.)

[import]uid: 7563 topic_id: 32740 reply_id: 130180[/import]

If I understand the problem correctly: you want the absolute loudness of the sound that is playing at an exact point in time (effectively the final value rendered to the sound card at a given moment). Unfortunately, this not really possible with OpenAL. For this kind of thing, you would have to do this yourself. You would need a copy of the PCM data and keep track of the seek position (within a margin of error) and also know how OpenAL effects are transforming the volume. None of this is currently practical with Corona. (We would need to expose PCM arrays through Lua and that could be slow, plus expose you to a lot more complicated audio details which most users wouldn’t understand.)

[import]uid: 7563 topic_id: 32740 reply_id: 130180[/import]

Yes you understood my problem right. I’m searching for the absolute loudness of a playing sound.

I am already getting the seek position with the help of openal:

local backgroundMusic = audio.loadSound("je-mappelle\_real-vrc7.mp3")  
local backgroundMusicChannel, backgroundMusicSource = audio.play( backgroundMusic, { channel=1, loops=0 })  
  
local function onEnterframe()  
 sec\_offset = al.GetSource(backgroundMusicSource, al.SEC\_OFFSET)  
 print(sec\_offset) --seeker position  
end  
Runtime:addEventListener("enterFrame", onEnterframe)  

Now I would only need the raw audio data (PCM array) to read out the values.
The openal transforming of the volume is not really necessary for my app.

I hope coronalabs is working on a solution for audio monitoring :wink:
(something like this would be really nice: http://fancyratstudios.com/2010/02/programming/cocos2d/fun-with-cocosdenshion-and-audio-metering/)

Thanks for the Infos
Alex [import]uid: 7190 topic_id: 32740 reply_id: 130186[/import]

Yes you understood my problem right. I’m searching for the absolute loudness of a playing sound.

I am already getting the seek position with the help of openal:

local backgroundMusic = audio.loadSound("je-mappelle\_real-vrc7.mp3")  
local backgroundMusicChannel, backgroundMusicSource = audio.play( backgroundMusic, { channel=1, loops=0 })  
  
local function onEnterframe()  
 sec\_offset = al.GetSource(backgroundMusicSource, al.SEC\_OFFSET)  
 print(sec\_offset) --seeker position  
end  
Runtime:addEventListener("enterFrame", onEnterframe)  

Now I would only need the raw audio data (PCM array) to read out the values.
The openal transforming of the volume is not really necessary for my app.

I hope coronalabs is working on a solution for audio monitoring :wink:
(something like this would be really nice: http://fancyratstudios.com/2010/02/programming/cocos2d/fun-with-cocosdenshion-and-audio-metering/)

Thanks for the Infos
Alex [import]uid: 7190 topic_id: 32740 reply_id: 130186[/import]

I thought this Kickstarter project was beyond cool. These brothers are building a 3D flight simulator using a robot ball as the controller. It appears that its for the iPad and iPhone. I think this is a very unique idea and I want to try their app! http://www.kickstarter.com/projects/858730843/sphero-glide [import]uid: 193761 topic_id: 32740 reply_id: 130218[/import]

I thought this Kickstarter project was beyond cool. These brothers are building a 3D flight simulator using a robot ball as the controller. It appears that its for the iPad and iPhone. I think this is a very unique idea and I want to try their app! http://www.kickstarter.com/projects/858730843/sphero-glide [import]uid: 193761 topic_id: 32740 reply_id: 130218[/import]