electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  Antimon Antimon's Half Year Report
Please visit the chat
 Forum index » DIY Hardware and Software » ChucK programming language
Multiple inputs into Chuck
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [23 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Antimon



Joined: Jan 18, 2005
Posts: 3684
Location: Sweden
Audio files: 266
G2 patch files: 96

PostPosted: Sun Dec 21, 2008 7:30 am    Post subject: Multiple inputs into Chuck
Subject description: What's the easiest approach?
Reply with quote  Mark this post and the followings unread

I'm trying to use the inputs on my Motu Ultralite to route stuff into LiSa, but I'm having problems. I seem to be able to use the first mic input (tried it with my guitar) by specifying --adc4 on the command line (I guessed that adc numbers match the dac numbers that I see with chuck --probe).

Then I tried one of the stereo inputs, and that doesn't sound so nice. Here's the source code that I'm experimenting with:

Code:
adc.chan(2) => dac;

while (true) {
        1::day => now;
}


and here's the command line:

Code:
chuck --adc4 --in8 test.ck


If I leave out the --in8 parameter I get this:

Code:
[chuck](VM): NullPointerException: (UGen link) in shred[id=1:test.ck], PC=[8]


which I guess means that I have to specify the amount of inputs if I want to use adc.chan(2) in the program. I am attaching samples of what the original sound source and the result when dragged through ChucK (recorded with a mic next to a noisy PC box) sounds like. They were recorded simultaneously.

I get the impression that something is wrong with the data format, like 16 bits are sent but 8 are expected, or something like that. Do you agree?

I can't be the first one to try out mulitple inputs into ChucK like this... I remember I had similar problems when trying out multiple outputs - that was a matter of trial and error to find the correct argument (--out8 even though chuck --probe tells me my sound interface has 14 outputs). I've tried the settings that I could think, now I'm starting to feel like I'm clutching at straws. Any ideas?

Here's what the probe says:

Code:
[chuck]: ------( chuck -- dac4 )---------------
[chuck]: device name = "MOTU: MOTU UltraLite"
[chuck]: probe [success] ...
[chuck]: # output channels = 14
[chuck]: # input channels  = 12
[chuck]: # duplex Channels = 12
[chuck]: default device = YES
[chuck]: natively supported data formats:
[chuck]:    8-bit int
[chuck]:   16-bit int
[chuck]:   24-bit int
[chuck]:   32-bit int
[chuck]:   32-bit float
[chuck]:   64-bit float
[chuck]: supported sample rates:
[chuck]:   44100 Hz
[chuck]:   48000 Hz
[chuck]:   88200 Hz
[chuck]:   96000 Hz


Edit: something went wrong with the ChucK version, reattaching the file...

/Stefan


Original.mp3
 Description:
Recorded from the sound source

Download
 Filename:  Original.mp3
 Filesize:  78.78 KB
 Downloaded:  388 Time(s)


Through ChucK1.mp3
 Description:
Recorded after having gone through ChucK

Download
 Filename:  Through ChucK1.mp3
 Filesize:  78.78 KB
 Downloaded:  387 Time(s)


_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20473
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Sun Dec 21, 2008 7:42 am    Post subject: Re: Multiple inputs into Chuck
Subject description: What's the easiest approach?
Reply with quote  Mark this post and the followings unread

Antimon wrote:
I am attaching samples of what the original sound source and the result when dragged through ChucK[...]


The dragged through ChucK one is completely silent here ... I mean ... uniform noise at around -84 dB ... probably not what you meant to send?

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 3684
Location: Sweden
Audio files: 266
G2 patch files: 96

PostPosted: Sun Dec 21, 2008 7:44 am    Post subject: Re: Multiple inputs into Chuck
Subject description: What's the easiest approach?
Reply with quote  Mark this post and the followings unread

Blue Hell wrote:
Antimon wrote:
I am attaching samples of what the original sound source and the result when dragged through ChucK[...]


The dragged through ChucK one is completely silent here ... I mean ... uniform noise at around -84 dB ... probably not what you meant to send?


Yes, sorry about that - I've attached a more correct version.

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 3684
Location: Sweden
Audio files: 266
G2 patch files: 96

PostPosted: Sun Dec 21, 2008 7:54 am    Post subject: Reply with quote  Mark this post and the followings unread

OK, like the last time, it payed of to write a post here, think some more and then try something stupid like adding --out8 to the command line and see what happened. The output no longer comes to the main ultralite output, rather the first numbered output, but anyway it works! Very Happy scratch

I think this should be enough for my purposes - but a little annoying. Don't y'all ever run into these things with your sound interfaces? Smile Feels like black magic...

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20473
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Sun Dec 21, 2008 9:00 am    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:
I think this should be enough for my purposes


Laughing the bad file sounded sort of nice though Shocked

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 3684
Location: Sweden
Audio files: 266
G2 patch files: 96

PostPosted: Sun Dec 21, 2008 9:19 am    Post subject: Reply with quote  Mark this post and the followings unread

Blue Hell wrote:
Antimon wrote:
I think this should be enough for my purposes


Laughing the bad file sounded sort of nice though Shocked


Yes, I thought it was a cool effect. Smile A bit boring if everything sounded like that though...

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Dec 21, 2008 10:12 am    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:

I think this should be enough for my purposes - but a little annoying. Don't y'all ever run into these things with your sound interfaces? Smile Feels like black magic...


No, I don't. My EMU 1616m has been vary stable and predictable with ASIO ChucK; outputs just use it's virtual ASIO busses, starting at 1 and I've used it up to 6 outs. I should mention the EMU doesn't make a distinction between "main" and "numbered" outputs like your card does, instead it can offer a number of ASIO and WM channels to applications and those can be routed to physical outputs or to -for example- WM inputs that can be send to another program.

I can't remember ever having issues with inputs but than again; I don't think I ever tried using more then two of those either.

Thought for a moment that Plork was using Motu interfaces but it turns out they use Edirol. Hmmmm. And the results of --probe look very healthy as well.

Did you verify that using this mic on this input does work well when recording to -say- Audacity?

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 3684
Location: Sweden
Audio files: 266
G2 patch files: 96

PostPosted: Sun Dec 21, 2008 11:19 am    Post subject: Reply with quote  Mark this post and the followings unread

(I forgot to mention that I'm running on OSX)

The Motu works pretty much as it's supposed to with Ableton Live, I use multiple ins and outs pretty often. Funny you should mention Audacity, because that one also has problems, though those are usually that I get silence after I select one input, then when I record, stop record and try to record again it seems to have forgotten about my input setup. I figured it was a general Audacity issue on OSX, but maybe it's stuff like this that make people whine about their Motu gear every now and then.

But the effects I get when ChucK and the Motu act together are really weird. If I try some other number than 8 with --out8 (I've seen this in earlier experiements) I get stuff like identical output on all dac outputs on the box (even though I am only outputting on, say dac.chan(2) in the ChucK app) or every second or third channel, with or without mangled sound like in the example above.

One thing I wanted to try but didn't find out how was to change to bit resolution - I can change the sample rate with --srate but I don't see how to change to using 8 bits or floats. The reason I wanted to try this was that changing the sample rate didn't help.

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Dec 21, 2008 11:57 am    Post subject: Reply with quote  Mark this post and the followings unread

Yeah, I thought I remembered you ran OSX; that shouldn't really affect this. I just picked Audacity as it's free and cross platform so it's a good example but yes, I heard that the OSX version is lagging which is annoying as it's meant to be inspired by Soundforge which just so happens to be *the* audio app that OSX needs. Sigh. Oh, well it once again turns out we can't have it all and Live is great anyway.

So... if it works in Live this is has to be a ChucK issue, or maybe a MOTU one or possibly a RTAudio one. It's a bit strange to me that the outputs would switch depending on how many you use. I can't imagine that's something that RTAudio would do. I also can't imagine that bit-depth or rate would affect matters... and on top of that I don't think ChucK can switch bit-depth. Internally bit-depth will always be double floats, I think ChucK depends on the soundcard to set bit-depth for the final output.

Erm, I'm a bit at a loss here. My next step would be reporting this to the list as I think RTAudio's maintainer (I think that's Gary Scavone, from memory?) is on there. There may be some issue with the Motu. Just to make sure; you did verify that you are using the latest drivers and that there have been no firmware updates?

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Sun Dec 21, 2008 11:57 am    Post subject: Re: Multiple inputs into Chuck
Subject description: What's the easiest approach?
Reply with quote  Mark this post and the followings unread

Antimon wrote:
I seem to be able to use the first mic input (tried it with my guitar) by specifying --adc4 on the command line (I guessed that adc numbers match the dac numbers that I see with chuck --probe).


hmmm, you tried a mic input with your guitar. Does this mean that you plugged your guitar into the mic input? That's not kosher because the mic input has too much gain, the signal will be clipped, which is what the "through ChucK" sample sounds like. Or maybe you were using a mic and have this problem? It's difficult to tell from the way you worded that.

Why not try the miniAudicle and look to see what appears in the input selections? It may be an OS X configuration issue, like you have to select it in Sound of System Settings or something. I know when I use line-in with my guitar plugged into it, I must select line-in in System Settings / Sound.

Maybe that helps? I'm not clear on your problem, but try those things. Cheers!

_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Antimon



Joined: Jan 18, 2005
Posts: 3684
Location: Sweden
Audio files: 266
G2 patch files: 96

PostPosted: Sun Dec 21, 2008 1:17 pm    Post subject: Re: Multiple inputs into Chuck
Subject description: What's the easiest approach?
Reply with quote  Mark this post and the followings unread

Inventor wrote:
Antimon wrote:
I seem to be able to use the first mic input (tried it with my guitar) by specifying --adc4 on the command line (I guessed that adc numbers match the dac numbers that I see with chuck --probe).


hmmm, you tried a mic input with your guitar. Does this mean that you plugged your guitar into the mic input? That's not kosher because the mic input has too much gain, the signal will be clipped, which is what the "through ChucK" sample sounds like. Or maybe you were using a mic and have this problem? It's difficult to tell from the way you worded that.

Why not try the miniAudicle and look to see what appears in the input selections? It may be an OS X configuration issue, like you have to select it in Sound of System Settings or something. I know when I use line-in with my guitar plugged into it, I must select line-in in System Settings / Sound.

Maybe that helps? I'm not clear on your problem, but try those things. Cheers!


Thanks for the tips. The guitar through the mic thing actually worked pretty ok, it's when I use the synth in another input (a line one) that I get the problem. Besides, I've been putting my guitar into mic inputs without problems - I've always thought that gits and mics worked similarly in this respect. Shocked

Are there input selections in MiniAudicle? I'll have a look there, thanks (I normally stick to the command line). Smile

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 3684
Location: Sweden
Audio files: 266
G2 patch files: 96

PostPosted: Sun Dec 21, 2008 1:23 pm    Post subject: Reply with quote  Mark this post and the followings unread

@Kassen - thanks for the tips. I'll do a driver check and then post to the list if it doesn't help.

@Inventor - tried MiniAudicle. I wish I did this sooner since it's a bit more user-friendly, but I still get the same behaviour.

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Dec 21, 2008 1:28 pm    Post subject: Re: Multiple inputs into Chuck
Subject description: What's the easiest approach?
Reply with quote  Mark this post and the followings unread

Inventor wrote:

hmmm, you tried a mic input with your guitar. Does this mean that you plugged your guitar into the mic input? That's not kosher because the mic input has too much gain, the signal will be clipped, which is what the "through ChucK" sample sounds like.


That depends on the exact input. the mic inputs on my own soundcard can take mic (with phantom power if needed), guitar or line signals; balanced or unbalanced though of course there is a need to set a appropriate gain. That's quite kosher, the manual covered this and it can even apply amp and cabinet emulations internally if needed (cute for testing a guitar with no amp around).

This will also depend on the guitar used but a mic input/pre-amp on a external soundcard like a Motu will have a knob for pre-amp gain, hopefully with a few meters. It becomes a different issue with build-in soundcards that only have a mini-jack; those are nice for simple things like a mic for online chatting but not the kind of thing to use for recording guitar if it can be at all avoided. Considering the price-class of the MOTU (basically the same as my EMU) I'd be severely disapointed if that instrument/mic input wouldn't be perfectly capable of making every respectable guitar recordings in this configuration.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Sun Dec 21, 2008 1:30 pm    Post subject: Reply with quote  Mark this post and the followings unread

Stefan, I dunno, I'm still learning about the levels of various equipment, but I thought that guitars generally had signal levels way higher than mics. When I built my combo mic/guitar amplifier I needed two opamps in series with a total gain of about 1,000 on the cermet mic (the little button type, not a studio type), while the guitar needed only a gain of 50 or so. Maybe studio mics are stronger signal levels, and maybe your soundcard's amplifier is set up for lower gains than I needed.

Yes, the miniAudicle has a graphical pull-down menu for selecting the sound input source in the preferences window. This is really handy because on the Mac I can select either the Apple sound system or SoundFlower for receiving routing from iTunes. Sometimes I am constantly switching the line-in/mic/SoundFlower options on and off in System Settings and also switching the Apple built-in audio / SoundFlower pulldown in miniAudicle to do what I want.

Note that you must restart the virtual machine after making changes to the preferences for them to take effect. Maybe the pulldowns in miniAudicle will help you "see" what the problem is, or what ChucK thinks your system has. Look at the Sound portion of System Preferences also, all your stuff should be listed and available on the input and output pulldowns. Cheers!

_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Dec 21, 2008 1:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:

@Inventor - tried MiniAudicle. I wish I did this sooner since it's a bit more user-friendly, but I still get the same behaviour.


It would be quite odd if the behaviour was different. The Mini's settings are based on the report from --probe and I believe they only affect the parameters for the VM. The underlying technology is the exact same RTAudio library.

I think it *used* to matter in the case of some soundcards that supported arbitrary sample rates like the RME's. In that case --probe tells us very little and the Mini didn't specify sensible defaults. I believe that has been fixed but I don't own a RME.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Sun Dec 21, 2008 1:35 pm    Post subject: Reply with quote  Mark this post and the followings unread

Oh, I see what you're saying Kassen, I'm used to using a line-in jack out of poverty and I didn't realize that sound cards could obviously be built to handle all inputs. Thanks, that improves my understanding of the whole situation (and makes me want a dang sound card too, but my setup will do for now. Gotta save up for a move to Texas.
_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20473
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Sun Dec 21, 2008 1:38 pm    Post subject: Re: Multiple inputs into Chuck
Subject description: What's the easiest approach?
Reply with quote  Mark this post and the followings unread

Antimon wrote:
I've always thought that gits and mics worked similarly in this respect.


No, but it'll work even when not optimal. The guitar output has quite some voltage level but at a high output impedance. A microphone input expects a low level signal but it has a low input impedance. So what happens is that you more or less short your guitar with the microphone input and that will make the the signal level of the guitar go down into a range more suitable for the mic input. However the guitar has no purely resistive output impedance but more an inductive one, and when you short it the frequency characteristic of the result will differ from what you'll get when you plug it into a high impedance input (it'll loose some of the high end as for higher frequencies the guitar's impedance will be higher resulting in more shorting for high frequencies).

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Sun Dec 21, 2008 1:45 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks Jan, that makes perfect sense. Dang, yer smart! LoL Laughing
_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20473
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Sun Dec 21, 2008 2:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

Inventor wrote:
Dang, yer smart!


It's more that the memory still works Wink But speaking about smart people, I read a bit about this guy to day, remarkable story ... but erm ... you maybe saw the movie already Laughing

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Dec 21, 2008 2:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

Inventor wrote:
Oh, I see what you're saying Kassen, I'm used to using a line-in jack out of poverty and I didn't realize that sound cards could obviously be built to handle all inputs.


Yes... Clearly there is a difference between a card that's build into a mother board that's maybe a buck or two in extra parts for general usage and a 500$ external card meant for professional applications; that should hardly be surprising. Latency, then number on in and outputs, the quality of the conversion, the type of connector, etc, etc, etc.

Fortunately there is a range of options. For you to record your guitar and voice, then listen to the results on a hi-fi a card like the ones Stefan and me are using will be overkill; you'd be paying for features you wouldn't use. Still, where money allows I think it's a bit of a shame to get a guitar and compose for it, then record it using a plain line-in. I'd suggest looking for a modest external soundcard equipped with two dedicated instrument instrument/ mic inputs with pre-amps. If at some time you budget could stretch to such a investment that might be a thing to consider. That said; creativity is of course far more important then the quality of your soundcard and modest budgets can certainly be a stimulation to come up with creative solutions like your external pre-amp.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Sun Dec 21, 2008 2:41 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well, i built an amplifier for the guitar, so that should take care of the noise problems. It's not quite the quality of a low-noise souncard amp, but the noise should be unnoticeable. Plus I put a mic on the other line-in channel so now ChucK can receive both guitar and mic from me. I did this so I could do that Peter Frampton thing in real time, like we talked about Kassen. So cool on that, delayed a sound card purchase for a while by using extra parts from around the house.
_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Antimon



Joined: Jan 18, 2005
Posts: 3684
Location: Sweden
Audio files: 266
G2 patch files: 96

PostPosted: Sun Dec 21, 2008 2:42 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks for the info about mic and guitar inputs, all! Yet another piece of knowledge gained from this marvellous place. Smile The ultralite has those combo XLR/TRS jacks, and reading the manual I understand that the XLR has impedance fitting for a microphone, and the TRS is adjusted for guitars.

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Dec 21, 2008 3:36 pm    Post subject: Reply with quote  Mark this post and the followings unread

It would be quite odd to have a guitar with a XLR cable :¬)
_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [23 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use