Output MOC on the input-channel of a device

Hi, how can i configure MOC to output it's sound on the "Mic" channel (or "Capture") of my Soundcard?

So, if i adjust the level of "Mic" in alsamixer, the volume of MOC will decrease but other applications won't decrease it's volume

I'm not sure it is possible since "Mic" is capture device. You should create new device specifically for moc. I never fully learned how to do it, but there are some tips here: http://www.alsa-project.org/main/index.php/Asoundrc

If you create such device, you just alter AlsaDevice variable in your .moc/config file.

Yeah, don't use Mic as an output device, "Ello".

Assuming this is a continuation of your previous post, if you set up separate devices for MOC and the adverts then you might be able to simply control the volume of MOC's device directly from the Ruby script. I don't know if doing so would change the volume of the underlying hardware device (and therefore affect both), but a simple experiment could answer that. If it does, there may be an ALSA plug-in which would act as a softmixer on the MOC device only.

I didn't get it to work. I guess it is not possible.

I now have listed a virtual device in alsamixer called "MOC" i can now tell moc to use the "MOC" device and with mocp i see that "MOC" is used, but when i change the sound levels in alsamixer nothing happens, so i guess this won't work completly the way i want.

but it was a workaround anyway. my goal is it to push the output of moc to the input "Mic" of the computer.

Because the Server and the Softwares running on them are designed that way. The usual workflow is:

attach an external music device per physical jack into the physical input of the box and the software does the rest.
the system wasnt designed to use internal software like moc oder mpd to play the music. i thought it would be easy to redirect the moc output to the input to simulate an external device because it would be easier to manage (the playlist) but i guess i'll have to use an external player (like another machine or an mp3 player or something)

Could you post your .asound file? I'll check it on my computer. Maybe there is some alsa option or plugin to enable volume controle on virtual devices.

Alternatively, I think jackd might do the trick. Or pulseaudio? But I know even less about them.

it did work with pulse audio

pcm.virtual_moc {
type pulse
}

pcm.moc_ctrl
type softvol
slave.pcm "virtual_moc"
control
{
name "MOCPlayback"
card 0
}
}

now i attach moc to AlsaDevice = pcm.virtual_moc
and AlsaMixer = MOCPlayback
AlsaMixer2 = Master

and now i can separately adjust moc volue

edit: well after my odissey i recognized the ~/.moc/softmixer file with a value, if you set Softmixer_SaveState to no in ~/.moc/config and edit ~/.moc/softmixer to active 1 and volume 10 it has the same effect if you just want to use the softvol effect, but in my case i can now tell in the ruby app to fade down the MOCPlayback control from pcm.virtual_moc and fade it back to its origin

Nice. However I am surprised that editing softmixer file worked for you. I couldn't make it see the changes (maybe because I didn't disable SaveSoftmixerstate).

Yes, you have to explicitly set Softmixer_SaveState to no because if you shutdown moc it writes the current settings back to the softmixer file and overwrites your settings made by hand. after each altering of the softmixer file you have to restart moc (shutdown with mocp -x)

i contacted the developer of the ruby app. he told me the application can only alter the Mic capture channel and no other.

i guess my MOCPlayback channel is obsolete with this answer and i need to find another solution

I'd assumed that the Ruby application you'd mentioned was yours, or at least open source. If it had been, it would have been no problem to get in and change the ALSA control with which it is dealing. But I now understand why you were so fixated on Mic despite it being unsuitable for the task.

So any solution would have to be external to both MOC and the Ruby application. That being the case, it would seem to come back to the ALSA solution I gave previously or an equivalent in JACK or PulseAudio.

Another possibility would be to route the MOC sound output to the Mic input (either physically or using JACK) and let the Ruby application attenuate it when it places adverts over the top. This, however, makes some assumptions about the capabilities of the Ruby application which are probably incorrect.

status updted