Author Topic: Save "Effected" channel to disk  (Read 8480 times)

Sam

  • Guest
Save "Effected" channel to disk
« on: 23 Aug '03 - 01:09 »
I know this is possible, but I can't figure it out.

I want to record for 10 seconds, add some FX on it (like CHORUS), and then save it to a wav file (like in rectest).

I can easily record and save, but I can't add the effect and save.
I've noticed that you can't use set_FX with RECORDCHAN as the channel. And I haven't had much luck using custom streams. Maybe im doing something wrong. Any help would be appreciated.

Thanks

Zakhars

  • Guest
Re: Save
« Reply #1 on: 23 Aug '03 - 10:42 »
You can't add FX to a recording channel while saving it to the disk. FX should be applied in the second step,and your program could give user a preview of selected FX [like chorus,in your case] and then save it to the disk

so theorically it would be like this:

1.Record the input signal
2.Save it to a temporary file on disk
3.Open a new stream loading the temp file
4.apply the FX to the channel containing the stream
5.Save the stream to the disk

This way you'll let the user preview and audition the FX and then render the stream to the disk.the only custom StreamProc involved here is a simple procedure to write effected channel's buffer data to the disk,which could be found in BASS examples [check RecTest].


_____________________________________________________________
PS. dear Ian,could you please check what's wrong with my registration.i registered and received the e-mail with my username and password but i can't login. it says no such user exists... :-)

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Save
« Reply #2 on: 24 Aug '03 - 11:06 »
You can add FX/DSP to the recorded data (while recording), by feeding it through a custom decoding stream. See the code in this thread...

http://www.un4seen.com/YaBB.cgi?board=bass&action=display&num=1046890689#1

There's also an example of this technique in the RECTEST example that comes with BASSenc.


Quote
could you please check what's wrong with my registration.i registered and received the e-mail with my username and password but i can't login. it says no such user exists... :-)

I can see a user called "Zakhar" - maybe you entered "Zakhars" (as above)? :)

Sam

  • Guest
Re: Save "Effected" channel to disk
« Reply #3 on: 24 Aug '03 - 12:05 »
Thanks for the replies.

Ian, I did try the method of using a decoding stream. So like you said, I created a decoding stream, simply called get_data in my recording call back, setup an fx on the decoding stream, and then save the buffer of the decoding stream to an external buffer(in the stream call back), and save that buffer to disk, like it is does in rectest.
But what happens is that I can hear the effect while it is recording, but when I playback the file (in media player), it does not have the effect on it. I thought the buffer of the decoding stream should have the effect on it, but apparently not, because that is what I'm saving, and the effect is not there.
Any ideas?

Thanks a lot
Sam

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Save
« Reply #4 on: 24 Aug '03 - 14:52 »
The STREAMPROC is (of course :)) called before any FX/DSP are applied, so if you write the data to disk in there, it won't have the effects present. You should write the data to disk in the RECORDPROC instead, after feeding it through the custom decoding stream (the BASS_ChannelGetData call).

sam

  • Guest
Re: Save "Effected" channel to disk
« Reply #5 on: 25 Aug '03 - 21:21 »
You were right. It is fixed now.

I am just confused about something. How is it that the buffer is already full in the decoding stream (without calling getdata from RECORDCHAN, where as in the other user defined streams, we have to fill the buffer?

Sam

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Save
« Reply #6 on: 26 Aug '03 - 15:35 »
When you call BASS_ChannelGetData with a decoding channel, data is "decoded" to the buffer you provide with the call.

In this case, the buffer that the RECORDPROC received is passed to BASS_ChannelGetData, therefore the buffer that the STREAMPROC receives already contains sample data - the recorded data. So you don't want the STREAMPROC to do anything.