Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a created a music visualisation using Processing. I now want to convert that to a video, and the least obtrusive way I could think of is to record a screencast.

I figured exporting Processing to video including audio, from within Processing itself, on ubuntu seemed an unsolved issue. Very hard and also could cause timing sync issues (since the music keeps running while images are captured). So move on to the screencast method.

Dead-easy, I figured. But I was wrong. First hurdle was to find a way to record the sound from the audio (and not the mic).

I did find a tutorial for that here.

In short: use gtk-recordmydesktop and pulse audio. Exactly:

  • start PulseAudio
  • start gtk-recordmydesktop, and set input from DEFAULT to pulse
  • start recording
  • see the Recording tab in PulseAudio, and selected Internal Audio (or Monitor)

This works if I record from e.g. my webbrowser playing a youtube movie. I see that appear in the PlayBack tab, and can then easily record it. But not for Processing. Processing is written in java. Processing does not use ALSA but uses the hardware devices directly to create the sounds. When the sound is playing, it does not appear in the Pulse Audio mixer.

How can I record the audio now?

share|improve this question

3 Answers 3

Alsaloop has never ... EVER ... failed me. It did, last time I checked, require a custom package though

share|improve this answer
    
Hi, that is a bit too cryptic for me. From what I gather, java programs (processing was written in java) use audio devices directly, so not through ALSA. Does this Alsaloop help in that case? I am able to configure Pulse Audio to record audio output from e.g. my browser, but Processing's sound output is not visible in Pulse Audio. Please provide more detail has to how alsaloop can help me? What do i need to do? –  nathanvda Mar 22 '12 at 22:52
    
Alsaloop is a linux audio device that can turn an output device into an input device –  hbdgaf Mar 22 '12 at 22:55

The solution in the link seems to be working perfectly (if I understood what you asked correctly). Did not even had to change any config in gtk-recordmydesktop to make it work.

You don't need to change anything in pavucontrol about Processing since it will not show in the recording tab, you need to change the gtk-recordmydesktop setting to capture your system sounds.

Here is a quick video on how I did it.

Don't complain about the music please, my neighbors love it! ;)
(at least they keep banging of joy on the walls every time I play it loud)

share|improve this answer
    
I've used gtk-recordmydesktop on many occasions. It's a great little app and already bundled in the PPA –  sfeole Mar 23 '12 at 2:02
    
I will try that out, not entirely sure if it maps to my question. I can record normal audio, just not audio coming from processing (which is a java program, which uses the audio devices directly). –  nathanvda Mar 23 '12 at 7:30
    
@nathanvda I have also tried it with Revenge of the titans which is a java based game, works the same :/ Test it and let me know how it went. –  Bruno Pereira Mar 23 '12 at 7:42
    
@Bruno: nope it did not work for me. I am guessing processing is doing something different. –  nathanvda Mar 23 '12 at 21:55
    
@nathanvda care to share what you are trying to do with Processing (or at least something that plays sound with it) so I can test? Add it to your question if so. –  Bruno Pereira Mar 23 '12 at 21:56
up vote 1 down vote accepted

I have found that java does not use ALSA but addresses the audio devices directly. Effectively rendering Pulse Audio useless, and thus disabling me to loop the audio back to input for recording. This seemed very hard to circumvent. Further reading learned that this could be related to the JDK in use. So how to circumvent this?

Processing is using java. But when java is run in the browser, it does use ALSA. Somehow, the browser-container handles that correctly for you.

So the easy solution: export your processing sketch to an applet, play the applet in your browser, and record! :)

I hope this can help someone else as well.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.