|
Generating Musical Notes |
Daniel McKinnon
Member #7,364
June 2006
|
Okay, so my previous post got deleted somehow. So, I took someone's advice, never got the chance to thank them. It worked out I figured out wave_length = sample_rate / frequency; That's pretty streight forward, makes sense to me. Now, I'm having a problem with audio streams. I create the stream and then here's how I'm filling it up
I'm not sure if the code above compiles and works, it's just a demonstration of what I'm doing. Okay, so... It plays an A, but it's all choppy as if I'm not fully filling up the audio buffer. But clearly it says "play_audio_stream( BUFFER_SIZE... )" and "for ( i = 0; i < BUFFER_SIZE; i++ )" note usage of BUFFER_SIZE. Thoughts? |
miran
Member #2,407
June 2002
|
-- |
Daniel McKinnon
Member #7,364
June 2006
|
Hmm... Allegro.cc has been acting very strange on me as of late. Failing to post, hiding threads, etc... Anyhow, it sounds like I'm not filling the buffer up completely. There's a little jitter in the note. The funny thing is, if I play - I think - a 'D', it sounds smooth, and that's it. No idea why. Thanks again Miran for your help, your advice was perfect despite the small calculation error, I figured it out anyhow. (I seem to remember posting this comment earlier, but it never got posted). Edit: I think I may have figured it out. I was resetting the saw on every 'fill' |
miran
Member #2,407
June 2002
|
Quote: I think I may have figured it out. I was resetting the saw on every 'fill' Yeah, when you get to the next buffer, you need to continue from whereyou left off the last time. -- |
Neil Walker
Member #210
April 2000
|
Perhaps you clicked 'hide thread' by mistake. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
|