Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Can you play sounds and record the output?

Author
Message
Anigma
15
Years of Service
User Offline
Joined: 25th Mar 2011
Location:
Posted: 17th May 2013 22:38
Just curious - my teenage son wants some simple software to make "beats" with (his term for music loops). I figure DBPro would be an easy way to throw something together for him to use. The way it would work is you would select a series of WAV files you wanted the player to play (and at what intervals) to create a drum beat pattern for example, then save the result as a WAV file that you could then distribute to your friends and say "look what I made".

I know there's all sorts of free and paid for software out there to do this sort of thing but what fun is that? I want to write it myself because I like being able to say "look what I made" too. The question I can't answer off the top of my head though (and after poking around the forum a bit) is whether or not DBPro can record the output of all these WAV files playing into another WAV file. I know you can record from the microphone but thats' not what I want. I want to be able to mix several sounds together and record the result into a single WAV file. Can DBPro do that?

Thanks!

It compiled! Ship it!
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 18th May 2013 21:42 Edited at: 19th May 2013 02:07
Yeah, you could do that. You could probably reroute the audio output to the input, but I'm not totally sure how to do that, and you'd probably lose quality that way (EDIT: one way to do it might be to put an audio cable from your line out jack to your mic in jack). What I'd do instead would be to use memblocks to mix the WAVs together. If you don't know, memblocks let you access the raw data from different types of media.

If you create a new memblock (MAKE MEMBLOCK) that's big enough to store one whole loop, you can take smaller sounds and convert them to memblocks with MAKE MEMBLOCK FROM SOUND, and then take the data from those and stick it into the new memblock at appropriate points. If they overlap you can mix them together by simple addition, I think (as long as you make sure the value doesn't go above the maximum "clipping threshold").

Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 19th May 2013 00:59
This is difficult to do since you need to cancel the output out of the microphone input. Otherwise you'll end up with high pitched feedback. This is complicated since sometimes people/hardware have delays in sound input/output. The timing for noise canceling needs to be really good. It's sometimes a concern.

You can cheat and skip this issue by using headphones or a mic headset and not speakers.

Derek Darkly
14
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 20th May 2013 21:02
Until you can get this worked out, your son might enjoy using a free program called Audacity: http://audacity.sourceforge.net/

It's worth having just for the effects, and you can export your mixes to almost any format including MP3.

D.D.
Anigma
15
Years of Service
User Offline
Joined: 25th Mar 2011
Location:
Posted: 20th May 2013 23:00
Quote: "If you create a new memblock (MAKE MEMBLOCK) that's big enough to store one whole loop, you can take smaller sounds and convert them to memblocks with MAKE MEMBLOCK FROM SOUND, and then take the data from those and stick it into the new memblock at appropriate points. If they overlap you can mix them together by simple addition, I think (as long as you make sure the value doesn't go above the maximum "clipping threshold")."


Ah, yes - this. This is what I want to do. I figured there had to be a way. Anyone happen to have an example of this in action that I could pilfer from? If not I suppose I can search around but if someone's got an example already that will save me a step. Basically what I'm looking to do is create a memblock, load it up with sounds and then save that memblock back out as a finished WAV.

Thanks!
-Anigma

It compiled! Ship it!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st May 2013 00:43 Edited at: 21st May 2013 00:52
There used to be an example called something like CreateSound. I think it was one of Ric's programs. I'll see if I can find a link. You should be able to adapt that example.

Edit Here it is:

Create sound - no media

Obviously you do have media, but this code might show you what you need. It's been a while since I looked at this so apologies if it doesn't help.
Anigma
15
Years of Service
User Offline
Joined: 25th Mar 2011
Location:
Posted: 21st May 2013 01:02
Thanks Gandalf, I will need to check that out at home (at work at the moment) but from what I see that might just be the droids we're looking for!

-Anigma

It compiled! Ship it!

Login to post a reply

Server time is: 2026-07-07 10:33:49
Your offset time is: 2026-07-07 10:33:49