seeking basic info on making sounds and recording

Talk about your MIDI interfaces, microphones, keyboards...

Moderators: MattKingUSA, khz

Post Reply
User avatar
mandelflarn
Established Member
Posts: 5
Joined: Wed Dec 18, 2013 6:19 am

seeking basic info on making sounds and recording

Post by mandelflarn »

I'd like to record some sound and (later) make music. There doesn't seem to be
any useful guide anywhere. I'd have thought these things were wikified. I don't
know what to search for or what's relevant, so I'll ramble here. I don't use
ubuntu and don't want pulseaudio.

Compiling an rt-kernel (I already have CONFIG_PREEMPT=y), connecting a guitar
multieffect by MIDI or SPDIF, buying an ok XLR mic + preamp and setting up DAW,
sequencer, software synth are later questions. For now, is recording or even
just "sound in, sound out" possible at all?

I have never got sound out of ardour (or rosegarden or lmms or hydrogen).
I'll aim lower at first: Is it possible to just record sound with a regular
onboard soundcard (HDA ATI SB Realtek ALC889A)? If I put a simple headphone mic
in the (front) mic computer connector, is there some utility that just records
sound, with or without jackd?

I have a m-audio delta 1010lt. Where can I find info on setting it up? Currently
I'm trying a tascam dr07 recorder, its stereo line out to one red and one white
RCA in-cable on the m-audio card. No sound. Maybe the signal is too weak?

How do I know if the soundcard is working? If I select it in alsamixer, does
that mean all sound is going through it or does it just mean I change the
settings for it? What are the sliders and what do I set them to? I guess adc is
in and dac is out, right? Do I need monitors/headphones connected to the out
cables to hear sound or can I use the onboard computer out connection? Do I even
have to bother with alsamixer if I have qjackctl?

I should use qjackctl, right? Is that usefully documented somewhere? How do I
know what the things that show up in the connection and patchbay windows are?
What should be connected with what? What is even the difference between
connection and patchbay? Is it possible to have sound programs (browser, music
player, solfege) running while launching jackd? Sometimes it doesn't start even
if I close those things. How do I know what is blocking it?

Shadow_7
Established Member
Posts: 169
Joined: Tue Jun 08, 2010 3:35 pm

Re: seeking basic info on making sounds and recording

Post by Shadow_7 »

Audio via RCA, red is right, the rule of thumb. Therefor left is white.

You need to set your software mixer levels. ADC for analog to digital converter (INPUT) and DAC for digital to analog converter (OUTPUT). Via something like alsamixer. Pulse is pretty default these days. If you don't want it, then autospawn = no in /etc/pulse/client.conf and pulseaudio --kill. But some things like browsers and java and stuff are built around pulse, so you might as well make it work (sometimes).

In terms of doing things the hard way.
http://www.youtube.com/watch?v=68dNginMNKY
Some A/V sync at the end-ish. An old computer with low RAM.

$ cat /proc/asound/cards
To see where / what is already available in terms of soundcards that are known / supported. Where -d alsa -d hw:# where # is the ID/Number in /proc/asound/cards for what you might use as a jackd parameter. Various options past that.

tatch
Established Member
Posts: 662
Joined: Fri Nov 16, 2012 3:18 pm

Re: seeking basic info on making sounds and recording

Post by tatch »

http://kxstudio.sourceforge.net/ kxstudio is an audio distro that sets up basically everything you'd need to work with audio on linux. it has pretty good documentation too.

steevc
Established Member
Posts: 248
Joined: Fri May 23, 2008 7:05 pm
Location: Bedfordshire, UK
Contact:

Re: seeking basic info on making sounds and recording

Post by steevc »

I know there can be some initial frustration with getting this stuff working. I've been there. It took a while to get a grasp on the various concepts and we have been lacking in good guides on getting started. There are a few more now, but you have to find them first.

