What Im trying to do is similar to the recording demo in the archive, but not quite.
I want to:
1) Create a continuous buffer of about 1
2) record samples into that buffer for the duration of the program
3) read data out of that buffer and write the samples to another file (assuming these are wav samples)
4) do conversion stuff on the external files created (outside the scope of FMOD)
Not interested in playing the data because I have to do some other conversion stuff before I can play. Just need to get the samples for now.
Does this require a lock/upload combination? Can I just make a pointer to the sample buffer and use it to read some bytes inside a do/while loop? I also ensure that the read pointer doesnt catch up with the recording pointer…
If there is an easy way to do this (or even a way period) please let me know! Thanks in advance for any responses.
- thorrin asked 17 years ago
OK, thank you. I might give this a try later on. I went and looked at the record sample program a little more closely and saw that what you suggested would work. As of right now, I just use 2 samples and ping pong between them. I begin recording the second one immediately after the first one finishes. Then I do a lock on the first sample, add wav header data, and write to a file. Works pretty well with no noticable data loss.
I might go back and redo with the looping sample, but if it aint broke… 😉
This API is really nice! Kind of like OpenGl but with sound. Keep up the good work!
Hmm, that solves part of the mystery for me, I’ll have to try that as well (saving recorded stream to file).
The other chapter in my mystery is being able to get a VU reading on the recorded sample, without playback. I’m not interested in spectrum – not yet brave enough to make sense of that array, my VU’s look cool enough hehe.
I’ve said it in other posts I’m sure you’ve read, but my eventual goal is to have some kinda data stream from the app that can replace Winamp/Shoutcast plugin for streaming internet radio to a server. I’d appreciate any tips for that 😉
- K6Deux answered 17 years ago
This is not too bad. If you KNOW the length of the sample (and you will since you have to set it when you init), you can use the same wav header over and over since all your files will be the same size.
something like (assuming you are looping
calculate begin/end pointers to sample data
memcopy wav header to another buffer
sample lock and memcopy sample data to buffer
play that sample
here is a page that explains the wav format.
May look intimidating at first if you arent familliar with hex code and stuff, but its really easy. The endianness is another “fun” challenge.
(hope this posts right)
Please login first to submit.