User Tools

Site Tools


music_on_linux:audio_관련_스크립트_모음

This is an old revision of the document!


Audio 관련 스크립트 모음

Ted's original audio scrip

Available from http://tedfelix.com/linux/linux-midi.html

#!/bin/bash

# Script to launch audio servers for music-making.

case $1 in

  start )
    echo Starting JACK...

    # Start JACK
    # As of Ubuntu 12.10, a period of 128 is needed for good fluidsynth
    # timing.  (jackd 1.9.9, fluidsynth 1.1.5)
    # If you aren't running pulseaudio, you can remove the pasuspender line.
    pasuspender -- \
        jackd -d alsa --device hw:0 --rate 44100 --period 128 \
            &>/tmp/jackd.out &

    sleep .5

    echo Starting fluidsynth...

    # Start fluidsynth
    fluidsynth --server --no-shell -p "fluidsynth 1" --audio-driver=jack \
        --connect-jack-outputs --reverb=0 --chorus=0 --gain=0.8 \
        -o midi.autoconnect=false \
        /usr/share/sounds/sf2/FluidR3_GM.sf2 \
        &>/tmp/fluidsynth.out &

    sleep 1

    if pgrep -l jackd && pgrep -l fluidsynth
    then
      echo Audio servers running.
    else
      echo There was a problem starting the audio servers.
    fi

    ;;

  stop )
    killall fluidsynth
    killall jackd
    echo Audio servers stopped.
    ;;

  * )
    echo Please specify start or stop...
    ;;
esac

정해영의 audio.qsynth script

#!/bin/bash

# Script to launch audio servers for music-making.
# from Ted's Linux MIDI Guide (http://tedfelix.com/linux/linux-midi.html)
# modified by Haeyoung Jeong

DEVICE=$2

case $1 in

  start )
    if [ -z ${DEVICE} ]
    then
        echo You did not specify any sound card!
        exit 1
    fi

    PATTERN="\[${DEVICE}  "
    if grep -q "${PATTERN}" /proc/asound/cards; then
        echo Audio device ${DEVICE} found!
    else
        echo ${DEVICE} is not a valid sound card!
        exit 1
    fi
    echo Starting JACK using ${DEVICE}...

    # Start JACK
    # As of Ubuntu 12.10, a period of 128 is needed for good fluidsynth
    # timing.  (jackd 1.9.9, fluidsynth 1.1.5)
    # If you aren't running pulseaudio, you can remove the pasuspender line.
   pasuspender -- \
        jackd -d alsa --device hw:${DEVICE} --rate 48000 --period 128 \
              --nperiod 3 &>/tmp/jackd.out &

    sleep .5

    # Start Qsynth
    echo "Press Esc key within 3 seconds to skip Qsynth:"
    read -t 3 -rsn 1 input
    if [ "$input" = $'\e' ]; then
        echo "Skipping Qsynth..."
        if pgrep -l jackd
        then
            echo JACK server running.
        fi
    else
        echo Starting Qsynth...
        qsynth -m alsa_seq -a jack \
            --connect-jack-outputs --reverb=0 --chorus=0 --gain=0.8 \
            /usr/share/sounds/sf2/FluidR3_GM.sf2 \
            &>/tmp/qsynth.out &
        sleep 1
        if pgrep -l jackd && pgrep -l qsynth
        then
          echo Audio servers running.
        else
          echo There was a problem starting the audio servers.
        fi
    fi

    echo You may start qjackctl and PulseAudioJackSink \(post_jack\).
    echo Please run 'a2jmidid -e' if you have hardware MIDI devices connected.
    echo You may use 'a2j -e' instead.

    ;;

  stop )
    if pgrep -l qsynth
    then
        killall qsynth
    fi
    killall jackd
    echo Audio servers stopped.
    ;;

  * )
    echo Please specify start or stop...
    ;;
esac

정해영의 start_jack_uca200 script

music_on_linux/audio_관련_스크립트_모음.1616386816.txt.gz · Last modified: 2021/03/22 04:20 by hyjeong