To configure the M-Audio interface you need one of the Envy24 apps (see http://wiki.linuxaudio.org/wiki/m-audio_delta) to set the various levels. If the analog volume is right down you are not going to hear anything.

For non-Jack usage if you have multiple audio interfaces you need to control which one gets used. I use the Pulseaudio Volume Control on Kubuntu for this. It has meters that should help you work out where the sound is going. I would first test that just playing some music from vlc or something like that works. Then you can use something like Audacity to try some recording. It's limited compared to Ardour, but I use it sometimes when I want to quickly grab some audio and edit it.

There's some info on setting up Jack at http://wiki.linuxaudio.org/faq/start?s[ ... rver_jackd. It can be tricky to find the right settings and it varies according to your hardware. It won't generally play well with other apps that are trying to do sound at the same time. I don't know how you check what is blocking it.

There's also some info at http://en.flossmanuals.net/ardour/ch015 ... on-ubuntu/

kxstudio has Cadence to control Jack http://kxstudio.sourceforge.net/Documen ... troduction
Steve
Sounds - http://soundcloud.com/steevc
Blog - http://studiospoon.blogspot.co.uk/
Recording via M-Audio Delta 66 (+Omni i/o) and Zoom H4. Got Korg nanoKONTROL and M-Audio Uno for my Casio keyboard.

User avatar
mandelflarn
Established Member
Posts: 5
Joined: Wed Dec 18, 2013 6:19 am

Re: seeking basic info on making sounds and recording

Post by mandelflarn »

I was unclear. I don't have pulseaudio installed. :D From screenshots, mudita seems to be the same as envy24control. It's a frontend to alsamixer, so I still have to save with alsactl store? It seems I have sound in, sound out without jack, but I can't record in audacity. There are about 60 "mic inputs" to choose from in its menu, I tried front mics 0, 1, 2.

I don't think I'll use kxstudio, since it is a whole new distro to install, but it would be an alternative as I'd have to reboot if I wanted to use an rt kernel anyway.

There are playback and capture things to connect. Maybe hydrogen needs to be connected to a confed software synth to make sound? Ardour needs some jackd connections to make sounds, I guess. It'd be nice if I could import a wav and just play it.

steevc
Established Member
Posts: 248
Joined: Fri May 23, 2008 7:05 pm
Location: Bedfordshire, UK
Contact:

Re: seeking basic info on making sounds and recording

Post by steevc »

mandelflarn wrote:I was unclear. I don't have pulseaudio installed. :D From screenshots, mudita seems to be the same as envy24control. It's a frontend to alsamixer, so I still have to save with alsactl store? It seems I have sound in, sound out without jack, but I can't record in audacity. There are about 60 "mic inputs" to choose from in its menu, I tried front mics 0, 1, 2.

I don't think I'll use kxstudio, since it is a whole new distro to install, but it would be an alternative as I'd have to reboot if I wanted to use an rt kernel anyway.

There are playback and capture things to connect. Maybe hydrogen needs to be connected to a confed software synth to make sound? Ardour needs some jackd connections to make sounds, I guess. It'd be nice if I could import a wav and just play it.
I know some people don't like/want/need pulseaudio. I don't know how to manage multiple audio devices without it. Things get complex when I have on-board audio plus Delta 66 and a webcam microphone.

Mudita/Envy24control seem to give more control than the standard ALSA mixer. The M-Audio cards have an internal mixer that you need to tweak. I don't know why you have so many inputs in Audacity.

You can access some kxstudio functionality by adding the repos. That's what I'm doing to get Ardour 3 and other new apps on Kubuntu 13.10. Mind you, I haven't done any recording on this latest set-up yet due to lack of time.

Hydrogen does not need a separate synth if you have a drumkit loaded. Generally the Jack apps should connect themselves to the master outputs automatically, but perhaps you are missing a setting. It might help to post some screenshots.

I'm by no means an expert on audio, but I've managed to get most of what I want working with help from people here and a few reference sites. I did some work on the wiki to try and document the various audio interfaces based on what I'd used and read about.
Steve
Sounds - http://soundcloud.com/steevc
Blog - http://studiospoon.blogspot.co.uk/
Recording via M-Audio Delta 66 (+Omni i/o) and Zoom H4. Got Korg nanoKONTROL and M-Audio Uno for my Casio keyboard.

User avatar
mandelflarn
Established Member
Posts: 5
Joined: Wed Dec 18, 2013 6:19 am

Re: seeking basic info on making sounds and recording

Post by mandelflarn »

I got audible sound from the tascam stereo mic through the m-audio delta. I can't record it, though. I can choose jack or alsa in audacity, but this time time I started it, it doesn't list any m-audio delta inputs. I'm not sure what to install, I got qtractor, qsynth, vmpk and timidity. timidity can play midi files and I can connect it to vmpk and play. aconnect doesn't list qsynth/fluidsynth. If I aconnect vmpk to qtractor, there's no sound. More connections? Maybe there need to be soundfonts? fluidr3 has multi-level dependencies, I don't know what to get, something small, simple and testable. Are there soundfonts that sound like real instruments and not 80:ies synths? I'm not really a midi/keyboard person, but I'd like to get the basics up.

Cadence seems overkill ATM, from the descriptions, I'm not sure what its subtools do, maybe later.

Jackd starts sometimes, it doesn't always die when I tell it. I have to kill -9 it. man jackd looks like a mess. It lists the same options several times, but they do different things. Not user friendly :D It refers to a nonexistent /etc/modules.conf . jackd won't start with -d hw:1 (I guess that's the pci card).

tatch
Established Member
Posts: 662
Joined: Fri Nov 16, 2012 3:18 pm

Re: seeking basic info on making sounds and recording

Post by tatch »

cadence+catia is a better-looking qjackctl. Try using cadence or qjackctl to start, stop and configure JACK. You want configure JACK to connect to your m-audio and start it before you load any other audio program. In qjackctl connections/catia, you will see system inputs/outputs, those are the ins/outs to your soundcard that you can connect to different apps.

Pablo
Established Member
Posts: 1269
Joined: Thu Apr 17, 2008 9:57 pm

Re: seeking basic info on making sounds and recording

Post by Pablo »

jackd [options] -d backend [backend-parameters]

For linux USB and PCI cards, the backend must be alsa. The simplest, and generally safest, jack command is:

jackd -d alsa -d hw:CARD

where CARD can be the card's short name (as shown between square brackets in /proc/asound/cards) or the card number (but this can change in different reboots unless you fix the order in the alsa base conf file, as explained in the alsa wiki, alsa.opensrc.org, multiple cards). The /etc/modules.conf the jackd manpage refers to is /etc/modprobe.d/alsa-base.conf in my system but it can be slightly different in yours.

However, note that cards are separated into so-called devices and that jack talks to devices. For example, if CARD above has only one duplex device (number 0) , all is fine, because jack will grab that device (hw:CARD,0) for capture and playback. This will be true for the m-audio PCI but some cards are messy and have several devices. A device can be "capture only", "playback only" or "capture and playback", aka duplex. arecord -l will tell you the capture devices and aplay -l the playback devices. Devices that are listed in both lists are duplex.

For a simple jack audio recorder, use jack_capture (command line) or time-machine (very simple gui).

Jack will give a generic name to the card that is using, it will call it "system". Don't expect to see "TASCAM" or "M-audio" by default. This means, that you have to be sure that jack has grabbed the right card.

Also note that some cards have internal mixers. The fact that you hear sound doesn't necessarily mean that the audio signal is going to the computer.

Shadow_7
Established Member
Posts: 169
Joined: Tue Jun 08, 2010 3:35 pm

Re: seeking basic info on making sounds and recording

Post by Shadow_7 »

I tend to use multiple soundcards. You almost can't avoid it. Your motherboard has a sound card, your video card, and you probably have a USB mic that functions as a soundcard. And if you're an audio type a USB or PCI audio device in addition to all that. A lot of times you have to select the card, and you have to set the mixer levels for the card(s) you use. Everything defaults to muted and to card 0 (as listed in /proc/asound/cards). Which isn't very intuitive as that's probably the motherboards soundcard.

$ cat /proc/asound/cards
to see what devices got assigned what card #

$ alsamixer -c #
where # is the card you want to use.

$ speaker-test -c 2 -d hw:#
where 2 is the number of channels. And # is the card # again. Control + C to exit that application aka ^C.

You can re-index modules so certain ones load first and therefor get the card 0 slot, but you might as well learn to deal with the multicard quirks now.

$ audacity
the simpler of the non-jackd audio options and a decent audio editor.
Edit -> Preferences -> Devices
to select the input and output device(s). And how many inputs you want to handle.
View -> Toolbars -> ???
various toggle-able things if you're a button and widget junky.

There's various .asoundrc tricks to get things to play nice and in the way you want. Just be aware of the defaults.pcm.card # option which is a quick way to get many things to not default to card 0 if you don't want to use card 0. But some things will always default to 0, i.e. very old and unmaintained applications.

~/.asoundrc

Code: Select all

defaults.pci.card 2
Will use whatever card got assigned to number 2 in /proc/asound/cards, if any. You can also create custom names for cards in .asoundrc so instead of passing hw:# where # is the card number which is the alsa name, you can use any non-reserved name.
~/.asoundrc

Code: Select all

pcm.BubbasBoomBox { type hw card 2 }
So instead of using say:
$ jackd -d alsa -d hw:2
to start jack, you can use
$ jackd -d alsa -d BubbasBoomBox
Just something to be aware of, and maybe too advanced for new to linux audio folks. Also be aware that the numbering sequence in /proc/asound/cards is not fixed and can change between boots. Unless you index them. It's even an issue for me, if I say, have the USB midi controller on during boot and then off when I boot again. So I have to reconfigure, or things may not work as I was expecting them to work.

I would hazard against using the soundcard from your motherboard if you have other options. They're kind of sensitive to external influences like cell phone handshakes, and otherwise have high noise floors. And in many cases lack full duplex capabilities so you cannot record over existing tracks since you cannot play them back while you record. Sometimes you can, but back to that influence thing as your output track will bleed into the input one even if you have isolation, i.e. headphones.

User avatar
mandelflarn
Established Member
Posts: 5
Joined: Wed Dec 18, 2013 6:19 am

Re: seeking basic info on making sounds and recording

Post by mandelflarn »

You don't have to read /proc/asound/cards yourself to see what the card is called today. Script it!

Code: Select all

grep M1010LT /proc/asound/cards | cut -d' ' -f2
for the name M1010LT. awk is even cooler.

Code: Select all

arecord -d 5 -D hw:$(grep M1010LT /proc/asound/cards | cut -d' ' -f2) -f S32_LE -t wav johncage433snippet.wav
There's no sound anyway, "Channels count non available". And I didn't even pick a number.

I downloaded two soundfonts. vmpk is aware of them when connected to fluidsynth. It doesn't matter much as fluidsynth has no out to connect. Hydrogen has sound.

audacity Edit -> Preferences -> Devices has the same inputs to choose from as the default menu.

I think I wan't to use the onboard soundcard when not making music, not sure why.
I guess I have have to read up on ~/.asoundrc

Pablo
Established Member
Posts: 1269
Joined: Thu Apr 17, 2008 9:57 pm

Re: seeking basic info on making sounds and recording

Post by Pablo »

Cool! Thanks for those terminal tricks!

I can't explain you exactly why, but don't use hw:CARD directly with arecord, use plughw:CARD instead. Although, for musical purposes, jack fits better than "pure alsa" and I think everyone here agrees with this.

I use pulseaudio for general purpose use and jack for music production. Pulseaudio can talk to jackified apps via pulseaudio-module-jack sinks and sources. Audacity is a nice editor, but not so good for recording. For audio multitrack recording, take a look at non-timeline and ardour. They both use jack.

You could also like nama (or ecasound?), which is a DAW with a text interface, used by some visually impaired people to make music.

EDIT: About fluidsynth/qsynth. Increase the timeout value in jackd (or qjackctl). qsynth tends to lose its jack audio ports with the default timeout.

User avatar
mandelflarn
Established Member
Posts: 5
Joined: Wed Dec 18, 2013 6:19 am

Re: seeking basic info on making sounds and recording

Post by mandelflarn »

Things have started to work. Hydrogen can export to midi, timidity can convert
to ogg and mplayer can play the file through jack. (This is just to test things,
it's not the workflow I'm after.) Timidity seems to have an outdated man page or
options need to come in a special order. I can't launch it with jack and the
error messages don't seem to correspond to the options in tha man page. It would
benefit from a frontend/gui. I'll find out how to load the extra patches I
downloaded.

I thought qsynth would control a running fluidsynth if I started and connected
it, but it runs its own server. The reverb and chorus controls do nothing. I
can't load sounds like in fluidsynth. Can I save the selections I make at the
fluidsynth prompt? fluidsynth doesn't seem confable.

mudita24 is better than envy24control in that it has its conf file hidden and
doesn't clutter $HOME.

cadence was smaller than I thought and worked without the subtools. I'd have to
look for loose python files for claudia or something. I guess it saves sessions,
but I'm not sure from the description. Savable connections would be worth it.
cadence is more magic than qjackctl and things just show up connected when I
start them. audacity won't connect, not the x-y-controller either. The catia
tool had the settings I was looking for in the main window. Rendering with
jack_capture works when I play a file with mplayer. A connected mplayer just
pops up on the canvas, great!

The qtractor connections window shows vmpk, although it isn't shown in cadence
(why isn't it?). Automagically, the hydrogen 2-bar song I made is "imported" or
something. I can't get rid of it. It isn't shown either. It'll be my backing
track forever. Mute and solo buttons don't do anything on any track. Nothing in
the mixer window does anything. vmpk to fluidsynth sounds, but vmpk to
fluidsynth to qtractor is silent. I can record through the stereo mic into the
m-audio card. qtractor doesn't give much control and it's ui is like gripping a
wet soap, but I'm beginning to make music. I'll try ardour and maybe
non-timeline.

Hydrogen is buggy sometimes, bpm can't be changed and it just loops one beat
when I restart it.

If I used the commandline for sound I'd write functions inside scripts, like
different functions to get the different card ids.

Code: Select all

function M1010LT() { awk '/M1010LT/ {print $1}' /proc/asound/cards ; }
Then I'd use M1010LT to get it or $(M1010LT) to insert it.

I get some xruns with a latency of 11ms (I think I set the buffer size in
several places) and the performance cpu freq governor, so I'll get that
rt-kernel. I hear some substantial latency through the chain from the mic to the
headphones, maybe jackd isn't the main latency source.

What's a transport? A wiki would be great.

Shadow_7
Established Member
Posts: 169
Joined: Tue Jun 08, 2010 3:35 pm

Re: seeking basic info on making sounds and recording

Post by Shadow_7 »

You can adjust things with jackd settings. The -p value before -d is number of portS and the -p after -d is size of ports. Both must be powers of 2 afaik. The -p before helps with stability, if it's too low you can have notes that don't happen like what you described. The -p after can help with latency or help with xruns. Having a larger value has fewer xruns, but a higher latency. A low value has lower latency but a higher likelihood of xruns. If you get some crackling noise when you get busy, you might need to change the number of periods -n.


I find the below works for gaming in browser, which is taxing and likely to cause xruns. YMMV

$ jackd -p512 -d alsa -d hw:0 -p2048 -D -n2 -r48000 -m -s -S

But that's a latency > 40ms.


For doing midi from mostly a command line

$ jackd -p128 -d alsa -d hw:0 -p512 -D -n2 -r48000 -m -s -S

For a latency closer to 5ms, but lots of issues if I push it.


On the laptop I have to use -n3 or things get crackly. Like when mashing the midi keyboard like a 2yo while connected to fluidsynth. But then again, low ram, slow cpu(s) and few of them, aka old machines.

Post Reply