Posts Tagged ‘mplayer’
I recently bought myself a Yamaha YPG-635 digital piano. It saves
recordings internally as SMF (Standard Midi Format) files. While
that’s good if you want to do some further midi sequencing, I don’t
yet feel the urge to properly set up a linux midi workstation just to
share some of my amateurish playings with family and friends–a quick
way to export them to wav files would be enough. The built-in speaker
of this DP is crappy, but the headphone out is pretty decent (I’m
using a pair of Sennheiser HD650 cans), so it seems natural to feed it
into the soundcard’s Line-in jack.
Turns out it’s not a simple matter of “plug and record”, so here’s a
mini-Howto. I’m using a Chaintech AV-710 soundcard (already
discontinued for some time now, but among other things has a pretty
decent wolfson DAC on the alt-out jack).
1 Sound card settings:
I’m talking about the settings you can tweak in alsamixer
Playback. Go to the playback tab in alsamixer. To reproduce the
line-in signal on the wolfson output (the black jack right next
to the actual S/PDIF jack), set “S/PDIF” from PCM to “H/W In 0”,
and “S/PDIF 1” to “H/W In 1”. These correspond to the left/right
channel of the line-in signal (so you get stereo!)
NB: I didn’t try to reproduce it on the “front out” jack (which
nobody using AV-710 would use!). The “S/PDIF” and “S/PDIF 1” are
probably referring to the wolfson device. (“S/PDIF 0” is probably
the actual S/PDIF jack)
Capture. Go to the capture tab in alsamixer. Press space on the
“Line” device. There are multiple capture devices on this card
and they seem mutually exclusive (i.e., pressing space on e.g.
“Mic” would activate “Mic” and deactivate “Line”).
Since the DP jack is really a headphone out, better set the
“Capture” gain to zero–no good can come out of double amping!
2 Recording command:
arecord -D plughw:0,0 -f cd -t wav cavatina.wav
Now hit the Play button on your DP. The song (Cavatina in this case.
Beautiful piece by Stanley Myers btw.) will be recorded to
cavatina.wav as you hear it from your wolfson out. Notice that
plughw is necessary b/c natural format of AV-710 is S32LE instead
of the 16bit cd format (S16LE). The “plughw” ALSA plugin will do
the format converting job.
3 Combining audio with video:
mencoder cavatina.avi -audiofile cavatina.wav -delay -0.55 -oac copy -ovc copy -o cavatina-song5-track4-audio.avi
mplayer your-video.mkv -ao pcm:waveheader:file=output.wav
mplayer will suggest you to use -vo null -vc null -ao pcm:fast to achieve faster result, but somehow this doesn’t work for my file at hand
with error message:
MPlayer interrupted by signal 11 in module: init_audio_codec
have to switch gcc profile back to 4.3.3
Well, I was about to write about using cdemu to simulate a cd-device from an .nrg file, and then use mplayer to play the simulated device. It turns out you don’t even need cdemu if it’s a media cd/dvd image. Here’s the cli:
mplayer cdda:// -cdrom-device yourfile.nrg -rawaudio format=0x2001
the only mysterious part is the magic number 0x2001, telling mplayer the disc has dts rawaudio. Apparently you can find this number by man mplayer and search for dts.