OpenQNX :: The QNX Community Portal

May 13, 2008 - 12:32 PM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 61 unlogged users and 1 registered user online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
amc
Post subject: Basic sound timing question  PostPosted: Apr 22, 2008 - 02:47 PM
Active Member


Joined: Sep 19, 2007
Posts: 11

I am trying to create some basic sound output (sine frequency modulation basic on an analog input), and in need of some greater understanding of how audio works.

I have a function that fills an array with sine values for a supplied frequency, then I use a FOR loop to write this array to the audio buffer X times.

SOME DETAILS (I can post full/more code if desired)
Sample rate: 48000
Array size: 9600
Frag size: 9600
Frags max: 4
Frags min: 1
Interleave: 1
Voices: 1
Format: SND_PCM_SFMT_S16_LE (16 bit, signed, little endian)

I have looked at the audio output on a scope, and I am getting the desired frequency, so I think I am generating my sine array properly and sending it to audio buffer fine. But, I am not getting the expected duration. For example, if I write the array to the buffer 20 times, I was expecting to hear ~4sec of mono audio (20 * 9600 [samples] / 48000 [samples/sec] = 4 sec), but I am only getting about 1.4sec of sound.

I am having other problems with the sound (eg. 'beating' that seems related to buffer writes), but I think understanding this timing issue may help clear up some other things.

Any help, tips, links, knowledge on this timing confusion would be greatly appreciated.

Thanks, AJ
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.